Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title: Enhance Command-Line Argument Handling for Mimikatz RPC Script with Custom GUID #1802

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
10 changes: 10 additions & 0 deletions examples/mimikatz.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def main():
parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>')
parser.add_argument('-file', type=argparse.FileType('r'), help='input file with commands to execute in the mini shell')
parser.add_argument('-debug', action='store_true', help='Turn DEBUG output ON')
parser.add_argument('-guid', help='Custom GUID for RPC interface. This GUID should be same as mimikatz '
'rpc::server GUID, if omitted, the default UUID will be used')

group = parser.add_argument_group('authentication')

Expand Down Expand Up @@ -177,6 +179,14 @@ def main():
lmhash = ''
nthash = ''

# Use the provided GUID or fall back to the default
if options.guid:
print(f"Custom GUID provided: {options.guid}")
mimilib.set_msrpc_uuid(options.guid)
else:
print("No custom GUID provided, using default UUID.")
mimilib.set_msrpc_uuid()

bound = False

try:
Expand Down
12 changes: 11 additions & 1 deletion impacket/dcerpc/v5/mimilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@
from impacket.uuid import uuidtup_to_bin
from impacket.structure import Structure

MSRPC_UUID_MIMIKATZ = uuidtup_to_bin(('17FC11E9-C258-4B8D-8D07-2F4125156244', '1.0'))

# Define the default RPC server interface used by mimikatz
DEFAULT_UUID = uuidtup_to_bin(('17FC11E9-C258-4B8D-8D07-2F4125156244', '1.0'))

# function to set msrpc uuid
def set_msrpc_uuid(custom_guid=None):
global MSRPC_UUID_MIMIKATZ
if custom_guid is not None:
MSRPC_UUID_MIMIKATZ = uuidtup_to_bin((custom_guid, '1.0'))
else:
MSRPC_UUID_MIMIKATZ = DEFAULT_UUID

class DCERPCSessionError(DCERPCException):
def __init__(self, error_string=None, error_code=None, packet=None):
Expand Down