Scanning
Nmap
Scan types
Three basic scan types :
TCP Connect Scans -->
-sT
--> [SYN] [SYN/ACK] [ACK]SYN "Half-open" Scans -->
-sS
--> [SYN] [SYN/ACK] [RST]UDP Scans --> (
-sU
) --> there should be no responsenmap -sU --top-ports 20 <target>
because very longopen | filtered
response = no response so the port is open or firewalledopen
= theres is a response, it's unusual, the port is openclose
= target respond with an ICMP (ping) packet containing a message that the port is unreachable
Less common port scan types (sometimes usefull for firewall evasion) :
TCP Null Scans (
-sN
) --> TCP request is sent with no flags, target should respond with [RST] if the port is closedTCP FIN Scans (
-sF
) --> TCP request is sent with the FIN flag (usually used to close an active connection). Nmap expects a [RST] if the port is closed.TCP Xmas Scans (
-sX
) --> send a malformed TCP packet with flags PSH, URG and FIN and expects a [RST] response for closed ports.
Ping sweep (usefull in a black box network pentest) :
nmap -sn 192.168.0.0/24
-->-sn
switch tells Nmap to rely purely on ICMP packets (or ARP requests on a local network) to identify targets.
Scripting engine
safe
: Won't affect the targetintrusive
: Not safe: likely to affect the targetvuln
: Scan for vulnerabilitiesexploit
: Attempt to exploit a vulnerabilityauth
: Attempt to bypass authentication for running services (e.g. Log into an FTP server anonymously)brute
: Attempt to bruteforce credentials for running servicesdiscovery
: Attempt to query running services for further information about the network (e.g. query an SNMP server).
Script arguments
Searching for scripts
Firewall evasion
Windows default firewall block all ICMP packets. Fortunately Nmap provides an option for this: -Pn
, which tells Nmap to not bother pinging the host before scanning it.
If you're already directly on the local network, Nmap can also use ARP requests to determine host activity.
The following switches are of particular note:
Last updated
Was this helpful?