phpsystems Posted January 16, 2015 Share Posted January 16, 2015 Hi, I've written a script in shell which automatically ping scans clients in a subnet every second, and does deeper scans on any new clients. I'm using diff to generate a "what's changed" report, which isn't on the pineapple. Anyone know of an alternative? The code for the script (which works on Kali) is here: # cat autonmap.sh #!/bin/shSUBNET=$1NMAP=/usr/bin/nmapTMPDIR=/tmp/autonmapSUBNET2=$(echo $SUBNET | sed -e 's/\//_/g')if [ -z $SUBNET ]; thenecho "Usage: autonmap.sh "exitfimkdir -p $TMPDIRmkdir -p $TMPDIR/results# Start of the Whilewhile [ 1 ] ; do$NMAP -sP $SUBNET -oG $TMPDIR/$SUBNET2.txtdiff -Naur $TMPDIR/$SUBNET2.txt.old $TMPDIR/$SUBNET2.txt > $TMPDIR/$SUBNET2.difffor i in `cat $TMPDIR/$SUBNET2.diff | grep -E "^\+Host:" | awk '{print $2}'`; doDATE=$(date +%Y%m%d%H%M%S)$NMAP -sT -p1-65335 $i -oG $TMPDIR/results/$i-TCP-$DATE.txt &# $NMAP -sU -p1-65335 $i -oG $TMPDIR/results/$i-TCP-$DATE.txt &donemv $TMPDIR/$SUBNET2.txt $TMPDIR/$SUBNET2.txt.oldwaitsleep 1done Any help is greatly appreciated. My plan is to then turn this in to a full infusion with access to the scan reports. Tim Quote Link to comment Share on other sites More sharing options...
phpsystems Posted January 16, 2015 Author Share Posted January 16, 2015 And, I can just use the package "diffutils"... Quote Link to comment Share on other sites More sharing options...
newbi3 Posted January 16, 2015 Share Posted January 16, 2015 can you "opkg list | grep dif" Quote Link to comment Share on other sites More sharing options...
phpsystems Posted January 16, 2015 Author Share Posted January 16, 2015 And now I've found a way to do what I want to do with grep, so no extra packages to install. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.