-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspawn_scan.py
More file actions
40 lines (34 loc) · 1.11 KB
/
Copy pathspawn_scan.py
File metadata and controls
40 lines (34 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Spawn scan process detached from parent terminal."""
import subprocess
import sys
import os
import time
FOUNDRY_BIN = r"z:\Sentinal Engine\foundry-bin"
WORKING_DIR = r"z:\Sentinal Engine\sentinel-engine"
OUTPUT_FILE = r"z:\Sentinal Engine\sentinel-engine\ethernaut_v312_out.txt"
env = dict(os.environ)
if FOUNDRY_BIN not in env.get("PATH", ""):
env["PATH"] = env.get("PATH", "") + ";" + FOUNDRY_BIN
cmd = [
sys.executable,
r"z:\Sentinal Engine\sentinel-engine\orchestrator.py",
"--target", r"z:\Sentinal Engine\ethernaut\contracts\src\levels",
"--report",
"--project-name", "Ethernaut v3.1.2 Full Battery",
]
print(f"Spawning scan process...")
print(f"Output -> {OUTPUT_FILE}")
with open(OUTPUT_FILE, "w", encoding="utf-8") as out_fh:
proc = subprocess.Popen(
cmd,
cwd=WORKING_DIR,
env=env,
stdout=out_fh,
stderr=subprocess.STDOUT,
creationflags=getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0),
)
print(f"PID: {proc.pid}")
print(f"Waiting for completion...")
ret = proc.wait()
print(f"Exit code: {ret}")
print(f"Output written to: {OUTPUT_FILE}")