Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #created by Kris Occhipinti
- #http://filmsbykris.com
- #Copyright Jan 2019
- #GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
- #For use in Termux on Android
- #quickly scans network based you current device's ip
- log=$HOME/downloads/scan_$(date +%s).log
- ip="$(ip addr|grep wlan -A3|grep inet|head -n1 |awk '{print $2}'|cut -d\/ -f1)"
- ipr="$(echo "$ip"|cut -d\. -f1,2,3)"
- echo "-------$ip--------"
- #scan for http and printer servers
- nmap -v $ipr.0/24 -p 80 |tee -a "$log"
- nmap -v $ipr.0/24 -p 9100 |tee -a "$log"
- #create HTML output
- echo "<h1>HTTP Servers</h1>" > $log.html
- grep 'Discovered open port 80' "$log"|\
- awk '{print $6}'|while read ipaddress
- do
- echo "<a href='http://$ipaddress'>$ipaddress</a><br>"
- done >> $log.html
- echo "<br>" >> $log.html
- echo "<h1>Printer Servers</h1>" >> $log.html
- grep 'Discovered open port 9100' "$log"|\
- awk '{print $6}'|while read ipaddress
- do
- echo "<a href='http://$ipaddress'>$ipaddress</a><br>"
- done >> $log.html
- termux-open $log.html
- nmap -v $ipr.0/24 |tee -a "$log"
- grep "Discovered open port" $log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement