fix new transports import in windows payloads

This commit is contained in:
n1nj4sec 2016-06-17 19:56:29 +02:00
parent 63800eddd6
commit ea7879ad6d
2 changed files with 17 additions and 16 deletions

View File

@ -30,7 +30,7 @@ else:
all_dependencies=list(set([x.split(".")[0] for x in sys.modules.iterkeys()])) 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)) all_dependencies=list(set(all_dependencies))
zf = zipfile.ZipFile(os.path.join("sources","resources","library%s.zip"%arch), mode='w', compression=zipfile.ZIP_DEFLATED) zf = zipfile.ZipFile(os.path.join("sources","resources","library%s.zip"%arch), mode='w', compression=zipfile.ZIP_DEFLATED)

View File

@ -26,23 +26,24 @@ def add_transport(module_name):
except Exception as e: except Exception as e:
logging.warning("Could not load transport %s : %s. Transport disabled"%(module_name,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) #importing from memory (used by payloads)
try: try:
import pupyimporter import pupyimporter
import network.transports import network.transports
for path in [x for x in pupyimporter.modules.iterkeys() if x.startswith("network/transports/") and x.endswith("/conf.py")]: for path in [x for x in pupyimporter.modules.iterkeys() if x.startswith("network/transports/") and x.endswith(("/conf.py","/conf.pyc"))]:
try: try:
module_name=path.rsplit('/',2)[1] 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__):
add_transport(module_name) 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["connect"]=ConnectLauncher
launchers["auto_proxy"]=AutoProxyLauncher launchers["auto_proxy"]=AutoProxyLauncher