Thanks man.
##########UPDATE##########
Added 'true open port' verification and banner grabbing (optional of course). 'True open port' meaning that the port is actually OPEN and receiving connections and doesn't just hang there with "Escape character is '^]'." As you can see from the pics, the first IP was not actually open so it didn't get displayed. The code is a little jarbbled atm but I'm really tired, I'll work on better extracting the banners with IPs in the AM. If any of you find any problems with it, please don't hesitate to let me know

You'll need netcat if not installed already. Also, it creates 2 files in ~/nmap/, one called 'list' and the other 'banners'. "list" has all the grabbed info from the scans and "banners" has the grepped info which is displayed. Like I said, it still needs some work.. :s


Zeh cood
Code:
#!/bin/bash
## Just some random, simple nmap bullshit brought to you from n1x4
clear
echo -e "\e[1;34m#########################################################################"
echo -e "# #"
echo -e "# \E[1;3;34mScanning utility to find open ports on random IPs\e[1;34m #"
echo -e "# \e[0;5;32m-n1x4\e[0m\e[1;34m #"
echo -e "#########################################################################\e[0m"
echo ""
echo ""
function target {
echo -n -e "\E[1;4;37mEnter the number of random IPs you wish to scan.\E[0m\n>"
read TARGETS
}
function port {
echo -n -e "\e[1;4;37mEnter the port you wish to scan for.\e[0m\n>"
read PRT
}
function filename {
echo -n -e "\e[1;4;37mEnter grepable filename.\e[0m\n>"
read FILE
}
target
echo ""
port
echo ""
filename
clear
function nmap1 {
nmap -Pn -p$PRT -iR $TARGETS -oG ~/nmap/$FILE &>/dev/null
}
echo -e "\E[0;5;31mScanning\E[0m\nPlease be patient."
nmap1
clear
function grep1 {
grep -E '/open/' ~/nmap/$FILE | awk '{print $2}' >> ~/nmap/$FILE-open
}
grep1
clear
function open {
cat ~/nmap/$FILE-open | wc -l
}
######################### Banner grabbing stuff ####################################
function nca {
echo $ip
timeout 2 nc -T $ip $PRT; echo -e -n "\n"
}
function ncat2 {
echo ''
list=list
for ip in $(cat ~/nmap/$FILE-open); do
nca
done >> ~/nmap/$list
}
function cat_ncat {
cat ~/nmap/$list | wc -l
}
function grep_cat {
grep -E -B4 'User|user|Login|login|Password|password|PASSCODE|passcode' ~/nmap/$list >> ~/nmap/banners
cat ~/nmap/banners
}
function 23-serv {
echo ''
echo -n -e "\e[1;33mConfirm validity of open ports and attempt to grab banners?\e[0;m [y/n]\n>"
read CONT
if [ $CONT = y ]; then
clear
echo -n -e "\e[0;5;31mConfiming open port status and mapping out banners, if present.\e[0m"
ncat2
else
echo -n -e "Bye.\n"
rm -rf ~/nmap/$FILE ~/nmap/$FILE-open
sleep 1s
exit
fi
}
function grab {
if [ $(cat_ncat) > 0 ]; then
echo ''
grep_cat
else
echo -n - "Nothing!\n"
fi
}
if [ $(open) = 0 ]; then
echo -n -e "There were \e[1;5;35mNO\e[0m open services found on port $PRT out of $TARGETS IPs.\n"
sleep 1s
exit
else
cat ~/nmap/$FILE-open
echo -n -e "Scanned $TARGETS IPs and found \e[1;4;31m$(open)\e[0m with open services."
echo -n -e ""
23-serv
grab
fi
rm -rf ~/nmap/$FILE
rm -rf ~/nmap/$FILE-open
#rm -rf ~/nmap/list
exit