Advertisement
iscomsa

recon&enum-scan

Aug 14th, 2017
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.49 KB | None | 0 0
  1. #!/bin/bash
  2. if [ $# == 0 ] ; then
  3. echo -e "\n\e[00;31m##########################################\e[00m"
  4. echo -e "\e[00;31m#\e[00m" "\e[00;33mPenetration Testing Enumeration Script\e[00m" "\e[00;31m#\e[00m"
  5. echo -e "\e[00;33m# www.malrawr.com\e[00m"
  6. echo -e "\e[00;33m# $v\e[00m\n"
  7. echo -e "\e[00;33m# Example: ./penenum.sh <IP ADDRESS>"
  8. echo -e "\e[00;33m# Additionally, this script needs the following tools:"
  9. echo -e "\e[00;33m#"
  10. echo -e "\e[00;33m# tee"
  11. echo -e "\e[00;33m# nmap"
  12. echo -e "\e[00;33m# nikto"
  13. echo -e "\e[00;33m# enum4linux"
  14. echo -e "\e[00;33m# nmblookup"
  15. echo -e "\e[00;31m##########################################\e[00m"
  16.  
  17. exit 1;
  18. fi
  19.  
  20. commands=(
  21. "tee"
  22. "nmap"
  23. "nikto"
  24. "enum4linux"
  25. "nmblookup"
  26. )
  27.  
  28. echo "Checking if approriate tools are installed."
  29. for command in "${commands[@]}"
  30. do
  31. echo "Checking $command..."
  32. command -v "$command" >/dev/null 2>&1 || { echo >&2 "Uh, $command is not installed!. Aborting script."; exit 1; }
  33. echo "Okay good, $command is installed!"
  34. done
  35.  
  36. echo "Creating a directory:"
  37. echo "Checking if /tmp exists..."
  38. mkdir /tmp
  39. echo "Setting up a directory inside /tmp for results..."
  40. mkdir /tmp/results
  41. echo "Creating a directory for the IP"
  42. mkdir /tmp/results/$1
  43.  
  44. echo "Running NMAP to find OPEN Ports and Services"
  45. nmap -Pn -sS -T 4 "$1" -p- -oG /tmp/results/$1/$1-nmap-oG.txt | tee /tmp/results/$1/$1-nmap-full.txt &> /dev/null
  46. echo "Nmap results exports."
  47. echo "Preparing output for parsing:"
  48. cat /tmp/results/$1/$1-nmap-oG.txt | grep "Ports" | cut -d ":" -f3 | tr "," "\n" | cut -d " " -f2 | tee /tmp/results/$1/$1-parsed-results.txt &> /dev/null
  49.  
  50. echo "Now attempting to retrieve information:"
  51. cat /tmp/results/$1/$1-parsed-results.txt | cut -d " " -f2 | cut -d "/" -f1 | tee /tmp/results/$1/$1-ports.txt &> /dev/null
  52. cat /tmp/results/$1/$1-parsed-results.txt | cut -d " " -f2 | cut -d "/" -f5 | tee /tmp/results/$1/$1-services.txt &> /dev/null
  53.  
  54. while read port <&3 && read service <&4; do
  55. echo "Checking $port which is running $service:"
  56. if [ "$service" == "ftp" ]; then
  57. echo "Now running ftp scans."
  58. fi
  59.  
  60. if [ "$service" == "ssh" ]; then
  61. echo "Now running ssh scans."
  62. fi
  63.  
  64. if [ "$service" == "telnet" ]; then
  65. echo "Now running telnet scans."
  66. fi
  67.  
  68. if [ "$service" == "smtp" ]; then
  69. echo "Now running smtp scans."
  70. fi
  71.  
  72. if [ "$service" == "domain" ]; then
  73. echo "Now running domain scans."
  74. NAME=`nmblookup -A "$1" | grep "<00>" | grep -v "<GROUP>" | cut -d " " -f1` &> /dev/null
  75. fi
  76.  
  77. if [ "$service" == "http" ] || [ "$service" == "ssl/http" ] || [ "$service" == "https" ]; then
  78. echo "Now running http scans."
  79. {
  80. nohup nikto -h "$1":"$port" | tee /tmp/results/$1/$1-nikto-$port.txt &
  81. nohup dirb http://"$1"/ | tee /tmp/results/$1/$1-dirb-$port.txt &
  82. } &> /dev/null
  83. fi
  84.  
  85. if [ "$service" == "microsoft-ds" ]; then
  86. echo "Now running smb scans."
  87. nohup enum4linux -a "$1" | tee /tmp/results/$1/$1-enum4linux.txt &> /dev/null &
  88. fi
  89. done 3</tmp/results/$1/$1-ports.txt 4</tmp/results/$1/$1-services.txt
  90.  
  91. echo "Waiting for commands to finish"
  92. wait
  93. echo "Okay, everything is now finished!"
  94.  
  95. echo "Here is a little information about the target."
  96. echo "Host name:"
  97. echo "$NAME"
  98. Version 2
  99.  
  100. #!/bin/bash
  101.  
  102. ###############################################################################################################
  103. ## [Title]: penenum.sh -- penetration testing enumeration script
  104. ## [Author]: www.malrawr.com
  105. ##--------------------------------------------------------
  106. ## [Details]:
  107. ## This script is meant to be executed against a single IP for the purpose of gathering network information on
  108. ## discovered services.
  109. ##
  110. ## This bash script is modeled after Mike's and Jivoi's python scripts. It executes further actions
  111. ## automatically and for some actions (password attacks) it only recommends the correct line syntax, so that
  112. ## the user can decide on the appropriate action to take.
  113. ###############################################################################################################
  114.  
  115. ###############################################################################################################
  116. ## [To Do]:
  117. ## This script is in a functional state to be used, however it is not yet complete. I plan
  118. ## [Needed Features]:
  119. ## * Fix message formatting
  120. ## * Add better warning colors
  121. ## * Complete the dictionary for HTTP & HTTPS
  122. ## * Change the the if statement to include anything from the dictionary list
  123. ## * Add service enumeration suggestions for services it's not able to enumerate
  124. ## * For example, if VNC service is found it tells the user what it is and advises on course of action
  125. ## * This can be expanded also with grep, say for instance if a service is called httpaproxy, it's http
  126. ## but the script will overlook that. A grep command inside the if statement can be used to check for
  127. ## that and then if it really is http it gets added to the enumeration suggestion part of the script
  128. ## * Improve on command and path checking
  129. ## * Change so that if a tool is not installed the user gets prompted to continue or not.
  130. ## * However, NMAP must be installed without exception. So modify to suit this
  131. ## * Do the same above but this time check to see if password and user lists exist. Especially rockyou.txt
  132. ## [Future Features]:
  133. ## * Give the script an option to use automatic enumeration or just just show the suggestions. For now it does
  134. ## both.
  135. ###############################################################################################################
  136.  
  137. if [ $# == 0 ] ; then
  138.  
  139. echo "##########################################################"
  140. echo "## Penetration Testing Enumeration Script "
  141. echo "## www.malrawr.com "
  142. echo "## [Usage]: ./penenum.sh <TARGET IP> "
  143. echo "##########################################################"
  144.  
  145. exit 1;
  146. fi
  147.  
  148. # Script Paths
  149. IP="$1"
  150. SCRIPTPATH=`dirname $(realpath $0)`
  151. OUTPUT="$SCRIPTPATH/results-penenum/$IP"
  152.  
  153. # Script Colors
  154. RED='\033[1;31m'
  155. BLUE='\033[1;34m'
  156. GREEN='\033[1;32m'
  157. YELLOW='\033[49;93m'
  158. NC='\033[0m' # No Color
  159.  
  160. #Dictionary for HTTP and HTTPS
  161. webHTTP=(
  162. "http"
  163. "www"
  164. "http-alt"
  165. "http-alt-alt"
  166. "www-http"
  167. "www-dev"
  168. )
  169.  
  170. webHTTPS=(
  171. "https"
  172. "ssl/http"
  173. )
  174.  
  175. TOOLS=(
  176. "tee"
  177. "nmap"
  178. "nikto"
  179. "enum4linux"
  180. "nmblookup"
  181. "hydra"
  182. "medusa"
  183. "smtp-user-enum"
  184. "onesixtyone"
  185. "snmpwalk"
  186. "gobuster"
  187. )
  188.  
  189. echo "[*] Running a check to see if tools are installed"
  190. for TOOL in "${TOOLS[@]}"
  191. do
  192. command -v "$TOOL" > /dev/null 2>&1 || { echo >&2 " [x] Uh, $TOOL is not installed!. Aborting script."; exit 1; }
  193. done
  194.  
  195. echo "[*] Creating output directory, $OUTPUT"
  196. mkdir -p $OUTPUT
  197.  
  198. echo "[*] Running NMAP on $IP to find OPEN Ports and Services"
  199. echo " [>] Executing aggressive TCP scan"
  200. echo " [=] nmap -v -Pn -A -sC -sS -T 4 $IP -p- -oG $OUTPUT/greplist_$IP.nmap -oN $OUTPUT/tcp_full_$IP.nmap &> /dev/null"
  201. nmap -v -Pn -A -sC -sS -T 4 $IP -p- -oG $OUTPUT/greplist_$IP.nmap -oN $OUTPUT/tcp_full_$IP.nmap &> /dev/null
  202. echo " [>] Running aggressive UDP scan as background process"
  203. echo " [=] nmap -v -Pn -A -sC -sU -T 4 $IP --top-ports 200 -oN $OUTPUT/udp_top200_$IP.nmap"
  204. {
  205. nohup nmap -v -Pn -A -sC -sU -T 4 $IP --top-ports 200 -oN $OUTPUT/udp_top200_$IP.nmap &
  206. } &> /dev/null
  207.  
  208. echo " [=] Parsing output from $OUTPUT/greplist_$IP.nmap, saving to $OUTPUT/parsed_$IP.list"
  209. cat $OUTPUT/greplist_$IP.nmap | grep "Ports:" | sed 's/Ignored.*//' | cut -d " " -f4- | tr "," "\n" | tr -d " " | tee $OUTPUT/parsed_$IP.list &> /dev/null
  210. echo " [=] Creating list of PORTS from $OUTPUT/parsed_$IP.list, saving to $OUTPUT/ports_$IP.list"
  211. cat $OUTPUT/parsed_$IP.list | cut -d "/" -f1 | tee $OUTPUT/ports_$IP.list &> /dev/null
  212. echo " [=] Creating list of SERVICES from $OUTPUT/parsed_$IP.list, saving to $OUTPUT/services_$IP.list"
  213. cat $OUTPUT/parsed_$IP.list | cut -d "/" -f5 | tee $OUTPUT/services_$IP.list &> /dev/null
  214.  
  215. while read PORT <&3 && read SERVICE <&4; do
  216.  
  217. if [ "$SERVICE" == "" ] || [ "$SERVICE" == "unknown" ]; then
  218. echo -e "${YELLOW}"
  219. echo -e "[x]${NC} Found an unknown service on $IP:$PORT"
  220. echo " [>] Try using CURL or AMAP to see what it might be"
  221. echo " [=] curl $IP:$PORT"
  222. echo " [=] amap -d $IP $PORT"
  223.  
  224. elif [ "$SERVICE" == "ftp" ] || [ "$SERVICE" == "tftp" ]; then
  225. echo "[*] Found FTP service on $IP:$PORT"
  226. echo " [>] Now performing enumeration with NMAP and HYDRA"
  227. echo " [=] nmap -n -Pn -sV $IP -p $PORT --script=ftp-anon,ftp-bounce,ftp-libopie,ftp-proftpd-backdoor,ftp-vsftpd-backdoor,ftp-vuln-cve2010-4221 -oN $OUTPUT/ftp_$IP-$PORT.nmap"
  228. echo " [=] hydra -L /usr/share/metasploit-framework/data/wordlists/unix_users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt -f -o $OUTPUT/ftphydra_$IP-$PORT -u $IP -s $PORT ftp"
  229. {
  230. nohup nmap -n -Pn -sV $IP -p $PORT --script=ftp-anon,ftp-bounce,ftp-libopie,ftp-proftpd-backdoor,ftp-vsftpd-backdoor,ftp-vuln-cve2010-4221 -oN $OUTPUT/ftp_$IP-$PORT.nmap &
  231. nohup hydra -L /usr/share/metasploit-framework/data/wordlists/unix_users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt -f -o $OUTPUT/ftphydra_$IP-$PORT -u $IP -s $PORT ftp &
  232. } &> /dev/null
  233.  
  234. #Make output files for SSH MEDUSA AND HYDRA
  235. elif [ "$SERVICE" == "ssh" ]; then
  236. echo "[*] Found SSH service on $IP:$PORT"
  237. echo " [>] Now performing enumeration with MEDUSA and HYDRA"
  238. echo " [=] medusa -u root -P /usr/share/wordlists/rockyou.txt -e ns -h $IP - $PORT -M ssh -f"
  239. echo " [=] medusa -U /usr/share/metasploit-framework/data/wordlists/unix_users.txt -P/usr/share/metasploit-framework/data/wordlists/unix_passwords.txt -e ns -h $IP - $PORT -M ssh -f"
  240. echo " [=] hydra -f -V -t 1 -l root -P /usr/share/wordlists/rockyou.txt -s $PORT $IP ssh"
  241.  
  242. elif [ "$SERVICE" == "smtp" ]; then
  243. echo "[*] Found SMTP service on $IP:$PORT"
  244. echo " [>] Now performing enumeration with NMAP and SMTP-USER-ENUM"
  245. echo " [=] nmap -n -Pn -sV $IP -p $PORT --script=smtp* -oN $OUTPUT/smtp_$IP-$PORT.nmap"
  246. echo " [=] smtp-user-enum -M VRFY -U /usr/share/metasploit-framework/data/wordlists/unix_users.txt -t $IP -p $PORT | tee $OUTPUT/smtp_enum_$IP-$PORT"
  247. {
  248. nohup nmap -n -Pn -sV $IP -p $PORT --script=smtp* -oN $OUTPUT/smtp_$IP-$PORT.nmap &
  249. nohup smtp-user-enum -M VRFY -U /usr/share/metasploit-framework/data/wordlists/unix_users.txt -t $IP -p $PORT | tee $OUTPUT/smtp_enum_$IP-$PORT &
  250. } &> /dev/null
  251.  
  252. elif [ "$SERVICE" == "snmp" ]; then
  253. echo "[*] Found SNMP service on $IP:$PORT"
  254. echo " [>] Now performing enumeration with NMAP, ONESIXTYONE, and SNMPWALK"
  255. echo " [=] nmap -n -Pn -sV $IP -p $IP --script=snmp-netstat,snmp-processes -oN $OUTPUT/$IP:$PORT_snmp.nmap"
  256. echo " [=] onesixtyone -c public $IP | tee $OUTPUT/161_$IP-$PORT"
  257. echo " [=] snmpwalk -c public -v1 $IP | tee $OUTPUT/snmpwalk_$IP-$PORT"
  258. echo " [=] snmpwalk -c public -v1 $IP 1.3.6.1.4.1.77.1.2.25 | tee $OUTPUT/snmp_users_$IP-$PORT"
  259. echo " [=] snmpwalk -c public -v1 $IP 1.3.6.1.2.1.6.13.1.3 | tee $OUTPUT/snmp_ports_$IP-$PORT"
  260. echo " [=] snmpwalk -c public -v1 $IP 1.3.6.1.2.1.25.4.2.1.2 | tee $OUTPUT/snmp_process_$IP-$PORT"
  261. echo " [=] snmpwalk -c public -v1 $IP 1.3.6.1.2.1.25.6.3.1.2 | tee $OUTPUT/snmp_software_$IP-$PORT"
  262. {
  263. nohup nmap -n -Pn -sV $IP -p $IP --script=snmp-netstat,snmp-processes -oN $OUTPUT/$IP:$PORT_snmp.nmap &
  264. nohup onesixtyone -c public $IP | tee $OUTPUT/161_$IP-$PORT &
  265. nohup snmpwalk -c public -v1 $IP | tee $OUTPUT/snmpwalk_$IP-$PORT &
  266. nohup snmpwalk -c public -v1 $IP 1.3.6.1.4.1.77.1.2.25 | tee $OUTPUT/snmp_users_$IP-$PORT &
  267. nohup snmpwalk -c public -v1 $IP 1.3.6.1.2.1.6.13.1.3 | tee $OUTPUT/snmp_ports_$IP-$PORT &
  268. nohup snmpwalk -c public -v1 $IP 1.3.6.1.2.1.25.4.2.1.2 | tee $OUTPUT/snmp_process_$IP-$PORT &
  269. nohup snmpwalk -c public -v1 $IP 1.3.6.1.2.1.25.6.3.1.2 | tee $OUTPUT/snmp_software_$IP-$PORT &
  270. } &> /dev/null/
  271.  
  272. elif [ "$SERVICE" == "http" ]; then
  273. echo "[*] Found HTTP service on $IP:$PORT"
  274. echo " [>] Now performing enumeration with NMAP, NIKTO, and GOBUSTER"
  275. echo " [=] nmap -n -Pn -sV $IP -p $PORT --script=http-enum,http-userdir-enum,http-apache-negotiation,http-backup-finder,http-config-backup,http-default-accounts,http-methods,http-method-tamper,http-passwd,http-robots.txt,http-iis-webdav-vuln,http-vuln-cve2009-3960,http-vuln-cve2010-0738,http-vuln-cve2011-3368,http-vuln-cve2012-1823,http-vuln-cve2013-0156,http-waf-detect,http-waf-fingerprint,ssl-enum-ciphers,ssl-known-key -oN $OUTPUT/http_$IP-$PORT.nmap"
  276. echo " [=] nikto -h $IP -p $PORT | tee $OUTPUT/nikto_$IP-$PORT"
  277. echo " [=] gobuster -u http://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/Top1000-RobotsDisallowed.txt | tee $OUTPUT/gobuster_top1000_$IP-$PORT"
  278. echo " [=] gobuster -u http://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/common.txt | tee $OUTPUT/gobuster_common_$IP-$PORT"
  279. {
  280. nohup nmap -n -Pn -sV $IP -p $PORT --script=http-enum,http-userdir-enum,http-apache-negotiation,http-backup-finder,http-config-backup,http-default-accounts,http-methods,http-method-tamper,http-passwd,http-robots.txt,http-iis-webdav-vuln,http-vuln-cve2009-3960,http-vuln-cve2010-0738,http-vuln-cve2011-3368,http-vuln-cve2012-1823,http-vuln-cve2013-0156,http-waf-detect,http-waf-fingerprint,ssl-enum-ciphers,ssl-known-key -oN $OUTPUT/http_$IP-$PORT.nmap &
  281. nohup nikto -h $IP -p $PORT | tee $OUTPUT/nikto_$IP-$PORT &
  282. nohup gobuster -u http://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/Top1000-RobotsDisallowed.txt | tee $OUTPUT/gobuster_top1000_$IP-$PORT &
  283. nohup gobuster -u http://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/common.txt | tee $OUTPUT/gobuster_common_$IP-$PORT &
  284. } &> /dev/null
  285.  
  286. elif [ "$SERVICE" == "ssl/http" ] || [ "$SERVICE" == "https" ] || [ "$SERVICE" == "ssl|http" ]; then
  287. echo "[*] Found HTTPS service on $IP:$PORT"
  288. echo " [>] Now performing enumeration with NMAP, NIKTO, and GOBUSTER"
  289. echo " [=] nmap -n -Pn -sV $IP -p $PORT --script=ssl-heartbleed,http-enum,http-userdir-enum,http-apache-negotiation,http-backup-finder,http-config-backup,http-default-accounts,http-methods,http-method-tamper,http-passwd,http-robots.txt,http-iis-webdav-vuln,http-vuln-cve2009-3960,http-vuln-cve2010-0738,http-vuln-cve2011-3368,http-vuln-cve2012-1823,http-vuln-cve2013-0156,http-waf-detect,http-waf-fingerprint,ssl-enum-ciphers,ssl-known-key -oN $OUTPUT/https_$IP-$PORT.nmap"
  290. echo " [=] nikto -h $IP -p $PORT | tee $OUTPUT/nikto_$IP-$PORT"
  291. echo " [=] gobuster -u https://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/Top1000-RobotsDisallowed.txt | tee $OUTPUT/gobuster_top1000_$IP-$PORT"
  292. echo " [=] gobuster -u https://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/common.txt | tee $OUTPUT/gobuster_common_$IP-$PORT"
  293. {
  294. nohup nmap -n -Pn -sV $IP -p $PORT --script=ssl-heartbleed,http-enum,http-userdir-enum,http-apache-negotiation,http-backup-finder,http-config-backup,http-default-accounts,http-methods,http-method-tamper,http-passwd,http-robots.txt,http-iis-webdav-vuln,http-vuln-cve2009-3960,http-vuln-cve2010-0738,http-vuln-cve2011-3368,http-vuln-cve2012-1823,http-vuln-cve2013-0156,http-waf-detect,http-waf-fingerprint,ssl-enum-ciphers,ssl-known-key -oN $OUTPUT/https_$IP-$PORT.nmap &
  295. nikto -h $IP -p $PORT | tee $OUTPUT/nikto_$IP-$PORT
  296. gobuster -u https://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/Top1000-RobotsDisallowed.txt | tee $OUTPUT/gobuster_top1000_$IP-$PORT &
  297. gobuster -u https://$IP:$PORT/ -w /usr/share/seclists/Discovery/Web_Content/common.txt | tee $OUTPUT/gobuster_common_$IP-$PORT &
  298. } &> /dev/null
  299.  
  300. elif [ "$SERVICE" == "microsoft-ds" ] || [ "$SERVICE" == "netbios-ssn" ]; then
  301. echo "[*] Found SMB service on $IP:$PORT"
  302. echo " [>] Now performing enumeration with NMAP, ENUM4LINUX, and SMBCLIENT"
  303. echo " [=] nmap -n -Pn -sV $IP -pT:139,$PORT,U:137 --script=nbstat,smb-enum-domains,smb-enum-groups,smb-enum-processes,smb-enum-sessions,smb-ls,smb-mbenum,smb-os-discovery,smb-print-text,smb-security-mode,smb-server-stats,smb-system-info,smb-vuln-conficker,smb-vuln-ms06-025,smb-vuln-ms07-029,smb-vuln-ms08-067,smb-vuln-ms10-054,smb-vuln-ms10-061 -oN $OUTPUT/smb_$IP-$PORT.nmap"
  304. echo " [=] enum4linux $IP | tee $OUTPUT/enum4linux_$IP-$PORT"
  305. echo " [=] smbclient -L\\ -N -I $IP | tee $OUTPUT/smbclient_$IP-$PORT"
  306. {
  307. nohup nmap -n -Pn -sV $IP -pT:139,$PORT,U:137 --script=nbstat,smb-enum-domains,smb-enum-groups,smb-enum-processes,smb-enum-sessions,smb-ls,smb-mbenum,smb-os-discovery,smb-print-text,smb-security-mode,smb-server-stats,smb-system-info,smb-vuln-conficker,smb-vuln-ms06-025,smb-vuln-ms07-029,smb-vuln-ms08-067,smb-vuln-ms10-054,smb-vuln-ms10-061 -oN $OUTPUT/smb_$IP-$PORT.nmap &
  308. nohup enum4linux $IP | tee $OUTPUT/enum4linux_$IP-$PORT &
  309. nohup smbclient -L\\ -N -I $IP | tee $OUTPUT/smbclient_$IP-$PORT &
  310. } &> /dev/null
  311.  
  312. elif [ "$SERVICE" == "msdrdp" ] || [ "$SERVICE" == "ms-wbt-server" ]; then
  313. echo "[*] Found RDP service on $IP:$PORT"
  314. echo " [>] Consider using a password attack on the target"
  315. echo " [=] ncrack -vv --user Administrator -P /usr/share/wordlists/rockyou.txt rdp://$IP\n"
  316.  
  317. elif [ "$SERVICE" == "mysql" ]; then
  318. echo "[*] Found MYSQL service on $IP:$PORT"
  319. echo " [>] Now performing enumeration with NMAP"
  320. echo " [=] nmap -n -Pn -sV $IP -p $PORT --script=mysql-audit,mysql-brute,mysql-databases,mysql-dump-hashes,mysql-empty-password,mysql-enum,mysql-info,mysql-query,mysql-users,mysql-variables,mysql-vuln-cve2012-2122 -oN $OUTPUT/mysql_$IP-$PORT.nmap"
  321. {
  322. nohup nmap -n -Pn -sV $IP -p $PORT --script=mysql-audit,mysql-brute,mysql-databases,mysql-dump-hashes,mysql-empty-password,mysql-enum,mysql-info,mysql-query,mysql-users,mysql-variables,mysql-vuln-cve2012-2122 -oN $OUTPUT/mysql_$IP-$PORT.nmap &
  323. } &> /dev/null
  324.  
  325. elif [ "$SERVICE" == "ms-sql" ]; then
  326. echo "[*] Found MSSQL service on $IP:$PORT"
  327. echo " [>] Now performing enumeration with NMAP"
  328. echo " [=] nmap -n -Pn -sV $IP -p $PORT --script=ms-sql-info,ms-sql-config,ms-sql-dump-hashes --script-args=mssql.instance-port=$PORT,smsql.username-sa,mssql.password-sa -oN $OUTPUT/mssql_$IP-$PORT.nmap"
  329. echo " [=] nmap -n -Pn $IP -p $PORT --script ms-sql-xp-cmdshell --script-args mssql.username=sa,mssql.password=password,mssql.instance-port=$PORT,ms-sql-xp-cmdshell.cmd='ipconfig' -oN $OUTPUT/mssql_cmdshell_$IP-$PORT.nmap"
  330. {
  331. nohup nmap -n -Pn -sV $IP -p $PORT --script=ms-sql-info,ms-sql-config,ms-sql-dump-hashes --script-args=mssql.instance-port=$PORT,smsql.username-sa,mssql.password-sa -oN $OUTPUT/mssql_$IP-$PORT.nmap &
  332. nohup nmap -n -Pn $IP -p $PORT --script ms-sql-xp-cmdshell --script-args mssql.username=sa,mssql.password=password,mssql.instance-port=$PORT,ms-sql-xp-cmdshell.cmd='ipconfig' -oN $OUTPUT/mssql_cmdshell_$IP-$PORT.nmap &
  333. } &> /dev/null
  334. else
  335. echo -e "${RED}"
  336. echo -e "[x]${NC} Found $SERVICE service on $IP:$PORT"
  337. echo " [>] Could not enumerate, look into it further"
  338. fi
  339.  
  340. done 3<$OUTPUT/ports_$IP.list 4<$OUTPUT/services_$IP.list
  341.  
  342. echo "[*] Waiting for everything to finish"
  343. wait
  344. echo " [>] Okay, everything is now finished!"
  345. echo " [=] Files can be found at $OUTPUT"
  346. echo " [=] The following files were created:"
  347.  
  348. # Goes to output folder, finds all the files, for each path found, reverse it to cut the end, then reverse back. Realpath is used on each individual item
  349. echo -e "${BLUE}"
  350. echo "$(realpath $(find $OUTPUT -type f | rev | cut -d "/" -f1 | rev))"
  351. echo -e "${NC}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement