Advertisement
joemccray

NetworkScanScript

Nov 1st, 2016
1,104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. # Oh boy, let's do some scanning, and sorting. Yes I know my coding sux, deal with it.
  5. # If you don't like it write your own
  6.  
  7.  
  8. Make the directories
  9. mkdir -p /tmp/customerAudit/internal/scan/services/
  10. mkdir -p /tmp/customerAudit/internal/scan/windows/
  11. mkdir -p /tmp/customerAudit/internal/scan/sunrpc/
  12. mkdir -p /tmp/customerAudit/internal/scan/telnet/
  13. mkdir -p /tmp/customerAudit/internal/scan/printers/
  14. mkdir -p /tmp/customerAudit/internal/scan/mssql_databases/
  15. mkdir -p /tmp/customerAudit/internal/scan/oracle_databases/
  16. mkdir -p /tmp/customerAudit/internal/scan/mysql_databases/
  17.  
  18. ######################
  19. # Find Windows Hosts #
  20. ######################
  21. echo "Scanning for windows hosts."
  22. WIN_COUNTER=0
  23. while [ $WIN_COUNTER -lt 254 ]; do
  24. propecia 10.6.$WIN_COUNTER 445 >> /tmp/customerAudit/internal/scan/services/windows_hosts
  25. let WIN_COUNTER=WIN_COUNTER+1
  26. done
  27. echo "Done scanning for windows hosts. FTP is next."
  28.  
  29.  
  30. ##################
  31. # Find FTP Hosts #
  32. ##################
  33. FTP_COUNTER=0
  34. while [ $FTP_COUNTER -lt 254 ]; do
  35. propecia 10.6.$FTP_COUNTER 21 >> /tmp/customerAudit/internal/scan/services/ftp_hosts
  36. let FTP_COUNTER=FTP_COUNTER+1
  37. done
  38. echo "Done scanning for FTP hosts. SunRPC is next."
  39.  
  40.  
  41. #####################
  42. # Find SunRPC Hosts #
  43. #####################
  44. SRPC_COUNTER=0
  45. while [ $SRPC_COUNTER -lt 254 ]; do
  46. propecia 10.6.$SRPC_COUNTER 111 >> /tmp/customerAudit/internal/scan/services/sunrpc_hosts
  47. let SRPC_COUNTER=SRPC_COUNTER+1
  48. done
  49.  
  50. echo "Done scanning for SunRPC hosts. Telnet is next."
  51.  
  52.  
  53. #####################
  54. # Find Telnet Hosts #
  55. #####################
  56. TEL_COUNTER=0
  57. while [ $TEL_COUNTER -lt 254 ]; do
  58. propecia 10.6.$TEL_COUNTER 23 >> /tmp/customerAudit/internal/scan/services/telnet_hosts
  59. let TEL_COUNTER=TEL_COUNTER+1
  60. done
  61. echo "Done scanning for Telnet hosts. Printers are next."
  62.  
  63.  
  64. #################
  65. # Find Printers #
  66. #################
  67. PTR_COUNTER=0
  68. while [ $PTR_COUNTER -lt 254 ]; do
  69. propecia 10.6.$PTR_COUNTER 9100 >> /tmp/customerAudit/internal/scan/services/printserver_hosts
  70. let PTR_COUNTER=PTR_COUNTER+1
  71. done
  72.  
  73. echo "Done scanning for Printers. Databases are next."
  74.  
  75.  
  76. ##################
  77. # Find Databases #
  78. ##################
  79. MSSQL_COUNTER=0
  80. while [ $MSSQL_COUNTER -lt 254 ]; do
  81. propecia 10.6.$MSSQL_COUNTER 1433 >> /tmp/customerAudit/internal/scan/services/mssql_hosts
  82. let MSSQL_COUNTER=MSSQL_COUNTER+1
  83. done
  84.  
  85. ORA_COUNTER=0
  86. while [ $ORA_COUNTER -lt 254 ]; do
  87. propecia 10.6.$ORA_COUNTER 1521 >> /tmp/customerAudit/internal/scan/services/oracle_hosts
  88. let ORA_COUNTER=ORA_COUNTER+1
  89. done
  90.  
  91.  
  92. MY_COUNTER=0
  93. while [ $MY_COUNTER -lt 254 ]; do
  94. propecia 10.6.$MY_COUNTER 3306 >> /tmp/customerAudit/internal/scan/services/mysql_hosts
  95. let MY_COUNTER=MY_COUNTER+1
  96. done
  97. echo "Done doing the host discovery. Moving on to nmap'ing each host discovered. Windows hosts are first."
  98.  
  99.  
  100. ###############################
  101. # Ok, let's do the NMAP files #
  102. ###############################
  103.  
  104. # Windows
  105. for x in `cat /tmp/customerAudit/internal/scan/services/windows_hosts` ; do nmap -sV -O $x > /tmp/customerAudit/internal/scan/windows/$x ; done
  106. echo "Done with Windows."
  107. # FTP
  108. for x in `cat /tmp/customerAudit/internal/scan/services/ftp_hosts` ; do nmap -sV -O $x > /tmp/customerAudit/internal/scan/ftp/$x ; done
  109. echo "Done with FTP."
  110. # SUNRPC
  111. for x in `cat /tmp/customerAudit/internal/scan/services/sunrpc_hosts` ; do nmap -sV -O $x > /tmp/customerAudit/internal/scan/sunrpc/$x ; done
  112. echo "Done with SunRPC."
  113. # Telnet
  114. for x in `cat /tmp/customerAudit/internal/scan/services/telnet_hosts` ; do nmap -sV -O $x > /tmp/customerAudit/internal/scan/telnet/$x ; done
  115. echo "Done with Telnet."
  116. # Printers
  117. for x in `cat /tmp/customerAudit/internal/scan/services/printserver_hosts` ; do nmap -sV -O $x > /tmp/customerAudit/internal/scan/printers/$x ; done
  118. echo "Done with printers."
  119. # SQL Servers
  120. for x in `cat /tmp/customerAudit/internal/scan/services/mssql_hosts` ; do nmap -sV -O $x > /tmp/customerAudit/internal/scan/mssql_databases/$x ; done
  121. echo "Done with MS SQL."
  122. # Oracle Servers
  123. for x in `cat /tmp/customerAudit/internal/scan/services/oracle_hosts` ; do nmap -sV -O $x >> /tmp/customerAudit/internal/scan/oracle_databases/$x ; done
  124. echo "Done with Oracle."
  125. # MySQL Servers
  126. for x in `cat /tmp/customerAudit/internal/scan/services/mysql_hosts` ; do nmap -sV -O $x >> /tmp/customerAudit/internal/scan/mysql_databases/$x ; done
  127. echo "Done with MySQL."
  128. echo " "
  129. echo " "
  130. echo "Done, now check your results."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement