nmap quick cheatsheet
Checking and storing active devices in a range and store in a file "tnet"
Scanning a list of hosts
Show all packets sent and received by --packet-trace -PE : Performs the ping scan by using 'ICMP Echo requests' against the target.
Display reason for a specific result --reason
We see here that
Nmap
does indeed detect whether the host is alive or not through theARP request
andARP reply
alone. To disable ARP requests and scan our target with the desiredICMP echo requests
, we can disable ARP pings by setting the "--disable-arp-ping
" option. Then we can scan our target again and look at the packets sent and received.We can check TTL when we do a --disable-arp-ping and based on TTL know which OS it is. 128 - windows 64 - Linux/Mac 255 - network devices
To scan the "x" number of top ports (--top-ports=<number>)
-n: disables DNS resolution. Since DNS can be slow even with Nmap's built-in parallel stub resolver, this option reduces scanning times.
TCP Connect scan - The
Connect
scan (also known as a full TCP connect scan) is highly accurate because it completes the three-way TCP handshake, allowing us to determine the exact state of a port (open, closed, or filtered). However, it is not the most stealthy. In fact, the Connect scan is one of the least stealthy techniques, as it fully establishes a connection, which creates logs on most systems and is easily detected by modern IDS/IPS solutions. Eg:Connect Scan on TCP Port 443
Version scan = -sV
Script scan = -sC
Aggressive scan = -A
Nmap XML to GUI HTML report nmap <IP> -oA target xsltproc target.xml -o target.html
Firewall bypass - Decoy scan! -D RND:5
Firewall bypass
HTB Academy hard lab
Firewall and IDS/IPS Evasion - Hard Lab
Now our client wants to know if it is possible to find out the version of the running services on unknown port behind Firewall IDS/IPS. Identify the version of service our client was talking about and submit the flag as the answer.
Firewall and IDS/IPS Evasion - Hard Lab
Scanning Options and Description
10.129.2.28 Scans the specified target.
-p 21,22,25 Scans only the specified ports.
-sS Performs SYN scan on specified ports.
-sA Performs ACK scan on specified ports.
-Pn Disables ICMP Echo requests.
-n Disables DNS resolution.
--disable-arp-ping Disables ARP ping.
--packet-trace Shows all packets sent and received.
Scan by Using Decoys
Connect To The Filtered Port
50000
discovered, from a different source port of53
to evade detection.
Additional techniques by targeting Firewall and IDS/IPS Evasion
Testing Firewall Rule
Scan by Using Different Source IP
SYN-Scan From DNS Port
Medium lab
nmap -Pn -T4 -A -v -sV 10.129.57.157 -p 53 -D RND:5 --stats-every=5s
Last updated
Was this helpful?