Skip to content

Instantly share code, notes, and snippets.

Created November 5, 2016 21:55
  • Star 26 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Script to NMAP a network and Post Differences to Slack
OPTIONS="-v -T4 -F -sV"
date=$(date +%Y-%m-%d-%H-%M-%S)
cd /nmap/diffs
nmap $OPTIONS $TARGETS -oA scan-$date > /dev/null
curl -F file=@diff-$date -F initial_comment="Internal Port Change Detected" -F channels=#alerts -F token=xxxx-xxxx-xxxx
if [ -e scan-prev.xml ]; then
ndiff scan-prev.xml scan-$date.xml > diff-$date
[ "$?" -eq "1" ] && sed -i -e 1,3d diff-$date && slack
ln -sf scan-$date.xml scan-prev.xml
Copy link

I dig it, but its a problem (that I have been able to solve) with scanning AWS hosts externally since - I am scanning against the CNAME. With AWS the IP address/and A record changes frequently causing false alerts. Trying to figure out chopping the header information leaving the ports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment