Nmap is a network exploration tool that collects information about target hosts including open ports, services, OS detection, and running scripts. It offers various host discovery techniques like ICMP ping, TCP and UDP ping to find active systems on the network. Once hosts are identified, nmap performs port scanning using TCP SYN, ACK, and UDP scans to determine open and closed ports. It can also detect services, versions, and OS on each host. Nmap scripts provide additional information gathering capabilities for vulnerabilities and exploits.
Basics of NMAP: a network exploration tool for host/service discovery and vulnerability detection.
NMAP installation instructions and methods for specifying targets using IP addresses and CIDR notation.
Initial steps in network exploration to identify active hosts using various discovery techniques.
Techniques like List Scan, No Ping, and various ping types for effective host discovery.
Introduction to port scanning, recognizing 65,535 ports and identifying their states.Methods for scanning ports including TCP SYN, ACK, and UDP scans with specific commands.
NMAP's capabilities for detecting services and operating systems running on network hosts.
Overview of NSE features, using Lua scripts for automation, and listing available scripts.
Methods for saving scan results in different formats including standard and XML output.
Additional NMAP scanning options for verbosity, aggression, and advanced features.
What’s NMAP ?
->NMAP is a mapping or a footprinting tool.
-> It is used for network exploration.
-> NMAP collects information about target host.
-> Target can be specified by IP Adress or Domain Name.
-> command : nmap 192.168.10.1 or nmap www.google.com
3.
What’s NMAP ?
->Host / Port / Service Discovery
-> OS Version Detection
-> Service Version Detection
-> Vulnerability and Exploit detection using NSE
-> Firewall and spoofing evasions.
4.
Installing NMAP
-> NMAPis available fo all cross platforms.
-> In Linux distros we can install it by using sudo apt-get nmap.
Target Specification
-> Targetcan be a single host or multiple hosts.
nmap 192.168.10.1
nmap 192.168.10.2 192.168.10.3
nmap 192.168.10.1-24
-> any random hosts
nmap -iR 5
Default Scan
-> nmap192.168.10.0/24
->ping phase :
pings all the listed ip address.
-> port scan phase :
If ip address responds to ping i.e host is online then
->nmap scans all the ports of the ip address ( by default it scans 1000
ports ).
Host Discovery
-> Oneof the very first steps in any network expolartion mission is to reduce a
(sometimes huge) set of IP ranges into a list of active hosts.
-> Scanning every port of every single IP address is slow and usually
unnecessary.
-> Nmap offers a wide variety of options for customizing the techniques used.
13.
Various Host DiscoveryTechniques
-> List Scan
->no port scan
-> No ping scan
->TCP SYN Ping
-> TCP ACK Ping
-> UDP Ping
-> Traceroute
14.
Varios Host DiscoveryTechniques
-> ICMP Ping Types
-> no dns resolution
-> DNS Resolution for all targets
15.
List Scan
-> ListScan
nmap -sL 192.168.43.0/24
-> simply lists each host of the network specified.
-> it doesnt send any packets to the target hosts.
-> does DNS resolution.
17.
No port scan
->Does’t do port scan after host discovery
->only prints out the available hosts
nmap -sn 192.168.10.0/24
TCP SYN Ping
->This option sends an empty TCP packet with the SYN flag set
nmap -PS 192.168.10.0/24
23.
TCP ACK Ping
->This option sends an empty TCP packet with ACK flag set.
->
nmap -PA 192.168.10.0/24
25.
UDP Ping
-> Thisoption sends an empty UDP packets to hosts.
-> Generally ACK and SYN packets are blocked by firewall.
-> This option helps in bypassing firewall.
nmap -PU 192.168.10.0/24
Port Scanning
-> aswe have found online hosts .. our next step will be targeting ports of active
hosts.
-> there are 65,535 ports
-> nmap by default scans 1000 ports
-> nmap recognizes ports in 6 states.
34.
Port Scanning
Six statesrezognized by nmap are :
->open
->closed
-> filtered
->unfiltered
->open | filered
-> close | filtered
NMAP Script Engine
->TheNmap Scripting Engine (NSE) is one of Nmap's most powerful and flexible
features.
-> It allows users to write (and share) simple scripts (using the Lua programming
language) to automate a wide variety of networking tasks.
-> NMAP also comes with premade scripts
->NSE can even be used for vulnerability exploitation
50.
What’s a script?
-> a script is basically a predefined code written using Lua Programming
Language
-> this predefined code helps in gathering more information about services running
at the ports.
51.
List of Scripts
->nmapcomes with premade scripts and are stored in the
/usr/share/nmap/scripts
-> we can list all the premade scripts
ls /usr/share/nmap/scripts
53.
List of scripts
->for different services we have different list of scripts available.
-> we can list scripts available for a particular service using grep command.
ls /usr/share/nmap/scripts | grep “service_name”
-> for example
We can list scripts available for http service
ls /usr/share/nmap/scripts | grep http
55.
Script Scanning
-> defaultscript scanning : for different services default scripts are set
-> when default script is run , nmap scan default scripts of services running at
ports.
nmap -sC scanme.nmap.org
OUTPUT
-> we cansave our scan results in an output file.
-> nmap -oN file_name 192.168.10.1
Outputs to given file name.
-> nmap -oX file_name 192.168.10.1
-> XML Output to given file name.
Miscellaneous Options
-> verbosescanning
Print more information about the scan in progress
nmap -v 192.168.10.1
-> aggressive scanning
Enables OS (-O) and service detection(-sV) , traceroute(--
traceroute),
scriptscanning (-sC) .
nmap -A 192.168.10.1