{"id":5964,"library":"impacket","title":"Impacket","description":"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.","status":"active","version":"0.13.0","language":"python","source_language":"en","source_url":"https://github.com/fortra/impacket","tags":["network","protocol","smb","ldap","dcerpc","kerberos","security","pentesting"],"install":[{"cmd":"pip install impacket","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"wrong":"from impacket.smb import SMBConnection","symbol":"SMBConnection","correct":"from impacket.smbconnection import SMBConnection"}],"quickstart":{"code":"import os\nfrom impacket.smb import SMBConnection\n\n# --- Configuration (replace with your environment variables or actual values) ---\nTARGET_IP = os.environ.get('IMPACKET_TARGET_IP', '127.0.0.1')\nUSERNAME = os.environ.get('IMPACKET_USERNAME', 'guest')\nPASSWORD = os.environ.get('IMPACKET_PASSWORD', '')\nDOMAIN = os.environ.get('IMPACKET_DOMAIN', '') # Often empty for local accounts\n\nif not TARGET_IP:\n    print(\"Please set IMPACKET_TARGET_IP environment variable or replace '127.0.0.1' with an actual SMB server IP.\")\n    exit(1)\n\ntry:\n    print(f\"Attempting to connect to SMB share on {TARGET_IP} as {DOMAIN}\\\\{USERNAME}...\")\n    smb_conn = SMBConnection(TARGET_IP, TARGET_IP)\n    smb_conn.login(USERNAME, PASSWORD, DOMAIN)\n    print(\"Login successful!\")\n\n    shares = smb_conn.listShares()\n    print(\"\\nAvailable Shares:\")\n    for share in shares:\n        print(f\"  - {share['name'].decode('utf-8')}\")\n\n    smb_conn.logoff()\n    print(\"\\nLogged off.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure the target SMB server is reachable and credentials are correct.\")\n    print(\"For a quick test, you might need a local SMB server (e.g., Samba on Linux, or Windows share).\")","lang":"python","description":"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."},"warnings":[{"fix":"Ensure your environment uses Python 3.7+ and adapt any Python 2 specific code constructs.","message":"Impacket 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.","severity":"breaking","affected_versions":"<0.9.20 to >=0.9.20"},{"fix":"Migrate to NTLMv2 or Kerberos for authentication. Ensure target systems support stronger authentication protocols.","message":"NTLMv1 challenge/response authentication has been deprecated and removed due to security vulnerabilities. Attempts to use NTLMv1 will fail.","severity":"breaking","affected_versions":">=0.9.21"},{"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`.","message":"The `impacket.msdcerpc` module was merged into `impacket.dcerpc.v5` for better organization. Imports from `impacket.msdcerpc` will no longer work.","severity":"breaking","affected_versions":">=0.10.0"},{"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).","message":"Many Impacket functionalities, especially those related to Kerberos, require specific DNS configurations or KDC (Key Distribution Center) host information to be correctly resolved or provided.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'0.13.0':67 'access':19 'address':71 'allow':26 'authent':56 'class':8 'collect':5 'construct':29 'current':64 'dce/rpc':37 'dcerpc':81 'detail':25 'enabl':50 'exploit':58 'featur':73 'fix':76 'impacket':1,2 'interact':51 'kerbero':40,82 'ldap':38,80 'level':23,61 'like':35 'low':22 'low-level':21 'network':14,53,77 'new':72 'packet':32 'pars':31 'penetr':44 'pentest':84 'perform':55 'programmat':18 'protocol':15,24,34,60,78 'protocol-level':59 'provid':17 'python':7 'regular':69 'research':48 'script':10 'secur':47,75,83 'servic':54 'smb':36,79 'test':45 'updat':70 'use':42 'user':27 'version':65 'vulner':62 'wide':41 'work':12","created_at":"2026-04-14T18:36:04.643771+00:00","updated_at":"2026-04-16T15:42:57.526464+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.13.1","cli_name":"impacket","cli_version":"sh: 1: impacket: not found","type":"library","homepage":"https://www.coresecurity.com","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/impacket/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","http-networking","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}