Registry / auth-security / impacket

impacket

JSON →
library0.13.1pypypi✓ verified 82d ago

Impacket is a collection of Python classes and scripts for working with network protocols. It provides programmatic access to low-level protocol details, allowing users to construct and parse packets for protocols like SMB, DCE/RPC, LDAP, and Kerberos. Widely used in penetration testing and security research, it enables interacting with network services, performing authentication, and exploiting protocol-level vulnerabilities. The current version is 0.13.0, with regular updates addressing new features and security fixes.

pip install impacket
INSTALL
IMPORT
SIG · IMPACKET
I
impacket
auth-securitypythonv0.13.1
Install
6.0s avg
Import
Disk
76MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.13.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 71.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 6.0s · import 0.000s · 73MB
76MB installed
● package 76MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SMBConnection
from impacket.smbconnection import SMBConnection
from impacket.smb import SMBConnection

This quickstart demonstrates how to establish an SMB connection, authenticate, and list available shares using `impacket.smb.SMBConnection`. It fetches sensitive information from environment variables for security and flexibility.

import os from impacket.smb import SMBConnection # --- Configuration (replace with your environment variables or actual values) --- TARGET_IP = os.environ.get('IMPACKET_TARGET_IP', '127.0.0.1') USERNAME = os.environ.get('IMPACKET_USERNAME', 'guest') PASSWORD = os.environ.get('IMPACKET_PASSWORD', '') DOMAIN = os.environ.get('IMPACKET_DOMAIN', '') # Often empty for local accounts if not TARGET_IP: print("Please set IMPACKET_TARGET_IP environment variable or replace '127.0.0.1' with an actual SMB server IP.") exit(1) try: print(f"Attempting to connect to SMB share on {TARGET_IP} as {DOMAIN}\\{USERNAME}...") smb_conn = SMBConnection(TARGET_IP, TARGET_IP) smb_conn.login(USERNAME, PASSWORD, DOMAIN) print("Login successful!") shares = smb_conn.listShares() print("\nAvailable Shares:") for share in shares: print(f" - {share['name'].decode('utf-8')}") smb_conn.logoff() print("\nLogged off.") except Exception as e: print(f"An error occurred: {e}") print("Please ensure the target SMB server is reachable and credentials are correct.") print("For a quick test, you might need a local SMB server (e.g., Samba on Linux, or Windows share).")
impacket --version
Debug
Known issues
breakingImpacket versions 0.9.20 and later are exclusively Python 3. If upgrading from older versions (pre-0.9.20), significant code changes may be required for Python 2 compatibility.
fix
Ensure your environment uses Python 3.7+ and adapt any Python 2 specific code constructs.
affects: <0.9.20 to >=0.9.20
breakingNTLMv1 challenge/response authentication has been deprecated and removed due to security vulnerabilities. Attempts to use NTLMv1 will fail.
fix
Migrate to NTLMv2 or Kerberos for authentication. Ensure target systems support stronger authentication protocols.
affects: >=0.9.21
breakingThe `impacket.msdcerpc` module was merged into `impacket.dcerpc.v5` for better organization. Imports from `impacket.msdcerpc` will no longer work.
fix
Update all imports from `impacket.msdcerpc` to `impacket.dcerpc.v5`. For example, `from impacket.msdcerpc.v5 import dcomrt` becomes `from impacket.dcerpc.v5 import dcomrt`.
affects: >=0.10.0
gotchaMany Impacket functionalities, especially those related to Kerberos, require specific DNS configurations or KDC (Key Distribution Center) host information to be correctly resolved or provided.
fix
Ensure proper DNS resolution for target domains/hosts or explicitly provide KDC host information where applicable (e.g., in `SMBConnection` constructor or Kerberos functions).
affects: All
Upgrade
Version history
0.13.1latest on PyPI · released May 19, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
24
OpenAI (training)
1
Resources
impacket — pip install impacket · libregistry