Skip to content

Instantly share code, notes, and snippets.

@gfoss
Last active July 20, 2016 05:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfoss/6426436 to your computer and use it in GitHub Desktop.
Save gfoss/6426436 to your computer and use it in GitHub Desktop.
Simple script used to set peepingtom.py to run automatically via bash script + cronjob, serve up the content and send out e-mail notifications.
#!/bin/bash
#
# Utilizing LaNMaSteR53's peepingtom.py script to auto-scrape web servers and send out notifications.
# Optimized for Kali Linux
# greg.foss[at]owasp.org
#
# cronjob to run this script once a week every Sunday at Midnight
# 0 0 * * 0 /usr/share/peepingtom/autopeep.sh
# prepare storage location, remove old data, and migrate existing folders
if [ -f /var/www/hosts/archive/*.* ]
then
rm /var/www/hosts/archive/*.*
fi
mv /var/www/hosts/*.* /var/www/hosts/archive/
# run nmap sweep of host-range to find new services
if [ -f /usr/share/peepingtom/hosts.xml ]
then
rm /usr/share/peepingtom/hosts.xml
fi
nmap -sS -Pn -p 80,81,82,443,1000,8000,8080,8443,3780,3790 [IP ADDRESS RANGE] -oX /usr/share/peepingtom/hosts.xml
python /usr/share/peepingtom/peepingtom.py -x /usr/share/peepingtom/hosts.xml
# use text file of existing services
#python /usr/share/peepingtom/peepingtom.py -l /usr/share/peepingtom/host-list.txt
# serve up files
mv /usr/share/peepingtom/hosts/* /var/www/hosts/
echo -y | rm -rf /usr/share/peepingtom/hosts/
mv /var/www/hosts/peepingtom.html /var/www/hosts/index.html
# email notification
sendEmail -f [FROM@address.com] -t [TO@address.com] -u 'Application Sweep Completed' -m 'Application sweep has been completed, you may view the results here: http://[SITE]/hosts/index.html' -s [SEND.SITE.COM]:25 -o tls=no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment