Guest User

Untitled

a guest
Oct 23rd, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. #!/bin/bash
  2. #=================================================================
  3. # Speedy Nmap
  4. #=================================================================
  5. # Performs nmap scan in hyper speed.
  6. # Usage: ./speedy_nmap.sh <IP> <output file>
  7. #
  8. # Author: PotatoMaster101
  9. # Date: 22/10/2018
  10. # File: speedy_nmap.sh
  11. #=================================================================
  12.  
  13.  
  14. #-----------------------------------------------------------------
  15. # main
  16. #-----------------------------------------------------------------
  17. # Starts the scanning process.
  18. #
  19. # PARAMS:
  20. # $1 - the IP to scan
  21. # $2 - the output file name
  22. #-----------------------------------------------------------------
  23. function main {
  24. if [[ $# -ne 2 ]]; then
  25. echo "usage ./speedy_nmap.sh <IP> <output file>"
  26. return 1
  27. fi
  28. rm -f $2
  29.  
  30. # start scanning
  31. limit=4369
  32. for i in {1..15}; do
  33. lower=$((limit - 4368))
  34. echo "scanning $lower to $limit..."
  35. nmap_range $lower $limit $1 $2 &
  36. limit=$((limit + 4369))
  37. done
  38. wait
  39. echo "scan done"
  40. }
  41.  
  42.  
  43. #-----------------------------------------------------------------
  44. # nmap_range
  45. #-----------------------------------------------------------------
  46. # Scans the specified port range using nmap.
  47. #
  48. # PARAMS:
  49. # $1 - the lower bound
  50. # $2 - the upper bound
  51. # $3 - the IP to scan
  52. # $4 - the output file name
  53. #-----------------------------------------------------------------
  54. function nmap_range {
  55. nmap "-p$1-$2" -T5 -Pn -n -sS -sV $3 > $1
  56.  
  57. # write to file if output contains any open port
  58. grep -q All $1
  59. if [[ $? -ne 0 ]]; then
  60. cat $1 >> $4
  61. fi
  62. rm -f $1
  63. }
  64.  
  65.  
  66. main $@
  67. exit $?
Add Comment
Please, Sign In to add comment