Information Gathering
Learn how to use Nmap, the free open-source network scanner: run your first port scan, discover live hosts, detect services and operating systems, and check for vulnerabilities with NSE scripts — a beginner tutorial for Kali Linux.
sudo apt update && sudo apt install nmap -y
nmap [Scan Type] [Options] {target specification}To use Nmap, install it with sudo apt install nmap, then run nmap <target> to scan the top 1,000 ports on a host you own or have written permission to test. Add -sn to find live hosts on a subnet, -sV to identify the services on open ports, -O to detect the operating system, and --script vuln to check for known vulnerabilities. Save every scan with -oA so you can review and share the results.
Learning how to use Nmap follows one loop: install it, confirm it with nmap --version, pick an authorized target, discover live hosts, scan ports, detect services and the operating system, run NSE scripts for vulnerabilities, then save and review the results. Install on Kali or Debian with sudo apt install nmap, on Fedora with sudo dnf install nmap, on macOS with brew install nmap, on Arch with sudo pacman -S nmap, or on Windows with the installer from nmap.org.
Your first scan can run against your own machine. The command nmap -sT -p 22,80,443 127.0.0.1 checks three ports on localhost and returns a scan report for localhost (127.0.0.1): host is up, then a PORT, STATE and SERVICE table showing 22/tcp open ssh, 80/tcp closed http and 443/tcp closed https. It proves port 22 is listening while 80 and 443 are reachable but have nothing listening — and it ran in 0.06 seconds.
Read every port state together with the target, the protocol and the scan type. An open port accepts connections and is part of the attack surface. A closed port is reachable but has no service listening — it still tells an attacker the host is alive. A filtered port means a firewall or packet filter is silently dropping probes, so Nmap cannot decide whether the port is open or closed. Unfiltered means the port answered but this scan type cannot determine open versus closed. For UDP, open|filtered is the usual answer because UDP has no handshake; confirm it with an application-aware probe such as -sV, or ask the service owner.
Nmap (Network Mapper) is a free, open-source utility for network discovery and security auditing. It uses raw IP packets to identify active hosts, open ports, running services, and operating systems across any TCP/IP network.
Created by Gordon Lyon in 1997, Nmap has become the industry-standard tool for network reconnaissance. Security professionals, system administrators, and penetration testers rely on it for asset discovery, vulnerability assessment, and compliance verification.
The Nmap Scripting Engine (NSE) extends core scanning with over 700 Lua scripts for automated vulnerability detection, brute-force testing, and service enumeration. Combined with Zenmap, its graphical interface, Nmap serves both beginners and advanced users.
| Command | Purpose |
|---|---|
nmap <target> | Scan the default 1,000 common ports. |
nmap -sn <target> | Discover live hosts without a port scan. |
nmap -p 80,443 <target> | Scan selected TCP ports. |
nmap -p- <target> | Scan TCP ports 1 through 65535.Full-port scans can create substantial traffic. |
nmap -sV <target> | Probe open ports for service and version information. |
nmap -A <target> | Enable OS detection, version detection, default scripts, and traceroute.Aggressive scans are intrusive and require explicit authorization. |
nmap 192.168.1.1Basic scan of a single IP addressnmap -sV 192.168.1.1Probe open ports to determine service/version infonmap -sn 192.168.1.0/24Ping scan - disable port scan (discover active hosts)nmap -p 80,443 192.168.1.1Scan specific ports (80 and 443)nmap -sS 192.168.1.1TCP SYN scan (stealth scan)nmap -sT 192.168.1.1TCP connect scannmap -sU 192.168.1.1UDP scannmap -p- 192.168.1.1Scan all 65535 portsnmap -O 192.168.1.1Enable OS detectionnmap -A 192.168.1.1Aggressive scan (OS, version, script scanning, traceroute)nmap -sS -sV -O -p- -T4 192.168.1.1Comprehensive fast scan (SYN, version, OS, all ports, T4 timing)nmap --script vuln 192.168.1.1Run all vulnerability scanning scriptsnmap --script=http-enum 192.168.1.1Enumerate common web application directories and filesnmap --script=smb-vuln* 192.168.1.1Run all SMB vulnerability scriptsnmap -sV --script=banner 192.168.1.1Grab banners for detected servicesnmap -sS -Pn -n --disable-arp-ping 192.168.1.1Stealth scan, treat host as online, no DNS, disable ARP pingnmap -sS -f 192.168.1.1SYN scan with fragmented IP packets (firewall bypass)nmap -D RND:10 192.168.1.1Scan with 10 random decoys to obfuscate source IPnmap --source-port 53 192.168.1.1Spoof source port as 53 (DNS) to bypass rulesnmap -sI zombie_ip 192.168.1.1Idle scan using a zombie host (blind scan)nmap --script=default,safe 192.168.1.1Run default and safe category scriptsnmap -oA scan_results 192.168.1.1Output results in all major formats (normal, XML, greppable)nmap -iL targets.txt -oN output.txtRead targets from file and save normal outputnmap --script "http-* and not http-brute" 192.168.1.1Run HTTP scripts except brute force onesnmap -sV -O -p 1-1000 192.168.1.1Scan the first 1000 ports with service detection and OS fingerprintingnmap -F 192.168.1.1Fast scan of the 100 most common portsnmap -sC 192.168.1.1Run the default NSE script setnmap -sL 192.168.1.0/24List targets without sending any probesnmap -sA 192.168.1.1ACK scan to map which ports a firewall filtersnmap --open 192.168.1.1Show only ports that are opennmap -6 2001:db8::1Scan an IPv6 targetnmap --script ssl-enum-ciphers -p 443 192.168.1.1List the TLS ciphers a server acceptsnmap -n 192.168.1.0/24Skip reverse DNS lookups to speed up the scannmap -v 192.168.1.1Verbose output showing scan progressnmap -sS -T4 -p- 192.168.1.100Fast full TCP SYN scan all portsIdentify active devices on any network segment. Find live hosts before deeper scanning.
Map open ports on target systems. Detect TCP/UDP services accepting connections.
Fingerprint running services and version numbers. Identify outdated software.
Determine operating system through TCP/IP stack fingerprinting.
Run NSE scripts to detect known CVEs and misconfigurations.
Visualize entire network topologies. Document infrastructure layout.
Identify firewall rules and packet filtering behavior using different scan types and response analysis.
Evaluate encryption configurations, certificate validity, and supported cipher suites on web servers.
Test common default usernames and passwords on discovered services using NSE brute-force scripts.
Discover DNS records, zone transfers, and subdomains associated with target domains.
Build a comprehensive asset database of all devices, operating systems, and services across the infrastructure.
Find unauthorized devices and services connected to the network that bypass official IT management.
A SYN scan (-sS) sends SYN packets without completing the TCP handshake, making it faster and stealthier — it is the default when running as root. A TCP connect scan (-sT) completes the full three-way handshake using the OS connect() call, which is more reliable but slower and fully logged by the target. Use -sS for stealthy authorized engagements; use -sT only when -sS is unavailable (non-root).
A default scan of the top 1000 ports on a single host completes in 1-5 seconds. A full port scan (-p-) covering all 65535 ports takes 2-10 minutes per host depending on the timing template (-T0 through -T5) and network conditions. Aggressive timing (-T5) is faster but more likely to miss ports or trigger IDS alerts.
Yes. Use nmap -O [target] for OS detection. Nmap analyzes TCP/IP stack responses, TCP window sizes, IP ID sequences, and other fingerprinting techniques to determine the target's operating system and version with high accuracy. OS detection requires at least one open and one closed port on the target.
NSE is a Lua-based framework that extends Nmap's scanning capabilities with over 700 scripts. Scripts automate vulnerability detection (vuln category), brute-force testing (brute category), network discovery (discovery category), and more. Run scripts with nmap --script [category or script name] [target]. Categories include auth, broadcast, brute, default, discovery, dos, exploit, external, fuzzer, intrusive, malware, safe, version, and vuln.
Nmap itself is legal software. However, scanning networks or systems without explicit written permission from the owner is illegal in most jurisdictions. Unauthorized scanning violates laws like the CFAA (US), Computer Misuse Act (UK), and similar legislation worldwide. Always obtain proper authorization before performing any network scans.
Yes, but with limitations. Nmap can use fragmentation (-f), decoys (-D), source port spoofing (--source-port), and idle scans (-sI) to bypass some firewall rules. However, stateful firewalls that track connections will block many evasion techniques. Use nmap -sN (Null scan) or -sF (FIN scan) to bypass stateless packet filters.
nmap -sS (SYN scan) sends SYN packets without completing the TCP handshake — it is faster, stealthier, and the default scan when running as root. nmap -sT (TCP connect scan) completes the full three-way handshake using the OS connect() call, making it more reliable but slower and fully logged by the target. Use -sS for stealth; use -sT only when -sS is unavailable (non-root).
Yes. Use nmap -6 [target] to scan IPv6 addresses. Nmap supports IPv6 scanning for most scan types including SYN, connect, and UDP scans. IPv6 scanning is especially useful in modern enterprise networks and cloud environments that use dual-stack or IPv6-only configurations.
Information Gathering
traceroute tracks the route packets take across an IP network on their way to a given host. It utilizes the IP protocol 'time to live' (TTL) field and attempts to elicit an ICMP TIME_EXCEEDED response.
Information Gathering
Learn how to use Enum4linux to enumerate Windows and Samba systems over SMB: install it on Kali Linux, run your first scan, read the users, shares, groups and password policy it returns, and switch to enum4linux-ng for modern hosts that block null sessions.
Information Gathering
Learn how to use SMBClient on Kali Linux: install Samba's FTP-like SMB/CIFS client, list shares, connect as a guest or with credentials, browse folders, and upload or download files on Windows, Samba, or NAS devices. For authorized assessments, check ports 139/445 with Nmap before testing share permissions.
Information Gathering
Masscan is an internet-scale port scanner. It can scan the entire Internet in under 6 minutes, transmitting up to 10 million packets per second utilizing asynchronous transmit setups.
Vulnerability Analysis
Learn how to use Nikto, an open-source web server scanner written in Perl and pre-installed on Kali Linux, to audit servers you own or have written permission to test. Its 6700+ checks for potentially dangerous files and programs, plus tests for outdated software and misconfigurations, highlight issues that need verification.
Web Application
Learn how to use Gobuster, the fast Go-based directory and subdomain brute-forcer, with install steps, your first dir scan, wordlist picks, and result filtering — a beginner tutorial for Kali Linux.
Learn Nmap from scratch covering host discovery, port scanning, service detection, NSE scripts, and practical examples.
OSINT · IntermediateMaster advanced Nmap scanning techniques including NSE scripting, firewall evasion, performance tuning, and custom scan types for professional penetration testing.
Tools · BeginnerA beginner-friendly guide to network scanning with Nmap covering host discovery, port scanning techniques, service detection, and practical scanning examples.
OSINT · IntermediateLearn to use Amass for comprehensive attack surface mapping including DNS enumeration, subdomain discovery, integration with APIs, and visualizations.
Nmap output shows: PORT (port number/protocol), STATE (open/closed/filtered), and SERVICE (what's running). Example — nmap -sT -p 22,80,443 127.0.0.1 against localhost returns: Starting Nmap 7.94SVN ( https://nmap.org ), Nmap scan report for localhost (127.0.0.1), Host is up (0.00074s latency)., then a PORT, STATE and SERVICE table with 22/tcp open ssh, 80/tcp closed http and 443/tcp closed https, then Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds. Read it like this: "open" means a service accepts connections on that port; "closed" means the host answered but nothing is listening; "filtered" means a firewall silently drops the probe; "open|filtered" means Nmap cannot tell the two apart, which is common for UDP because UDP has no handshake — add -sV or scan fewer UDP ports for a clearer answer. Add -sV to replace the SERVICE guess with the real service and version, and -oA to save the report in normal, XML and grepable formats at once.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.