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.
sudo apt install enum4linux
enum4linux [options] <target>
To use Enum4linux, confirm SMB is open on the target, then run `enum4linux -a <target>` — one command that returns the user list, shares, groups, password policy, OS version and domain details. Start with an anonymous null session; if it returns nothing, rerun with credentials (`-u` and `-p`). For Windows hosts that block null sessions, use the enum4linux-ng rewrite instead.
The beginner loop is short: find the host with Nmap, confirm ports 139 or 445 are open, run the full `-a` scan, read the output block by block, then rerun targeted flags (`-U` for users, `-S` for shares, `-P` for policy) on the hosts that matter. Save every scan to a file so the results survive the session and can go straight into the report.
A first scan against a lab host shows what the output looks like. Against Metasploitable 2 (192.168.56.102), `enum4linux -a 192.168.56.102` returns users through RID cycling — root, daemon, msfadmin, postgres and service — plus the shares IPC$ and tmp, and a password policy with minimum password length 0 and no account lockout. Those three lines already tell the story: valid usernames to test, a readable share to check, and a policy that makes brute force viable.
Enum4linux gets so much from an unauthenticated connection because of SMB null sessions. Older Windows versions and most Samba installations let an anonymous visitor open the IPC$ share, and through it query user accounts, group memberships and domain policy that administrators assume are private. Modern Windows disables SMBv1 and null sessions by default, which is why the same command can return almost nothing on a hardened host.
Enum4linux is not a vulnerability scanner: it reports what the host discloses over SMB, and says nothing about whether the host is patched or vulnerable. An empty result is not a failed test — on a well-configured host it is a good result, and it belongs in the report as evidence that anonymous enumeration is blocked.
Install Enum4linux with `sudo apt install enum4linux` on Kali Linux, Ubuntu or Debian, and verify it with `enum4linux -h`. For the maintained rewrite, install enum4linux-ng with `sudo apt install enum4linux-ng`, or with pip (`pip install enum4linux-ng`) where the package is not available.
For defenders, the fixes are straightforward: enable Microsoft's 'Network access: Do not allow anonymous enumeration of SAM accounts' policy, limit SMB to the systems that need it, review every share and remove the unused ones, enforce a real password policy with lockout, log and alert on repeated anonymous SMB connections, and rerun the same enum4linux checks after fixing to confirm the exposure is gone.
In a full assessment, Enum4linux sits between discovery and exploitation: Nmap finds the SMB hosts, Enum4linux extracts the users, shares and policy, the user list feeds password spraying with Hydra or NetExec, discovered shares are validated with SMBClient, and Active Directory findings are mapped with BloodHound before everything is consolidated into the report.
| Command | Purpose |
|---|---|
enum4linux -U <lab-smb-host> | Enumerate users. |
enum4linux -S <lab-smb-host> | Enumerate visible shares. |
enum4linux -P <lab-smb-host> | Query password-policy information. |
enum4linux -G <lab-smb-host> | Enumerate groups and members. |
enum4linux -o -n <lab-smb-host> | Query OS information and run nmblookup. |
enum4linux -a <lab-smb-host> | Run all simple enumeration checks. |
enum4linux -a 192.168.1.10All enumeration - Comprehensive Windows/Samba enumeration including users, groups, shares, password policy, and OS detailsenum4linux -U 192.168.1.10User enumeration - Extract list of local user accounts from the target systemenum4linux -S 192.168.1.10Share enumeration - List all available SMB shares including hidden and administrative sharesenum4linux -G 192.168.1.10Group enumeration - Retrieve group memberships and local group informationenum4linux -P 192.168.1.10Password policy - Display password complexity requirements and account lockout settingsenum4linux -o 192.168.1.10Output to file - Save enumeration results to a file for later analysisenum4linux -a -u '' -p '' 192.168.1.10Anonymous full enumeration - Complete scan using null session credentialsenum4linux -l 192.168.1.10List enumeration - Show detailed listing of shares and their contentsenum4linux -n 192.168.1.10NetBIOS enumeration - Extract NetBIOS names, workgroups, and domain informationenum4linux -i 192.168.1.10OS identification - Determine the exact operating system version and service packenum4linux -r -u '' -p '' 192.168.1.10RID cycling - Enumerate users by brute-forcing Relative Identifiers when direct user listing is blockedenum4linux -w WORKGROUP -a 192.168.1.10Workgroup discovery - Specify the workgroup/domain name manually for accurate enumerationenum4linux -v -a 192.168.1.10Verbose scan - Show the underlying smbclient, rpcclient, and net commands as they run for debuggingenum4linux -a 192.168.1.10 | tee enum_192.168.1.10.txtSave output - Run full enumeration while writing results to a timestamped report filefor ip in $(cat smb_hosts.txt); do enum4linux -a "$ip" > "enum_$ip.txt"; doneBatch enumeration - Enumerate a list of confirmed SMB hosts and save each to its own filenmap -p445 --open -oG - 192.168.1.0/24 | awk '/445\/open/{print $2}' | xargs -I{} enum4linux -a {}Nmap integration - Pipe hosts with open SMB from Nmap directly into Enum4linux enumerationenum4linux -S 192.168.1.10 && smbclient -L //192.168.1.10 -NSMBClient integration - Enumerate shares, then list them interactively with SMBClient to test accessenum4linux-ng -A -oJ enum_report 192.168.1.10Enum4linux-ng JSON - Run full enumeration with the modern rewrite and export structured JSON for toolingEnumerate Windows hosts during authorized penetration tests to discover usernames for brute-force attacks, accessible shares for data exfiltration, and password policies for attack planning.
Map Windows network infrastructure during red team engagements, identifying lateral movement opportunities through accessible SMB shares and user account information.
Assess SMB security posture by identifying anonymous access, weak password policies, and exposed shares that could be exploited by attackers.
Discover and catalog Windows systems on a network, collecting OS versions, NetBIOS names, workgroup memberships, and shared resources for asset management.
Gather initial domain information from Domain Controllers including user listings, group policies, and trust relationships during AD security assessments.
Investigate compromised Windows systems by enumerating user accounts, shared folders, and network configuration to understand the scope of a security incident.
| Feature | Enum4linux | Enum4linux-ng |
|---|---|---|
| Language | Perl (legacy) | Python 3 (modern) |
| Maintenance | Largely unmaintained | Actively maintained |
| SMB Version Support | SMBv1-centric | SMBv1/2/3 |
| Output Formats | Free text only | Text, JSON, YAML |
| Error Handling | Basic | Robust, clearer messages |
| Speed | Medium | Faster |
| Best For | Legacy compatibility / labs | Modern engagements & automation |
| Feature | Enum4linux | SMBClient |
|---|---|---|
| Primary Role | Automated enumeration | Interactive share access |
| Users/Groups/Policy | Yes (automated) | No |
| Browse Share Contents | Lists shares only | Yes (ls, get, put) |
| File Download/Upload | No | Yes |
| Automation | One-command sweep | Manual / scripted |
| Pipeline Role | Discover shares & users | Validate & access shares |
| Best For | Initial enumeration | Confirming access & data |
| Feature | Enum4linux | CrackMapExec |
|---|---|---|
| Scope | Single host | Network-wide (ranges) |
| Credential Spraying | No | Yes (parallel) |
| Post-Exploitation | No | Yes (exec, dump, modules) |
| SMBv2/3 Support | Limited (ng better) | Full |
| Learning Curve | Low | Medium |
| Speed at Scale | Slow across ranges | Fast (threaded) |
| Best For | Focused single-host recon | Large-scale SMB attacks |
| Feature | Enum4linux | Nmap SMB NSE |
|---|---|---|
| Approach | Dedicated SMB enumeration | Scriptable scan add-on |
| User Enumeration | Yes (RID cycling) | Yes (smb-enum-users) |
| Share Enumeration | Yes | Yes (smb-enum-shares) |
| Vuln Detection | Indirect (reports SMB version) | Yes (smb-vuln-* scripts) |
| Depth of SMB Data | High (policy, groups, OS) | Moderate |
| Integration | Standalone | Within Nmap workflow |
| Best For | Deep SMB profiling | Quick checks during scanning |
| Feature | Enum4linux | NetExec |
|---|---|---|
| Status | Classic enumeration tool | Maintained CME successor |
| Protocols | SMB / NetBIOS | SMB, WinRM, LDAP, MSSQL, SSH, RDP |
| Multi-host | One at a time / batch loop | Native ranges & subnets |
| Credential Checks | Enumeration only | Auth, spraying, hash relay |
| Modules | Fixed flag set | Extensive module ecosystem |
| Output | Text (ng: JSON) | Console + database + logs |
| Best For | First-touch SMB recon | Full AD attack workflows |
| Feature | Manual (smbclient/rpcclient) | Automated (Enum4linux) |
|---|---|---|
| Speed | Slow, command-by-command | Fast one-command sweep |
| Coverage | Only what you query | Users, shares, groups, policy, OS |
| Learning Value | High (understand each step) | Lower (abstracts the calls) |
| Control / Stealth | Precise, quieter | Noisier, many queries |
| Repeatability | Depends on operator | Consistent every run |
| Best For | Targeted checks & learning | Comprehensive fast recon |
Yes, though enum4linux-ng (the Python 3 rewrite) is now preferred. The original Perl script still ships with Kali and works against legacy SMBv1 hosts, but enum4linux-ng handles modern SMBv2/3 targets and produces JSON output.
Not always. It can enumerate anonymously via null sessions on hosts that allow them. Modern Windows disables null sessions, so authenticated enumeration with -u and -p usually returns far more data.
RID cycling (-r) brute-forces Relative Identifiers to enumerate user accounts by their SID suffix when direct user listing is blocked. It can recover valid usernames even when RestrictAnonymous limits standard enumeration.
Use enum4linux-ng for new work: it is actively maintained, supports SMBv2/3, and exports JSON/YAML. Keep the original enum4linux for legacy SMBv1 targets or when reproducing older tutorials and labs.
Usually because null sessions are disabled, SMBv1 is turned off, or ports 139/445 are filtered. Verify SMB is reachable with Nmap, try enum4linux-ng, and supply valid credentials for authenticated enumeration.
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
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.
Information Gathering
NBTScan is a program for scanning IP networks for NetBIOS name information. It sends a NetBIOS status query to each address in the supplied range and lists received information in human-readable form.
Information Gathering
enum4linux-ng is a next-generation version of the classic enum4linux script, rewritten from scratch in Python 3 to parse and enumerate Windows/Samba information efficiently with cleaner output formats.
Post Exploitation
CrackMapExec (CME) is a post-exploitation tool for pentesting Windows and Active Directory networks. It can enumerate users, spray passwords, execute commands, and move laterally.
Password Attacks
Hydra is a parallelized login cracker that supports numerous protocols including FTP, HTTP, HTTPS, SMB, SSH, and many more. It performs rapid dictionary attacks against login pages and services to test password strength.
Learn Enum4Linux for enumerating Windows and Samba systems including user lists, shares, groups, and security policy information.
Guides · AdvancedA complete beginner-to-advanced SMB enumeration guide covering discovery, NetBIOS, share access, user enumeration, automation, troubleshooting, workflow design, and SMB tool selection.
Tools · BeginnerComplete guide to SMB enumeration for discovering Windows shares, users, groups, and network resources using Enum4Linux, SMBClient, NBTScan, and Nmap.
Active Directory · AdvancedComprehensive guide to Active Directory enumeration using native tools, PowerShell, and specialized utilities for discovering users, groups, computers, and trust relationships.
Enum4linux prints its results in labelled blocks, in this order: session and target details, users, groups, shares, password policy, OS information, domain information and NetBIOS names. Read them like a lab report. A user line such as `user:[msfadmin] rid:[0x3f2]` is one valid account with its Relative Identifier; the RID-cycled section lists accounts the standard query hid. The share table lists each share name, type and comment — IPC$ is the anonymous channel, a Disk share such as tmp is one to validate with SMBClient. The password policy block shows minimum length, history and lockout threshold: a minimum length of 0 with no lockout means brute force is viable, while a strict policy means it is not. Turn each block into a finding: users become the Hydra or NetExec target list, shares become access checks, policy becomes the brute-force plan. If every block is empty, record it as a positive result — anonymous enumeration is blocked on that host.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.