Nmap ("Network Mapper") is a free and open source (license) utility for network discovery and security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts.
nmaptarget.host.com# scan one host
nmap10.11.12.22
nmaptarget1.host.comtarget2.host.com# scan multiple hosts
nmap10.11.12.2210.11.12.1
nmap-iLlist.txt# scan targets from a list
nmap10.11.12.0-50# scan a range of hosts
nmap10.11.12.0/24# scan an entire subnet
nmap-iR100# scan 100 random hosts
nmap10.11.12.*--exclude10.11.12.5# exclude specific hosts
nmap10.11.12.*--excludefileexclude.txt
nmap-Atarget.host.com# aggressive scan (OS, version, scripts, traceroute)
nmap-6ipv6.target.host# scan IPv6 target
Discovery Options$
nmap-sP10.11.12.0/24# ping scan only
nmap-PNtarget.host.com# skip host discovery (treat as up)
nmap-PStarget.host.com# TCP SYN ping
nmap-PAtarget.host.com# TCP ACK ping
nmap-PUtarget.host.com# UDP ping
nmap-PYtarget.host.com# SCTP INIT ping
nmap-PEtarget.host.com# ICMP echo ping
nmap-PPtarget.host.com# ICMP timestamp ping
nmap-PMtarget.host.com# ICMP address-mask ping
nmap-POtarget.host.com# IP protocol ping
nmap-PR10.11.12.0/24# ARP ping (local network)
nmap--traceroutetarget.host.com# traceroute
nmap-Rtarget.host.com# force reverse DNS resolution
nmap-ntarget.host.com# disable DNS resolution
nmap--system-dnstarget.host.com# use system DNS
nmap--dns-servers8.8.8.8,1.1.1.1target.host.com
nmap-sL10.11.12.*# list hosts without scanning
Firewall Evasion Techniques
nmap-ftarget.host.com# fragment packets
nmap--mtu24target.host.com# specify MTU
nmap-DRND:10target.host.com# decoy scan with 10 random decoys
nmap-sIzombie.host.comtarget.host.com# idle zombie scan
nmap--source-port53target.host.com# spoof source port (DNS)
nmap--data-length200target.host.com# append random data
nmap--randomize-hosts10.11.12.*# randomize host scan order
nmap--spoof-mac0target.host.com# spoof MAC (random vendor)
nmap--badsumtarget.host.com# send bad checksums
Version & OS Detection
nmap-Otarget.host.com# OS detection
nmap-O--osscan-guesstarget.host.com# aggressive OS detection
nmap-sVtarget.host.com# service version detection
nmap-sV--version-tracetarget.host.com# debug version detection
nmap-sRtarget.host.com# RPC service scan
Output options
nmap-oNscan.txttarget.host.com# normal text output
nmap-oXscan.xmltarget.host.com# XML output
nmap-oGscan.gnmaptarget.host.com# grepable output
nmap-oAscan_prefixtarget.host.com# output in all major formats
nmap--stats-every10starget.host.com# display stats every 10 seconds
nmap-oSleet_scan.txttarget.host.com# 1337-style ASCII output