
Nmap, short for "Network Mapper," is a powerful open-source tool used for network discovery and security auditing. It's one of the most popular and widely used network scanning tools in the cybersecurity community. Nmap allows users to discover hosts, services, and open ports on computer networks, thus aiding in vulnerability assessment and penetration testing.
Basic Scans
sudo nmap -sS 10.1.1.1 #TCP SYN scansudo nmap -sT 10.1.1.1 #TCP Connect scansudo nmap -sA 10.1.1.1 #TCP ACK scansudo nmap -sW 10.1.1.1 #TCP Window scansudo nmap -sM 10.1.1.1 #TCP Maimon scansudo nmap -sU 10.1.1.1 #UDP scansudo nmap -sN 10.1.1.1 #TCP Null scansudo nmap -sF 10.1.1.1 #TCP FIN scansudo nmap -sX 10.1.1.1 #TCP Xmas scansudo nmap -sY 10.1.1.1 #SCTP INIT scansudo nmap -sZ 10.1.1.1 #SCTP COOKIE ECHO scansudo nmap -sn 10.1.1.1 #Ping scan (no port scan)sudo nmap -sL 10.1.1.1 #List scansudo nmap -sO 10.1.1.1 #IP Protocol scanAdvanced Scanning
sudo nmap -sV 10.1.1.1 #Version detectionsudo nmap -A 10.1.1.1 #OS detection, version detection, script scanning, and traceroutesudo nmap -O 10.1.1.1 #OS detectionsudo nmap --osscan-guess 10.1.1.1 #Guess OS detection resultssudo nmap --osscan-limit 10.1.1.1 #Limit OS detection to promising targetsScanning Specific Hosts
sudo nmap 10.1.1.1 #Scan a single IPsudo nmap 10.1.1.1 10.1.1.2 #Scan specific IPssudo nmap -iL inputfile.txt #Input from list of hosts/networkssudo nmap -iR 100 #Scan 100 random hostssudo nmap --exclude 10.1.1.1 #Exclude specified hostssudo nmap --exclude-file exclude.txt #Exclude list from filesudo nmap hacker.com #Scan a domainsudo nmap 10.1.1.1-254 #Scan a rangesudo nmap 10.1.1.1/24 #Scan a CIDR rangeScript Scanning
sudo nmap -sC 10.1.1.1 #Default script scansudo nmap --script <script_name> 10.1.1.1 #Run specific scriptsudo nmap --script-args <n1=v1,[n2=v2,...]> 10.1.1.1 #Provide arguments to scriptssudo nmap --script-trace 10.1.1.1 #Show all data sent and receivedsudo nmap --script-updatedb #Update the script databaseTiming and Performance
sudo nmap -T0 10.1.1.1 #Paranoid (Serial, very slow, stealthy)sudo nmap -T1 10.1.1.1 #Sneaky (Slow, stealthy)sudo nmap -T2 10.1.1.1 #Polite (Slows down to use less bandwidth and target machine resources)sudo nmap -T3 10.1.1.1 #Normal (Default)sudo nmap -T4 10.1.1.1 #Aggressive (Speeds up scan; risks detection)sudo nmap -T5 10.1.1.1 #Insane (Very fast; likely to be detected)sudo nmap --min-hostgroup <size> 10.1.1.1 #Minimum number of hosts per groupsudo nmap --max-hostgroup <size> 10.1.1.1 #Maximum number of hosts per groupsudo nmap --min-parallelism <num> 10.1.1.1 #Minimum number of parallel operationssudo nmap --max-parallelism <num> 10.1.1.1 #Maximum number of parallel operationssudo nmap --min-rtt-timeout <time> 10.1.1.1 #Minimum RTT timeoutsudo nmap --max-rtt-timeout <time> 10.1.1.1 #Maximum RTT timeoutsudo nmap --initial-rtt-timeout <time> 10.1.1.1 #Initial RTT timeoutsudo nmap --max-retries <num> 10.1.1.1 #Maximum retriessudo nmap --host-timeout <time> 10.1.1.1 #Give up on target after this longsudo nmap --scan-delay <time> 10.1.1.1 #Wait at least this long between probessudo nmap --max-scan-delay <time> 10.1.1.1 #Wait at most this long between probessudo nmap --defeat-rst-ratelimit 10.1.1.1 #Slow down to avoid RST rate limitsudo nmap --min-rate <number> 10.1.1.1 #Send packets no slower than <number> per secondsudo nmap --max-rate <number> 10.1.1.1 #Send packets no faster than <number> per secondPort Specification and Scan Order
sudo nmap -p 80 10.1.1.1 #Scan specific portsudo nmap -p 1-65535 10.1.1.1 #Scan all portssudo nmap -p U:53,T:80 10.1.1.1 #Scan UDP port 53 and TCP port 80sudo nmap --top-ports 20 10.1.1.1 #Scan top 20 portssudo nmap --top-ports 1000 10.1.1.1 #Scan top 1000 portssudo nmap -F 10.1.1.1 #Fast scan (default 100 ports)sudo nmap --port-ratio <ratio> 10.1.1.1 #Scan top ports up to the given ratioOutput Options
sudo nmap -oN outputfile.txt 10.1.1.1 #Normal outputsudo nmap -oX outputfile.xml 10.1.1.1 #XML outputsudo nmap -oS outputfile.s 10.1.1.1 #Script kiddie outputsudo nmap -oG outputfile.gnmap 10.1.1.1 #Grepable outputsudo nmap -oA outputfile 10.1.1.1 #All formats (N, X, G)sudo nmap --append-output 10.1.1.1 #Append to output filessudo nmap --resume <filename> 10.1.1.1 #Resume aborted scanAdditional Options
sudo nmap -v 10.1.1.1 #Increase verbosity levelsudo nmap -vv 10.1.1.1 #Even more verbositysudo nmap -d 10.1.1.1 #Increase debugging levelsudo nmap -dd 10.1.1.1 #Even more debuggingsudo nmap --reason 10.1.1.1 #Show reason for host and port statesudo nmap --open 10.1.1.1 #Only show open portssudo nmap --packet-trace 10.1.1.1 #Show all packets sent and receivedsudo nmap --iflist #Show host interfaces and routessudo nmap --append-output #Append to output filessudo nmap --resume <filename> #Resume aborted scanHost Discovery
sudo nmap -PS80,443 10.1.1.1 #TCP SYN discovery on port 80 and 443sudo nmap -PA80,443 10.1.1.1 #TCP ACK discovery on port 80 and 443sudo nmap -PU53 10.1.1.1 #UDP discovery on port 53sudo nmap -PY 10.1.1.1 #SCTP INIT pingsudo nmap -PE 10.1.1.1 #ICMP Echo discoverysudo nmap -PP 10.1.1.1 #ICMP Timestamp discoverysudo nmap -PM 10.1.1.1 #ICMP Address Mask discoverysudo nmap -Pn 10.1.1.1 #No ping - skips the discovery stage altogethersudo nmap -n 10.1.1.0/24 #No DNS resolution on the active IP address it findssudo nmap -R 10.1.1.0/24 #Always do reverse DNS resolution on the target IPFirewall/IDS Evasion and Spoofing
sudo nmap -f 10.1.1.1 #Fragment packetssudo nmap -D RND:10 10.1.1.1 #Decoy scan with 10 random decoyssudo nmap -S 192.168.0.1 10.1.1.1 #Spoof source addresssudo nmap -g 53 10.1.1.1 #Use given source port numbersudo nmap --source-port 53 10.1.1.1 #Use given source port numbersudo nmap --data-length 50 10.1.1.1 #Append random data to sent packetssudo nmap --ip-options <options> 10.1.1.1 #Send packets with specified ip optionssudo nmap --ttl <value> 10.1.1.1 #Set IP time-to-live fieldsudo nmap --spoof-mac <mac address, prefix, or vendor name> 10.1.1.1 #Spoof MAC addressScanning Behind a Proxy
sudo nmap --proxies <url1,url2> 10.1.1.1 #Use proxies for scan



