mirror of https://github.com/n1nj4sec/pupy.git
fix shell_exec issue
This commit is contained in:
parent
5973a8d432
commit
895bfae82d
|
@ -6,8 +6,6 @@ import subprocess
|
|||
|
||||
def shell_exec(client, cmdline, shell=None):
|
||||
""" cmdline can be either a list of arguments or a string """
|
||||
if type(cmdline) is not list:
|
||||
cmdline=cmdline.split()
|
||||
res=""
|
||||
try:
|
||||
if client.is_android():
|
||||
|
@ -17,9 +15,9 @@ def shell_exec(client, cmdline, shell=None):
|
|||
res=client.conn.modules.subprocess.check_output(cmdline, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, shell=True, universal_newlines=True)
|
||||
else:
|
||||
if client.is_windows():
|
||||
command=[shell, '/c'] + cmdline
|
||||
command=[shell, '/c', cmdline]
|
||||
else:
|
||||
command=[shell, '-c'] + cmdline
|
||||
command=[shell, '-c', cmdline]
|
||||
res=client.conn.modules.subprocess.check_output(command, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, universal_newlines=True)
|
||||
except Exception as e:
|
||||
if hasattr(e,'output') and e.output:
|
||||
|
|
Loading…
Reference in New Issue