Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. #NMAP Guide
  2. -----------
  3.  
  4. 1) Basic scan to see what ports have a valid service running on them:
  5.  
  6. nmap {host}
  7. nmap -v {host}
  8.  
  9. Pass the `-v` flag to print a little more information.
  10.  
  11. 2) Basic scan to just see what ports are open/closed/filtered, but will not actually test the port for a service running:
  12.  
  13. nmap --top-ports {number of ports} {host}
  14.  
  15. 3) Scanning a range of IP addresses or a subnet:
  16.  
  17. nmap {host} 192.168.1.2 192.168.1.3
  18. nmap {host},2,3 # multiple
  19. nmap {host}-20 # range
  20.  
  21. nmap 192.168.1.* # range
  22. nmap 192.168.1.0/24 # subnet
  23.  
  24. 4) Scanning and reading from a list of hosts
  25.  
  26. input.txt
  27. ----------------------------------------
  28. host1.com
  29. host2.com
  30. {host}
  31.  
  32. nmap -iL input.txt
  33.  
  34. 5) Exclusions:
  35.  
  36. nmap 192.168.1.0/24 --exclude 192.168.1.5
  37. nmap 192.168.1.0/24 --exclude 192.168.1.5,192.168.1.254
  38.  
  39. OR exclude list from a file called exclude.txt
  40.  
  41. nmap -iL /tmp/scanlist.txt --excludefile exclude.txt
  42.  
  43. 6) OS Detection of services:
  44.  
  45. nmap -A -v {host}
  46.  
  47. 7) Firewall protection of the host:
  48.  
  49. nmap -sA -v {host}
  50.  
  51. 8) Scanning a host protected by a firewall (very useful):
  52.  
  53. nmap -PN -v {host}
  54.  
  55. 9) Scanning a IPv6 host:
  56.  
  57. nmap -6 IPv6-Address-Here
  58. nmap -6 2607:f0d0:1002:51::4
  59. nmap -v A -6 2607:f0d0:1002:51::4
  60.  
  61. 10) Scan a network and find out which servers and devices are up and running
  62.  
  63. nmap -sP 192.168.1.0/24
  64.  
  65. 11) Scanning a host quickly:
  66.  
  67. nmap -F {host}
  68.  
  69. ONLY show open ports
  70.  
  71. nmap -F --open {host}
  72.  
  73. 12) Print packet trace on a scan:
  74.  
  75. nmap --packet-trace {host}
  76.  
  77. 13) Doing a full nmap scan of the host requires root privelages. To invoke run this:
  78.  
  79. sudo nmap -v -sV -sC -O {host}
  80.  
  81. This will generate a full report of services and attempt to identify OS. Good for finding admin panels and such running on hidden ports.
  82.  
  83. 14) Show host interfaces and routes:
  84.  
  85. nmap --iflist {host}
  86.  
  87. 15) Scanning specific ports:
  88.  
  89. nmap -p 80 {host}
  90.  
  91. # Scan TCP port 80
  92. nmap -p T:80 {host}
  93.  
  94. # Scan UDP port 53
  95. nmap -p U:53 {host}
  96.  
  97. # Scan two ports
  98. nmap -p 80,443 {host}
  99.  
  100. # Scan port range
  101. nmap -p 80-200 {host}
  102.  
  103. # Combination port scan
  104. nmap -p U:53,111,137,T:21-25,80,139,8080 {host}
  105. nmap -v -sU -sT -p U:53,111,137,T:21-25,80,139,8080 {host}
  106.  
  107. # Scan all ports with * wildcard
  108. nmap -p "*" {host}
  109.  
  110. # Scan top ports
  111. nmap --top-ports {number of ports} {host}
  112. nmap --top-ports {number of ports} {host}
  113.  
  114. 16) Scanning for a remote operating system:
  115.  
  116. nmap -O -v {host}
  117.  
  118. 17) Scanning for remote services (server/daemon):
  119.  
  120. nmap -sV -v {host}
  121.  
  122. 18) Scanning a host using TCP ACK (PA) and TCP Syn (PS) ping. Use this when a firewall is blocking standard ICMP pings:
  123.  
  124. nmap -PS {host}
  125.  
  126. 19) Scanning a host using IP protocol ping:
  127.  
  128. nmap -PO {host}
  129.  
  130. 20) Scanning a host using UDP ping. This scan bypasses firewalls and filters that only screen TCP:
  131.  
  132. nmap -PU {host}
  133.  
  134. 21) Scanning a host for the most commonly used TCP ports using TCP SYN Scan:
  135.  
  136. # Stealth scan
  137. nmap -sS {host}
  138.  
  139. # Find the most commonly used TCP ports using TCP connect scan (warning: no stealth scan)
  140. nmap -sT {host}
  141.  
  142. # Find the most commonly used TCP ports using TCP ACK scan
  143. nmap -sA {host}
  144.  
  145. # Find the most commonly used TCP ports using TCP Window scan
  146. nmap -sW {host}
  147.  
  148. # Find the most commonly used TCP ports using TCP Maimon scan
  149. nmap -sM {host}
  150.  
  151. 22) Scanning a host for UDP services (UDP scan):
  152.  
  153. nmap -sU {host}
  154.  
  155. 23) Scanning a host for IP protocol, this allows you to determine which IP protocols are supported by the host:
  156.  
  157. nmap -sO {host}
  158.  
  159. 24) Scanning a firewall for security weaknesses:
  160.  
  161. # TCP Null Scan to trigger firewall to generate a response
  162. nmap -sN {host}
  163.  
  164. # TCP Fin scan to check firewall
  165. nmap -sF {host}
  166.  
  167. # TCP Xmas scan to check firewall
  168. nmap -sX {host}
  169.  
  170. 25) Cloaking a scan with decoys
  171.  
  172. nmap -n -Ddecoy-ip1,decoy-ip2,your-own-ip,decoy-ip3,decoy-ip4 {host}
  173.  
  174. 26) Scanning a firewall for MAC address spoofing:
  175.  
  176. ### Spoof your MAC address ##
  177. nmap --spoof-mac {your-mac-address} {host}
  178.  
  179. You can pass any other flags here as well `-v -O` etc…
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement