#!/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 "

HTTP Servers

" > $log.html grep 'Discovered open port 80' "$log"|\ awk '{print $6}'|while read ipaddress do echo "$ipaddress
" done >> $log.html echo "
" >> $log.html echo "

Printer Servers

" >> $log.html grep 'Discovered open port 9100' "$log"|\ awk '{print $6}'|while read ipaddress do echo "$ipaddress
" done >> $log.html termux-open $log.html nmap -v $ipr.0/24 |tee -a "$log" grep "Discovered open port" $log