Active Scanning, Fingerprinting & Enumeration
Before you can assess a network's security posture, you need an accurate map of what is actually running. Active scanning, fingerprinting, and enumeration turn an unknown IP range into a detailed inventory of live hosts, open ports, operating systems, user accounts, network shares, and exact software versions.
Unlike passive reconnaissance, active techniques send crafted packets directly to target machines and analyze the responses. Done methodically, this phase reveals misconfigurations and attack paths long before any exploitation ever begins.
10.10.10.0/24 or 192.168.56.0/24), or targets where you have explicit written permission.- How to discover live hosts reliably using ARP, ICMP, and TCP ping sweeps.
- How TCP SYN, UDP, and ACK scans work under the hood and when to use each.
- Practical firewall/IDS evasion techniques and OS fingerprinting mechanics.
- Deep service enumeration across SMB, SNMP, LDAP, SMTP, NFS, and MySQL.
- Hands-On Lab: Run targeted Nmap NSE scripts, Masscan,
enum4linux, andsmbclientagainst lab machines to extract usernames, shares, and exact software versions.
1. The Active Reconnaissance Pipeline
Effective testers never blast every port with every script at once. Instead, they work in a structured funnel: find live hosts first, sweep ports fast, fingerprint the OS and services, and then run targeted protocol enumeration.
Active Scanning, Fingerprinting & Enumeration Workflow
Each stage narrows the scope: discover live targets, map open ports and OS stacks, enumerate specific protocols, and extract actionable intelligence.
2. Host Discovery & Port Scanning Techniques
Before scanning 65,535 ports on every IP, identify which hosts are online. On a local subnet, ARP discovery (nmap -sn -PR 192.168.56.0/24) is the fastest and most accurate because hosts cannot block ARP on their own LAN. Across routed networks, combine ICMP Echo (-PE), TCP SYN ping (-PS22,80,445), and TCP ACK ping (-PA80,443).
TCP SYN, UDP, and ACK Scanning Compared
| Scan Type | Nmap Flag | How It Works | Best Used For |
|---|---|---|---|
| TCP SYN (Half-Open) | -sS |
Sends SYN; if SYN-ACK returns, port is open and scanner sends RST without completing the handshake. | Default fast, stealthier TCP port discovery (requires root/sudo). |
| UDP Scan | -sU |
Sends UDP packets; ICMP Port Unreachable = closed; no response = open|filtered. |
Finding SNMP (161), DNS (53), TFTP (69), and NTP (123). |
| TCP ACK Scan | -sA |
Sends ACK packets; RST = unfiltered, no response/ICMP error = filtered. | Mapping stateful vs. stateless firewall rulesets (does not find open ports directly). |
3. Firewall / IDS Evasion & OS Fingerprinting
Intrusion Detection Systems (IDS) and firewalls look for high-speed sequential probes. When testing defensive visibility in a lab, you can adjust packet timing and structure:
- Timing Templates (
-T0to-T5): Use-T2(polite) or--scan-delay 500msto stay below rate-based IDS thresholds. - Packet Fragmentation (
-f): Splits TCP headers across tiny IP fragments to test whether legacy packet filters reassemble them properly. - Decoy Scanning (
-D RND:5): Mixes your real IP with random decoy source IPs to obscure the true scanner in firewall logs. - Source Port Spoofing (
--source-port 53or443): Tests whether poorly configured stateless firewalls blindly trust traffic originating from DNS or HTTPS ports.
OS Fingerprinting (-O) works by sending a sequence of specially crafted TCP, UDP, and ICMP probes and analyzing subtle TCP/IP stack quirks—such as initial TTL values (Linux typically 64, Windows 128), TCP window sizes, DF (Don't Fragment) bits, and ISN (Initial Sequence Number) randomness.
4. Deep Service Enumeration Reference
Once open ports are found, protocol-specific enumeration uncovers the real gold: valid usernames, unauthenticated shares, directory structures, and exact software versions.
| Service | Default Port | Key Enumeration Goal | Primary Tools / NSE Scripts |
|---|---|---|---|
| SMB | 445 / 139 (TCP) | Null sessions, shares, users, OS/domain info, signing status | enum4linux, smbclient, smb-enum-shares |
| SNMP | 161 (UDP) | Community strings (public), running processes, users, interfaces |
snmpwalk, onesixtyone, snmp-info |
| LDAP | 389 / 636 (TCP) | Naming contexts, anonymous bind, AD users, groups, descriptions | ldapsearch, ldap-rootdse, ldap-search |
| SMTP | 25 / 587 (TCP) | User verification (VRFY, EXPN, RCPT TO), open relay check |
smtp-enum-users, smtp-commands |
| NFS | 2049 (TCP/UDP) | Exported file shares, no_root_squash misconfigurations |
showmount -e, nfs-ls, nfs-showmount |
| MySQL | 3306 (TCP) | Exact DB version, empty root password, accessible databases | mysql-info, mysql-empty-password |
5. Hands-On Lab: Masscan, Nmap NSE, enum4linux & smbclient
In this lab, assume your authorized target lab machine is at 192.168.56.105 (for example, a Metasploitable or custom Linux/Samba lab VM on a host-only network). We will sweep all ports rapidly, fingerprint the OS and versions, and extract shares and usernames.
Step 1: Ultra-fast port sweep with Masscan
Masscan uses an asynchronous custom TCP/IP stack to scan all 65,535 ports in seconds. Keep the rate modest (--rate 1000) in a local VM lab to avoid dropping packets.
Command: Masscan full TCP sweep
sudo masscan 192.168.56.105 -p1-65535 --rate 1000 -e vboxnet0
Expected output
Starting masscan 1.3.2 at 2026-12-01 05:12:10 GMT Initiating SYN Stealth Scan Scanning 1 hosts [65535 ports/host] Discovered open port 22/tcp on 192.168.56.105 Discovered open port 25/tcp on 192.168.56.105 Discovered open port 139/tcp on 192.168.56.105 Discovered open port 445/tcp on 192.168.56.105 Discovered open port 2049/tcp on 192.168.56.105 Discovered open port 3306/tcp on 192.168.56.105
Step 2: Targeted Nmap version, OS & NSE enumeration
Feed only the discovered ports into Nmap for deep version detection (-sV), OS fingerprinting (-O), and targeted NSE scripts across SMB, SMTP, NFS, and MySQL.
Command: Targeted Nmap + NSE scripts
sudo nmap -sS -sV -O -p 22,25,139,445,2049,3306 \
--script="smb-os-discovery,smb-enum-shares,smtp-commands,nfs-showmount,mysql-info" \
-oA lab_scan_105 192.168.56.105
Expected output (key excerpts)
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0) 25/tcp open smtp Postfix smtpd |_smtp-commands: lab-srv.localdomain, PIPELINING, SIZE 10240000, VRFY, ETRN 139/tcp open netbios-ssn Samba smbd 4.15.13-Ubuntu 445/tcp open netbios-ssn Samba smbd 4.15.13-Ubuntu 2049/tcp open nfs 3-4 (RPC #100003) | nfs-showmount: |_ /srv/backups 192.168.56.0/24 3306/tcp open mysql MySQL 8.0.36-0ubuntu0.22.04.1 | mysql-info: | Protocol: 10 | Version: 8.0.36-0ubuntu0.22.04.1 |_ Status: Autocommit OS details: Linux 5.15 - 6.1
Step 3: Enumerate SNMP (UDP) and LDAP
Never forget UDP or directory services. Run a quick UDP check for SNMP and an anonymous LDAP rootDSE query if port 389 is open.
Command: UDP SNMP & LDAP enumeration
# Check SNMP (UDP 161) and walk the MIB tree with community string 'public'
sudo nmap -sU -p 161 --script=snmp-info 192.168.56.105
snmpwalk -v2c -c public 192.168.56.105 1.3.6.1.2.1.1
# Query LDAP naming contexts anonymously (if port 389 is open)
ldapsearch -x -H ldap://192.168.56.105 -s base namingcontexts
Step 4: Extract SMB users & shares with enum4linux and smbclient
Use enum4linux -a to automate RID cycling, password policy retrieval, and share discovery, then connect directly with smbclient.
Command: enum4linux full SMB enumeration
enum4linux -a 192.168.56.105 | tee enum4linux_105.txt
Expected output (abbreviated)
=========================================
| Users on 192.168.56.105 via RID cycling |
=========================================
S-1-5-21-...-1000 WORKGROUP\devadmin (Local User)
S-1-5-21-...-1001 WORKGROUP\svc_backup (Local User)
=========================================
| Share Enumeration on 192.168.56.105 |
=========================================
Sharename Type Comment
--------- ---- -------
print$ Disk Printer Drivers
shared_docs Disk Team Staging Files
IPC$ IPC IPC Service (Samba 4.15.13-Ubuntu)
Command: List and inspect SMB shares with smbclient
# List shares using a null session (-N = no password)
smbclient -L //192.168.56.105/ -N
# Connect to an accessible share and list files
smbclient //192.168.56.105/shared_docs -N -c "ls"
-oA filename in Nmap to save Normal (.nmap), XML (.xml), and Grepable (.gnmap) formats simultaneously so you can parse open ports into other tools without re-scanning.6. Step-by-Step Methodology Summary
nmap -sn to avoid wasting time scanning dead IPs.masscan or nmap -p- to catch non-standard ports (e.g., SSH on 2222 or HTTP on 8443).nmap -sV -O only on the open ports to identify exact software versions and kernel families.enum4linux, smbclient, snmpwalk, ldapsearch, showmount) to extract users, shares, and misconfigurations.7. Hands-On Practice
Enable ufw on a Linux lab VM to block port 3306, then run sudo nmap -sS -p 22,3306 <target> followed by sudo nmap -sA -p 22,3306 <target>. Observe how the state changes between open, filtered, and unfiltered.
When port 25 advertises VRFY in smtp-commands, run Nmap's smtp-enum-users script against your lab machine to verify whether accounts like root or devadmin exist.
Hint: nmap -p 25 --script smtp-enum-users --script-args smtp-enum-users.methods={VRFY} <target>
If showmount -e <target> reveals an exported directory like /srv/backups, create a local mount point /mnt/lab_nfs and mount it read-only (sudo mount -t nfs -o ro,nolock <target>:/srv/backups /mnt/lab_nfs) to inspect its permissions.
8. Interview Questions
open|filtered?
Answer: UDP is connectionless. If a port is open, many services simply ignore an empty UDP probe and send no reply. A firewall dropping the packet also produces no reply. Without a protocol-specific payload (enabled via -sV), Nmap cannot distinguish between an open port that stayed silent and a firewall drop.
-sT) and a TCP SYN scan (-sS)?
Answer: A TCP Connect scan completes the full 3-way handshake using the OS connect() system call, which works without root privileges but is slower and more likely to be logged by target applications. A TCP SYN scan sends raw SYN packets and tears down the connection with an RST immediately after receiving SYN-ACK, making it faster and less noisy in application logs.
Answer: Masscan excels at raw speed across large IP ranges and all 65,535 ports, but it does not perform deep service version detection or run NSE scripts. Running Masscan first to find open ports and then feeding those exact ports into Nmap (-sV -sC -O) gives you both speed and accuracy.
Conclusion
Thorough enumeration is what separates guesswork from precision security testing. By pairing fast discovery (Masscan) with accurate fingerprinting (Nmap) and deep protocol inspection (enum4linux, smbclient, snmpwalk, and ldapsearch), you build a complete picture of every host, user, share, and software version in your lab.
Official Documentation
- Nmap Reference Guide – Official Documentation
- Nmap Scripting Engine (NSE) Script Library
- Masscan – TCP Port Scanner Documentation
- Samba Documentation – smbclient Manual
Upgradix by Shrash Studio – Learn Technology. Build Your Future.
Discussion & Comments
0No comments yet
Start the discussion above — ask a question, share a tip, or reply to a comment.