Created
September 13, 2019 11:45
-
-
Save 3m3x/247d6319fa3481f8a95584105939fdec to your computer and use it in GitHub Desktop.
Nmap a target periodically and be updated on any changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Taken from https://nmap.org/book/ndiff-man-periodic.html | |
# | |
# Add the following to your crontab to run the scan at 1PM each day: | |
# | |
# 0 13 * * * /home/YOUR_HOME_DIR/bin/nmap-scan-diff.sh | |
# | |
TARGETS="192.168.1.1" | |
OPTIONS="-v -T4 -F -sV" | |
date=`date +%F` | |
cd $HOME/nmap_scans | |
nmap $OPTIONS $TARGETS -oA scan-$date > /dev/null | |
if [ -e scan-prev.xml ]; then | |
ndiff scan-prev.xml scan-$date.xml > diff-$date | |
echo "*** NDIFF RESULTS ***" | |
cat diff-$date | |
echo | |
fi | |
echo "*** NMAP RESULTS ***" | |
cat scan-$date.nmap | |
ln -sf scan-$date.xml scan-prev.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment