Showing posts with label Nmap. Show all posts
Showing posts with label Nmap. Show all posts

Nmap Cheat Sheet

Nmap Cheat Sheet


Basic Scanning Techniques
Scan a single target —> nmap [target]
Scan multiple targets —> nmap [target1,target2,etc]
Scan a list of targets —-> nmap -iL [list.txt]
Scan a range of hosts —-> nmap [range of IP addresses]
Scan an entire subnet —-> nmap [IP address/cdir]
Scan random hosts —-> nmap -iR [number]
Excluding targets from a scan —> nmap [targets] –exclude [targets]
Excluding targets using a list —> nmap [targets] –excludefile [list.txt]
Perform an aggressive scan —> nmap -A [target]
Scan an IPv6 target —> nmap -6 [target]

Discovery Options
Perform a ping scan only —> nmap -sP [target]
Don’t ping —> nmap -PN [target]
TCP SYN Ping —> nmap -PS [target]
TCP ACK ping —-> nmap -PA [target]
UDP ping —-> nmap -PU [target]
SCTP Init Ping —> nmap -PY [target]
ICMP echo ping —-> nmap -PE [target]
ICMP Timestamp ping —> nmap -PP [target]
ICMP address mask ping —> nmap -PM [target]
IP protocol ping —-> nmap -PO [target]
ARP ping —> nmap -PR [target]
Traceroute —> nmap –traceroute [target]
Force reverse DNS resolution —> nmap -R [target]
Disable reverse DNS resolution —> nmap -n [target]
Alternative DNS lookup —> nmap –system-dns [target]
Manually specify DNS servers —> nmap –dns-servers [servers] [target]
Create a host list —-> nmap -sL [targets]

Advanced Scanning Options
TCP SYN Scan —> nmap -sS [target]
TCP connect scan —-> nmap -sT [target]
UDP scan —-> nmap -sU [target]
TCP Null scan —-> nmap -sN [target]
TCP Fin scan —> nmap -sF [target]
Xmas scan —-> nmap -sX [target]
TCP ACK scan —> nmap -sA [target]
Custom TCP scan —-> nmap –scanflags [flags] [target]
IP protocol scan —-> nmap -sO [target]
Send Raw Ethernet packets —-> nmap –send-eth [target]
Send IP packets —-> nmap –send-ip [target]

Port Scanning Options
Perform a fast scan —> nmap -F [target]
Scan specific ports —-> nmap -p [ports] [target]
Scan ports by name —-> nmap -p [port name] [target]
Scan ports by protocol —-> nmap -sU -sT -p U:[ports],T:[ports] [target]
Scan all ports —-> nmap -p “*” [target]
Scan top ports —–> nmap –top-ports [number] [target]
Perform a sequential port scan —-> nmap -r [target]

Version Detection
Operating system detection —-> nmap -O [target]
Submit TCP/IP Fingerprints —-> http://www.nmap.org/submit/
Attempt to guess an unknown —-> nmap -O –osscan-guess [target]
Service version detection —-> nmap -sV [target]
Troubleshooting version scans —-> nmap -sV –version-trace [target]
Perform a RPC scan —-> nmap -sR [target]

Timing Options
Timing Templates —-> nmap -T [0-5] [target]
Set the packet TTL —-> nmap –ttl [time] [target]
Minimum of parallel connections —-> nmap –min-parallelism [number] [target]
Maximum of parallel connection —-> nmap –max-parallelism [number] [target]
Minimum host group size —–> nmap –min-hostgroup [number] [targets]
Maximum host group size —-> nmap –max-hostgroup [number] [targets]
Maximum RTT timeout —–> nmap –initial-rtt-timeout [time] [target]
Initial RTT timeout —-> nmap –max-rtt-timeout [TTL] [target]
Maximum retries —-> nmap –max-retries [number] [target]
Host timeout —-> nmap –host-timeout [time] [target]
Minimum Scan delay —-> nmap –scan-delay [time] [target]
Maximum scan delay —-> nmap –max-scan-delay [time] [target]
Minimum packet rate —-> nmap –min-rate [number] [target]
Maximum packet rate —-> nmap –max-rate [number] [target]
Defeat reset rate limits —-> nmap –defeat-rst-ratelimit [target]

Firewall Evasion Techniques
Fragment packets —-> nmap -f [target]
Specify a specific MTU —-> nmap –mtu [MTU] [target]
Use a decoy —-> nmap -D RND: [number] [target]
Idle zombie scan —> nmap -sI [zombie] [target]
Manually specify a source port —-> nmap –source-port [port] [target]
Append random data —-> nmap –data-length [size] [target]
Randomize target scan order —-> nmap –randomize-hosts [target]
Spoof MAC Address —-> nmap –spoof-mac [MAC|0|vendor] [target]
Send bad checksums —-> nmap –badsum [target]

Output Options
Save output to a text file —-> nmap -oN [scan.txt] [target]
Save output to a xml file —> nmap -oX [scan.xml] [target]
Grepable output —-> nmap -oG [scan.txt] [target]
Output all supported file types —-> nmap -oA [path/filename] [target]
Periodically display statistics —-> nmap –stats-every [time] [target]
133t output —-> nmap -oS [scan.txt] [target]

Troubleshooting and debugging
Help —> nmap -h
Display Nmap version —-> nmap -V
Verbose output —-> nmap -v [target]
Debugging —-> nmap -d [target]
Display port state reason —-> nmap –reason [target]
Only display open ports —-> nmap –open [target]
Trace packets —> nmap –packet-trace [target]
Display host networking —> nmap –iflist
Specify a network interface —> nmap -e [interface] [target]

Nmap Scripting Engine
Execute individual scripts —> nmap –script [script.nse] [target]
Execute multiple scripts —-> nmap –script [expression] [target]
Script categories —-> all, auth, default, discovery, external, intrusive, malware, safe, vuln
Execute scripts by category —-> nmap –script [category] [target]
Execute multiple scripts categories —-> nmap –script [category1,category2, etc]
Troubleshoot scripts —-> nmap –script [script] –script-trace [target]
Update the script database —-> nmap –script-updatedb

Ndiff
Comparison using Ndiff —-> ndiff [scan1.xml] [scan2.xml]
Ndiff verbose mode —-> ndiff -v [scan1.xml] [scan2.xml]
XML output mode —-> ndiff –xml [scan1.xm] [scan2.xml]


Thank you (zer0w0rm)
READMORE
 

Nmap Cheat Sheet

Basic Scanning Techniques

Scan a Single Target
nmap [target]

Scan Multiple Targets
nmap [target1, target2, etc]

Scan a List of Targets
nmap -iL [list.txt]

Scan a Range of Hosts
nmap [range of ip addresses]

Scan an Entire Subnet
nmap [ip address/cdir]

Scan Random Hosts
nmap -iR [number]

Excluding Targets from a Scan
nmap [targets] --exclude [targets]

Excluding Targets Using a List
nmap [targets] --excludefile [list.txt]

Perform an Aggressive Scan
nmap -A [target]

Scan an IPv6 Target
nmap -6 [target]

Click past the jump too see the complete list...

Discovery Options

Perform a Ping Only Scan
nmap -sP [target]

Don’t Ping
nmap -PN [target]

TCP SYN Ping
nmap -PS [target]

TCP ACK Ping
nmap -PA [target]

UDP Ping
nmap -PU [target]

SCTP INIT Ping
nmap -PY [target]

ICMP Echo Ping
nmap -PE [target]

ICMP Timestamp Ping
nmap -PP [target]

ICMP Address Mask Ping
nmap -PM [target]

IP Protocol Ping
nmap -PO [target]

ARP Ping
nmap -PR [target]

Traceroute
nmap --traceroute [target]

Force Reverse DNS Resolution
nmap -R [target]

Disable Reverse DNS Resolution
nmap -n [target]

Alternative DNS Lookup 
nmap --system-dns [target]

Manually Specify DNS Server(s)
nmap --dns-servers [servers] [target]

Create a Host List
nmap -sL [targets]

Advanced Scanning Functions

TCP SYN Scan
nmap -sS [target]

TCP Connect Scan
nmap -sT [target]

UDP Scan
nmap -sU [target]

TCP NULL Scan
nmap -sN [target]

TCP FIN Scan
nmap -sF [target]

Xmas Scan
nmap -sX [target]

TCP ACK Scan
nmap -sA [target]

Custom TCP Scan
nmap --scanflags [flags] [target]

IP Protocol Scan
nmap -sO [target]

Send Raw Ethernet Packets
nmap --send-eth [target]

Send IP Packets
nmap --send-ip [target]

Port Scanning Options


Perform a Fast Scan
nmap -F [target]

Scan Specific Ports
nmap -p [port(s)] [target]

Scan Ports by Name
nmap -p [port name(s)] [target]

Scan Ports by Protocol
nmap -sU -sT -p U:[ports],T:[ports] [target]

Scan All Ports
nmap -p "*" [target]

Scan Top Ports
nmap --top-ports [number] [target]

Perform a Sequential Port Scan
nmap -r [target]

Version Detection

Operating System Detection
nmap -O [target]

Submit  TCP/IP Fingerprints
www.nmap.org/submit/

Attempt to Guess an Unknown OS
nmap -O --osscan-guess [target]

Service Version Detection
nmap -sV  [target]

Troubleshooting Version Scans
nmap -sV --version-trace [target]

Perform a RPC Scan
nmap -sR [target]

Timing Options

Timing Templates
nmap -T[0-5] [target]

Set the Packet TTL
nmap --ttl [time] [target]

Minimum # of Parallel Operations
nmap --min-parallelism [number] [target]

Maximum #  of Parallel Operations
nmap --max-parallelism [number] [target]

Minimum Host Group Size
nmap --min-hostgroup [number] [targets]

Maximum Host Group Size
nmap --max-hostgroup [number] [targets]

Maximum RTT Timeout
nmap --initial-rtt-timeout [time] [target]

Initial RTT Timeout
nmap --max-rtt-timeout [TTL] [target]

Maximum Retries
nmap --max-retries [number] [target]

Host Timeout
nmap --host-timeout [time] [target]

Minimum Scan Delay
nmap --scan-delay [time] [target]

Maximum Scan Delay
nmap --max-scan-delay [time] [target]

Minimum Packet Rate
nmap --min-rate [number] [target]

Maximum Packet Rate
nmap --max-rate [number] [target]

Defeat Reset Rate Limits
nmap --defeat-rst-ratelimit [target]

Firewall Evasion Techniques

Fragment Packets
nmap -f [target]

Specify a Specific MTU
nmap --mtu [MTU] [target]

Use a Decoy
nmap -D RND:[number] [target]

Idle Zombie Scan
nmap -sI [zombie] [target]

Manually Specify a Source Port 
nmap --source-port [port] [target]

Append Random Data
nmap --data-length [size] [target]

Randomize Target Scan Order
nmap --randomize-hosts [target]

Spoof MAC Address
nmap --spoof-mac [MAC|0|vendor] [target]

Send Bad Checksums
nmap --badsum [target]

Output Options

Save Output to a Text File
nmap -oN [scan.txt] [target]

Save Output to a XML File
nmap -oX [scan.xml] [target]

Grepable Output
nmap -oG [scan.txt] [targets]

Output All Supported File Types
nmap -oA [path/filename] [target]

Periodically Display Statistics
nmap --stats-every [time] [target]

133t Output
nmap -oS [scan.txt] [target]


Troubleshooting and Debugging

Getting Help
nmap -h

Display Nmap Version
nmap -V

Verbose Output
nmap -v [target]

Debugging
nmap -d [target]

Display Port State Reason
nmap --reason [target]

Only Display Open Ports
nmap --open [target]

Trace Packets
nmap --packet-trace [target]

Display Host Networking 
nmap --iflist

Specify a Network  Interface
nmap -e [interface] [target]

Nmap Scripting Engine

Execute Individual Scripts
nmap --script [script.nse] [target]

Execute Multiple Scripts
nmap --script [expression] [target]

Script Categories
all, auth, default, discovery, external, intrusive, malware, safe, vuln

Execute Scripts by Category
nmap --script [category] [target]

Execute Multiple Script Categories
nmap --script [category1,category2,etc]

Troubleshoot Scripts
nmap --script [script] --script-trace [target]

Update the Script Database
nmap --script-updatedb

Ndiff

Comparison Using Ndiff
ndiff [scan1.xml] [scan2.xml]

Ndiff Verbose Mode
ndiff -v [scan1.xml] [scan2.xml]

XML Output Mode
ndiff --xml [scan1.xml] [scan2.xml]


Thank you (zer0w0rm)
READMORE
 

Installing Nmap tools

Executing these simple commands will get you up and running quickly with Nmap 5.00 on Unix and Linux systems:

$ wget http://nmap.org/dist/nmap-5.00.tgz
$ tar -xf nmap-5.00.tgz
$ cd nmap-5.00
$ ./configure && make
$ sudo make install


You should see the message NMAP SUCCESSFULLY INSTALLED when the process is complete. Once Nmap has been successfully installed, you can verify it is working correctly by executing nmap localhost on the command line.

$ nmap localhost
Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-07 00:42 CDT
Warning: Hostname localhost resolves to 2 IPs. Using 127.0.0.1.
Interesting ports on e6400 (127.0.0.1):
Not shown: 993 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
25/tcp   open  smtp
111/tcp  open  rpcbind
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
631/tcp  open  ipp
2049/tcp open  nfs
Nmap done: 1 IP address (1 host up) scanned in 0.20 seconds

If the results of your scan are similar to the results above, then you have successfully installed Nmap from source.


Thank you (zer0w0rm)
READMORE