nmap:nmap
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
nmap:nmap [2020/06/08 23:15] – created peter | nmap:nmap [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== NMAP ====== | ====== NMAP ====== | ||
- | |||
- | [[NMAP: | ||
===== Nmap Target Selection ===== | ===== Nmap Target Selection ===== | ||
Line 12: | Line 10: | ||
|Scan targets from a text file|nmap -iL list-of-ips.txt| | |Scan targets from a text file|nmap -iL list-of-ips.txt| | ||
- | These are all default scans, which will scan 1000 TCP ports. Host discovery will take place. | + | <WRAP info> |
+ | These are all default scans, which will scan 1000 TCP ports. | ||
+ | |||
+ | Host discovery will take place. | ||
+ | |||
+ | </ | ||
---- | ---- | ||
- | ==== Nmap Port Selection ==== | + | ===== Nmap Port Selection |
|Scan a single Port|nmap -p 22 192.168.1.1| | |Scan a single Port|nmap -p 22 192.168.1.1| | ||
Line 25: | Line 28: | ||
---- | ---- | ||
- | === Nmap Port Scan types === | + | ===== Nmap Port Scan types ===== |
- | + | ||
- | Privileged access is required to perform the default **SYN** scans. | + | |
|Scan using TCP connect|nmap -sT 192.168.1.1| | |Scan using TCP connect|nmap -sT 192.168.1.1| | ||
Line 33: | Line 34: | ||
|Scan UDP ports|nmap -sU -p 123,161,162 192.168.1.1| | |Scan UDP ports|nmap -sU -p 123,161,162 192.168.1.1| | ||
|Scan selected ports - ignore discovery|nmap -Pn -F 192.168.1.1| | |Scan selected ports - ignore discovery|nmap -Pn -F 192.168.1.1| | ||
+ | |||
+ | |||
+ | <WRAP info> | ||
+ | Privileged access is required to perform the default **SYN** scans. | ||
+ | |||
+ | If privileges are insufficient a TCP connect scan will be used. | ||
+ | |||
+ | A TCP connect requires a full TCP connection to be established and therefore is a slower scan. | ||
+ | |||
+ | Ignoring discovery is often required as many firewalls or hosts will not respond to **PING**, so could be missed unless you select the **-Pn** parameter. | ||
+ | |||
+ | Of course this can make scan times much longer as you could end up sending scan probes to hosts that are not there. | ||
+ | |||
+ | </ | ||
---- | ---- | ||
- | == Service and OS Detection == | + | ===== Service and OS Detection |
Service and OS detection rely on different methods to determine the operating system or service running on a particular port. | Service and OS detection rely on different methods to determine the operating system or service running on a particular port. | ||
Line 50: | Line 65: | ||
|Lighter banner grabbing detection|nmap -sV --version-intensity 0 192.168.1.1| | |Lighter banner grabbing detection|nmap -sV --version-intensity 0 192.168.1.1| | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Nmap Output Formats ===== | ||
+ | |||
+ | |Save default output to file|nmap -oN outputfile.txt 192.168.1.1| | ||
+ | |Save results as XML|nmap -oX outputfile.xml 192.168.1.1| | ||
+ | |Save results in a format for grep|nmap -oG outputfile.txt 192.168.1.1| | ||
+ | |Save in all formats|nmap -oA outputfile 192.168.1.1| | ||
+ | |||
+ | The default format could also be saved to a file using a simple file redirect command > file. | ||
+ | |||
+ | Using the -oN option allows the results to be saved but also can be monitored in the terminal as the scan is under way. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Digging deeper with NSE Scripts ===== | ||
+ | |||
+ | |Scan using default safe scripts|nmap -sV -sC 192.168.1.1| | ||
+ | |Get help for a script|nmap --script-help=ssl-heartbleed| | ||
+ | |Scan using a specific NSE script|nmap -sV -p 443 –script=ssl-heartbleed.nse 192.168.1.1| | ||
+ | |Scan with a set of scripts|nmap -sV --script=smb* 192.168.1.1| | ||
+ | |||
+ | According to my Nmap install there are currently 581 NSE scripts. The scripts are able to perform a wide range of security related testing and discovery functions. | ||
+ | |||
+ | The option --script-help=$scriptname will display help for the individual scripts. | ||
+ | |||
+ | You will notice I have used the -sV service detection parameter. Generally most NSE scripts will be more effective and you will get better coverage by including service detection. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Search for DDOS reflection UDP services ===== | ||
+ | |||
+ | |Scan for UDP DDOS reflectors|nmap –sU –A –PN –n –pU: | ||
+ | |||
+ | UDP based DDOS reflection attacks are a common problem that network defenders come up against. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== HTTP Service Information ===== | ||
+ | |||
+ | |Gather page titles from HTTP services|nmap --script=http-title 192.168.1.0/ | ||
+ | |Get HTTP headers of web services|nmap --script=http-headers 192.168.1.0/ | ||
+ | |Find web apps from known paths|nmap --script=http-enum 192.168.1.0/ | ||
+ | |||
+ | There are many HTTP information gathering scripts, here are a few that are simple but helpful when examining larger networks. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Detect Heartbleed SSL Vulnerability ====== | ||
+ | |||
+ | |Heartbleed Testing|nmap -sV -p 443 --script=ssl-heartbleed 192.168.1.0/ | ||
+ | |||
+ | Heartbleed detection is one of the available SSL scripts. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== IP Address information ====== | ||
+ | |||
+ | Gather information related to the IP address and netblock owner of the IP address. | ||
+ | |||
+ | Uses ASN, whois and geoip location lookups. See the IP Tools for more information and similar IP address and DNS lookups. | ||
+ | |||
+ | |Find Information about IP address|nmap --script=asn-query, | ||
+ | |||
+ | ---- | ||
nmap/nmap.1591658132.txt.gz · Last modified: 2020/07/15 09:30 (external edit)