Advertisement
joemccray

Quick Scan Script

Feb 8th, 2017
1,200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Check to see if the script is running as root
  4. if [ "$EUID" -ne 0 ]
  5. then echo "Please run as root"
  6. exit
  7. fi
  8.  
  9. # Deleting the targets file if it is present
  10. rm -rf targets*.txt
  11.  
  12.  
  13. # Finding hosts via common ports
  14. propecia 10.0.0 21 >> targets001.txt
  15. propecia 10.0.0 22 >> targets001.txt
  16. propecia 10.0.0 25 >> targets001.txt
  17. propecia 10.0.0 80 >> targets001.txt
  18. propecia 10.0.0 110 >> targets001.txt
  19. propecia 10.0.0 135 >> targets001.txt
  20. propecia 10.0.0 139 >> targets001.txt
  21. propecia 10.0.0 443 >> targets001.txt
  22. propecia 10.0.0 111 >> targets001.txt
  23. propecia 10.0.0 1433 >> targets001.txt
  24. propecia 10.0.0 1521 >> targets001.txt
  25. propecia 10.0.0 3306 >> targets001.txt
  26. propecia 10.0.0 5432 >> targets001.txt
  27. propecia 10.0.0 3389 >> targets001.txt
  28.  
  29. # Removing the duplicates
  30. cat targets001.txt | sort -u >> targets002.txt
  31.  
  32.  
  33. # Checking for the presence of the scans folder and creating it if it doesn't exist
  34. if [ -d "/home/infosecaddicts/scans" ]
  35. then
  36. cd /home/infosecaddicts/scans
  37. cp ../targets002.txt .
  38. else
  39. mkdir /home/infosecaddicts/scans
  40. cd /home/infosecaddicts/scans
  41. cp /home/infosecaddicts/targets002.txt .
  42. fi
  43.  
  44.  
  45. # Doing the nmap scanning of each hosts in the network
  46. for i in $(cat targets002.txt); do nmap -sV -Pn -T 5 -A -O -p 21,22,23,25,80,110,135,139,443,1433,1521,3306,3389,5432,10000,27108 $i >> $i ; done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement