Jump to content

[Infusion dev help] need diff alternative


phpsystems
 Share

Recommended Posts

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/sh

SUBNET=$1
NMAP=/usr/bin/nmap
TMPDIR=/tmp/autonmap
SUBNET2=$(echo $SUBNET | sed -e 's/\//_/g')

if [ -z $SUBNET ]; then
echo "Usage: autonmap.sh "
exit
fi

mkdir -p $TMPDIR
mkdir -p $TMPDIR/results

# Start of the While
while [ 1 ] ; do
$NMAP -sP $SUBNET -oG $TMPDIR/$SUBNET2.txt
diff -Naur $TMPDIR/$SUBNET2.txt.old $TMPDIR/$SUBNET2.txt > $TMPDIR/$SUBNET2.diff
for i in `cat $TMPDIR/$SUBNET2.diff | grep -E "^\+Host:" | awk '{print $2}'`; do
DATE=$(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 &
done
mv $TMPDIR/$SUBNET2.txt $TMPDIR/$SUBNET2.txt.old
wait
sleep 1
done

Any help is greatly appreciated. My plan is to then turn this in to a full infusion with access to the scan reports.

Tim

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...