diff --git a/pypykatz/smb/dcsync.py b/pypykatz/smb/dcsync.py index 7583988..f0b69d4 100644 --- a/pypykatz/smb/dcsync.py +++ b/pypykatz/smb/dcsync.py @@ -2,10 +2,10 @@ from pypykatz import logger async def dcsync(url, username = None): - from aiosmb.commons.connection.url import SMBConnectionURL + from aiosmb.commons.connection.factory import SMBConnectionFactory from aiosmb.commons.interfaces.machine import SMBMachine - smburl = SMBConnectionURL(url) + smburl = SMBConnectionFactory.from_url(url) connection = smburl.get_connection() users = [] diff --git a/pypykatz/smb/lsassutils.py b/pypykatz/smb/lsassutils.py index fca82c0..aa33f11 100644 --- a/pypykatz/smb/lsassutils.py +++ b/pypykatz/smb/lsassutils.py @@ -23,11 +23,11 @@ def natatime(n, iterable, fillvalue = None): from pypykatz import logger async def lsassfile(url, packages = ['all'], chunksize = 64*1024): - from aiosmb.commons.connection.url import SMBConnectionURL + from aiosmb.commons.connection.factory import SMBConnectionFactory from pypykatz.alsadecryptor.asbmfile import SMBFileReader from pypykatz.apypykatz import apypykatz - smburl = SMBConnectionURL(url) + smburl = SMBConnectionFactory.from_url(url) connection = smburl.get_connection() smbfile = smburl.get_file() @@ -49,9 +49,8 @@ async def lsassfile(url, packages = ['all'], chunksize = 64*1024): logger.debug('[LSASSFILE] LSASS file parsed OK!') return mimi -async def lsassdump(url, method = 'task', remote_base_path = 'C:\\Windows\\Temp\\', remote_share_name = '\\c$\\Windows\\Temp\\',chunksize = 64*1024, packages = ['all'], targets = [], worker_cnt = 5): - from aiosmb.commons.connection.url import SMBConnectionURL - +async def lsassdump(url, method = 'task', remote_base_path = 'C:\\Windows\\Temp\\', remote_share_name = '\\c$\\Windows\\Temp\\',chunksize = 64*1024, packages = ['all'], targets = [], worker_cnt = 5): + from aiosmb.commons.connection.factory import SMBConnectionFactory base_url = None base_conn = None mimis = [] @@ -72,11 +71,11 @@ async def lsassdump(url, method = 'task', remote_base_path = 'C:\\Windows\\Temp\ if len(notfile) > 0: tgens.append(ListTargetGen(notfile)) - if isinstance(url, SMBConnectionURL): + if isinstance(url, SMBConnectionFactory): base_url = url base_conn = url.get_connection() else: - base_url = SMBConnectionURL(url) + base_url = SMBConnectionFactory.from_url(url) base_conn = base_url.get_connection() lsassdump_coro = lsassdump_single( diff --git a/pypykatz/smb/printer.py b/pypykatz/smb/printer.py index 4067893..f2952b1 100644 --- a/pypykatz/smb/printer.py +++ b/pypykatz/smb/printer.py @@ -5,10 +5,10 @@ async def printnightmare(url, dll_path, driverpath = None): try: - from aiosmb.commons.connection.url import SMBConnectionURL + from aiosmb.commons.connection.factory import SMBConnectionFactory from aiosmb.commons.interfaces.machine import SMBMachine - smburl = SMBConnectionURL(url) + smburl = SMBConnectionFactory.from_url(url) connection = smburl.get_connection() async with connection: @@ -32,10 +32,10 @@ async def printnightmare(url, dll_path, driverpath = None): async def parprintnightmare(url, dll_path, driverpath = None): try: - from aiosmb.commons.connection.url import SMBConnectionURL + from aiosmb.commons.connection.factory import SMBConnectionFactory from aiosmb.commons.interfaces.machine import SMBMachine - smburl = SMBConnectionURL(url) + smburl = SMBConnectionFactory.from_url(url) connection = smburl.get_connection() async with connection: diff --git a/pypykatz/smb/regutils.py b/pypykatz/smb/regutils.py index 8202e53..4ef44f9 100644 --- a/pypykatz/smb/regutils.py +++ b/pypykatz/smb/regutils.py @@ -7,7 +7,7 @@ async def regdump(url, hives = ['HKLM\\SAM', 'HKLM\\SYSTEM', 'HKLM\\SECURITY'], remote_base_path = 'C:\\Windows\\Temp\\', remote_share_name = '\\c$\\Windows\\Temp\\', enable_wait = 3, targets = [], worker_cnt = 5): - from aiosmb.commons.connection.url import SMBConnectionURL + from aiosmb.commons.connection.factory import SMBConnectionFactory base_url = None base_conn = None @@ -29,11 +29,11 @@ async def regdump(url, hives = ['HKLM\\SAM', 'HKLM\\SYSTEM', 'HKLM\\SECURITY'], if len(notfile) > 0: tgens.append(ListTargetGen(notfile)) - if isinstance(url, SMBConnectionURL): + if isinstance(url, SMBConnectionFactory): base_url = url base_conn = url.get_connection() else: - base_url = SMBConnectionURL(url) + base_url = SMBConnectionFactory.from_url(url) base_conn = base_url.get_connection() regdump_coro = regdump_single( @@ -173,12 +173,12 @@ async def regdump_single(targetid, connection, hives = ['HKLM\\SAM', 'HKLM\\SYST async def regfile(url, system, sam = None, security = None, software = None, smb_basepath = None): - from aiosmb.commons.connection.url import SMBConnectionURL + from aiosmb.commons.connection.factory import SMBConnectionFactory from aiosmb.commons.interfaces.file import SMBFile from pypykatz.alsadecryptor.asbmfile import SMBFileReader from pypykatz.registry.aoffline_parser import OffineRegistry - smburl = SMBConnectionURL(url) + smburl = SMBConnectionFactory.from_url(url) connection = smburl.get_connection() if smb_basepath is None: diff --git a/pypykatz/smb/shareenum.py b/pypykatz/smb/shareenum.py index a7d618a..1c1bae5 100644 --- a/pypykatz/smb/shareenum.py +++ b/pypykatz/smb/shareenum.py @@ -51,14 +51,7 @@ async def generate(self): async def shareenum(smb_url, ldap_url = None, targets = None, smb_worker_count = 10, depth = 3, out_file = None, progress = False, max_items = None, dirsd = False, filesd = False, authmethod = 'ntlm', protocol_version = '2', output_type = 'str', max_runtime = None, exclude_share = ['print$'], exclude_dir = [], exclude_target = []): - from aiosmb.commons.connection.url import SMBConnectionURL - from pypykatz.alsadecryptor.asbmfile import SMBFileReader - from pypykatz.apypykatz import apypykatz - - #if targets is None and ldap_url is None: - # raise Exception('Shareenum needs a list of targets or LDAP connection string') - if smb_url == 'auto': smb_url = get_smb_url(authmethod=authmethod, protocol_version=protocol_version)