island: Don't use `shell=True` when running local monkey
This commit is contained in:
parent
f86bc7f943
commit
2485c85d59
|
@ -3,7 +3,6 @@ import os
|
||||||
import platform
|
import platform
|
||||||
import stat
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
import monkey_island.cc.environment.environment_singleton as env_singleton
|
import monkey_island.cc.environment.environment_singleton as env_singleton
|
||||||
|
@ -45,13 +44,11 @@ class RunLocalMonkeyService:
|
||||||
|
|
||||||
# run the monkey
|
# run the monkey
|
||||||
try:
|
try:
|
||||||
args = [
|
ip = local_ip_addresses()[0]
|
||||||
'"%s" m0nk3y -s %s:%s'
|
port = env_singleton.env.get_island_port()
|
||||||
% (dest_path, local_ip_addresses()[0], env_singleton.env.get_island_port())
|
|
||||||
]
|
args = [dest_path, "m0nk3y", "-s", f"{ip}:{port}"]
|
||||||
if sys.platform == "win32":
|
subprocess.Popen(args, cwd=RunLocalMonkeyService.DATA_DIR)
|
||||||
args = "".join(args)
|
|
||||||
subprocess.Popen(args, cwd=RunLocalMonkeyService.DATA_DIR, shell=True).pid
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error("popen failed", exc_info=True)
|
logger.error("popen failed", exc_info=True)
|
||||||
return False, "popen failed: %s" % exc
|
return False, "popen failed: %s" % exc
|
||||||
|
|
Loading…
Reference in New Issue