Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/DumpNTLMInfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -37,6 +38,7 @@
import os
import sys
import argparse
import argcomplete
import logging
import struct
import socket
Expand Down Expand Up @@ -644,6 +646,8 @@ def __convert_size(self, size_bytes):
parser.add_argument('-protocol', choices=['SMB', 'RPC'], nargs='?', metavar="protocol",
help='Protocol to use (SMB or RPC). Default is SMB, port 135 uses RPC normally.')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/Get-GPPPassword.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand All @@ -20,6 +21,7 @@
#

import argparse
import argcomplete
import base64
import xml
import charset_normalizer
Expand Down Expand Up @@ -227,6 +229,8 @@ def parse_args():
group.add_argument("-target-ip", action="store", metavar="ip address", help="IP Address of the target machine. If omitted it will use whatever was specified as target. This is useful when target is the NetBIOS name and you cannot resolve it")
group.add_argument("-port", choices=["139", "445"], nargs="?", default="445", metavar="destination port", help="Destination port to connect to SMB Server")

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
Expand Down
5 changes: 3 additions & 2 deletions examples/GetADComputers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -30,6 +31,7 @@
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import argcomplete
import logging
import sys
import dns.resolver
Expand Down Expand Up @@ -209,8 +211,7 @@ def run(self):
'If ommited, the domain part (FQDN) '
'specified in the account parameter will be used')



argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
Expand Down
4 changes: 4 additions & 0 deletions examples/GetADUsers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -28,6 +29,7 @@
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import argcomplete
import logging
import sys
from datetime import datetime
Expand Down Expand Up @@ -173,6 +175,8 @@ def run(self):
'If ommited, the domain part (FQDN) '
'specified in the account parameter will be used')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/GetLAPSPassword.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -37,6 +38,7 @@
from pyasn1.codec.der import decoder
from pyasn1_modules import rfc5652
import argparse
import argcomplete
import json
import logging
import sys
Expand Down Expand Up @@ -277,6 +279,8 @@ def run(self):
'Required when querying a Windows Server 2025'
'domain controller with LDAPS enforced.')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)
Expand Down
5 changes: 5 additions & 0 deletions examples/GetNPUsers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -29,6 +30,7 @@
from __future__ import division
from __future__ import print_function
import argparse
import argcomplete
import datetime
import logging
import random
Expand Down Expand Up @@ -369,6 +371,8 @@ def request_multiple_TGTs(self, usernames):
'If ommited, the domain part (FQDN) '
'specified in the account parameter will be used')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
print("\nThere are a few modes for using this script")
Expand All @@ -383,6 +387,7 @@ def request_multiple_TGTs(self, usernames):
print("\n3. Request TGTs for all users")
print("\n\tGetNPUsers.py contoso.com/emily:password -request or GetNPUsers.py contoso.com/emily")
print("\n4. Request TGTs for users in a file")

print("\n\tGetNPUsers.py -no-pass -usersfile users.txt contoso.com/")
print("\nFor this operation you don\'t need credentials.")
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/GetUserSPNs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -33,6 +34,7 @@
from __future__ import division
from __future__ import print_function
import argparse
import argcomplete
import logging
import sys
from datetime import datetime
Expand Down Expand Up @@ -497,6 +499,8 @@ def request_multiple_TGSs(self, usernames):
'If ommited, the domain part (FQDN) '
'specified in the account parameter will be used')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
Expand Down
3 changes: 3 additions & 0 deletions examples/addcomputer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -39,6 +40,7 @@

import ldap3
import argparse
import argcomplete
import logging
import sys
import string
Expand Down Expand Up @@ -416,6 +418,7 @@ def run(self):
'Useful if you can\'t translate the FQDN.'
'specified in the account parameter will be used')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
Expand Down
4 changes: 4 additions & 0 deletions examples/atexec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -26,6 +27,7 @@
import string
import sys
import argparse
import argcomplete
import time
import random
import logging
Expand Down Expand Up @@ -271,6 +273,8 @@ def cmd_split(cmdline):
'If omitted it will use the domain part (FQDN) specified in the target parameter')
group.add_argument('-keytab', action="store", help='Read keys for SPN from keytab file')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/attrib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand All @@ -21,6 +22,7 @@
from __future__ import annotations
import sys
import argparse
import argcomplete
import logging
import ntpath
from dataclasses import dataclass
Expand Down Expand Up @@ -246,6 +248,8 @@ def main():
set_parser.add_argument('-p', '--pinned', dest='pinned', action='store_true', help="This attribute indicates user intent that the file or directory should be kept fully present locally even when not being actively accessed. This attribute is for use with hierarchical storage management software.")
set_parser.add_argument('-u', '--unpinned', dest='unpinned', action='store_true', help="This attribute indicates that the file or directory should not be kept fully present locally except when being actively accessed. This attribute is for use with hierarchical storage management software.")

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/badsuccessor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand All @@ -22,6 +23,7 @@
from __future__ import unicode_literals

import argparse
import argcomplete
import logging
import random
import string
Expand Down Expand Up @@ -698,6 +700,8 @@ def modify_dmsa(self, ldapConnection):
group.add_argument('-dc-host', action='store',metavar = "hostname", help='Hostname of the domain controller to use. If ommited, the domain part (FQDN) specified in the account parameter will be used')
group.add_argument('-dc-ip', action='store',metavar = "ip", help='IP of the domain controller to use. Useful if you can\'t translate the FQDN.')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/changepasswd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -119,6 +120,7 @@
#

import argparse
import argcomplete
import logging
import sys

Expand Down Expand Up @@ -819,6 +821,8 @@ def parse_args():
),
)

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/dacledit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand All @@ -19,6 +20,7 @@
#

import argparse
import argcomplete
import binascii
import codecs
import json
Expand Down Expand Up @@ -747,6 +749,8 @@ def parse_args():
dacl_parser.add_argument('-inheritance', action="store_true", help='Enable the inheritance in the ACE flag with CONTAINER_INHERIT_ACE and OBJECT_INHERIT_ACE. Useful when target is a Container or an OU, '
'ACE will be inherited by objects within the container/OU (except objects with adminCount=1)')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
Expand Down
4 changes: 4 additions & 0 deletions examples/dcomexec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -39,6 +40,7 @@
from __future__ import division
from __future__ import print_function
import argparse
import argcomplete
import cmd
import logging
import ntpath
Expand Down Expand Up @@ -590,6 +592,8 @@ def load_smbclient_auth_file(path):
"See smbclient man page's -A option.")
group.add_argument('-keytab', action="store", help='Read keys for SPN from keytab file')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)
Expand Down
3 changes: 3 additions & 0 deletions examples/describeTicket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand All @@ -21,6 +22,7 @@
import sys
import traceback
import argparse
import argcomplete
import datetime
import base64
from typing import Sequence
Expand Down Expand Up @@ -751,6 +753,7 @@ def parse_args():
'The information is encrypted using the AS reply key. Attack primitive known as UnPAC-the-Hash. (https://www.thehacker.recipes/ad/movement/kerberos/unpac-the-hash)'
credential_info.add_argument('--asrep-key', action="store", metavar="HEXKEY", help='AS reply key for PAC Credentials decryption')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv) == 1:
parser.print_help()
Expand Down
4 changes: 4 additions & 0 deletions examples/dpapi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand Down Expand Up @@ -39,6 +40,7 @@

import struct
import argparse
import argcomplete
import logging
import sys
from six import b
Expand Down Expand Up @@ -610,6 +612,8 @@ def run(self):
credhist.add_argument('-password', action='store', help='User\'s password')
credhist.add_argument('-entry', action='store', type=int, help='Entry index in CREDHIST')

argcomplete.autocomplete(parser, always_complete_options=False)

options = parser.parse_args()
# Init the example's logger theme
logger.init(options.ts, options.debug)
Expand Down
4 changes: 4 additions & 0 deletions examples/esentutl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# Impacket - Collection of Python classes for working with network protocols.
#
# Copyright Fortra, LLC and its affiliated companies
Expand All @@ -24,6 +25,7 @@
import sys
import logging
import argparse
import argcomplete

from impacket.examples import logger
from impacket import version
Expand Down Expand Up @@ -81,6 +83,8 @@ def main():
export_parser = subparsers.add_parser('export', help='dumps the catalog info for the DB')
export_parser.add_argument('-table', action='store', required=True, help='table to dump')

argcomplete.autocomplete(parser, always_complete_options=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)
Expand Down
Loading