Subscribe by RSS RSS Icon
Follow me on Twitter Twitter Icon

Important Nmap Commands

Nmap is short for Network Mapper. It is an open source security tool for network exploration, security scanning and auditing.

Basic scan
nmap  192.168.1.0/24

Host discovery
nmap -sP 192.168.1.0/24

Exclude Host
nmap 192.168.1.0/24 --exclude 192.168.1.5,192.168.1.254

Find out if host is behind a firewall
nmap -sA 192.168.1.254

Scan host behind a firewall
nmap -PN 192.168.1.1
nmap -PS 192.168.1.1
nmap -PA 192.168.1.1

Scan IPv6
nmap -6 IPv6-Address

Fast scan
nmap -F -T5 192.168.1.1

Display the reason for a port in particular state
nmap --reason 192.168.1.1

Show only open port
nmap --open 192.168.1.1

Show host interface and route
nmap --iflist

OS detection

nmap -O 192.168.1.1

Scan using IP protocol ping
nmap -PO 192.168.1.1

IP protocol scan
nmap -sO 192.168.1.1

Scan firewall for security weaknesses
nmap -sN 192.168.1.254
nmap -sF 192.168.1.254
nmap -sX 192.168.1.254

Firewall scan with fragmented packets
nmap -f --mtu 32 192.168.1.1

Decoy scan
nmap -n -D decoy-ip1,decoy-ip2,your-own-ip,decoy-ip3,decoy-ip4 remote-host-ip

MAC address spoofing
nmap -v -sT -PN --spoof-mac MAC-ADDRESS-HERE 192.168.1.1

SMB scan using NSE
nmap -v -O -sV -T4 --osscan-guess -oA ms-smbscan --script=smb-enum-domains, smb-enum-processes,smb-enum-sessions,smb-enum-shares,smb-enum-users,smb-os-discovery,smb-security-mode,smb-system-info <target ip>

Scan for SMTP Open Relay
nmap --script smtp-open-relay.nse <domain> -p 25,465,587 <mail-server>

Scanning the Internet
nmap -T4 --top-ports 50 -sV -O --osscan-limit --osscan-guess --min-hostgroup 128 --host-timeout 10m -oA ms-vscan-%D

parse result
grep " open " ms-vscan.nmap | seed -r 's/ +/ /g' | sort | unique -c | sort -rn | less

Web Scanning
nmap --script http-headers,http-title <target>
nmap -sV --script "(http-*) and not(http-slowloris or httpbrute)" <target>

Scanning Website for Malware
nmap -sV --script http-google-malware.nse,http-malware-host.nse -p80,443 <target>

0 comments:

 
Copyright Info.

Only for my personal reference. I do not own any of these materials here. Use it at your own risk!

XHTML/CSS validations
Valid XHTML 1.0 Transitional Valid CSS!