Closed yanzifan021 closed 6 months ago
I think axiom-scan will read stdin for the sake of resume scan if ctrl +c, which makes the process hang, after i run process = subprocess.Popen(cmd.split(' '), shell=False,stdin=open(os.devnull), preexec_fn=os.setsid)
, it is solved.
reference: https://stackoverflow.com/questions/33277452/prevent-unexpected-stdin-reads-and-lock-in-subprocess
Hi guys, I am using subprocess to automate axiom-scan. It is fine when i run it directly through
python3 automation.py
. However, when i run it with 'nohup python3 automation.py &'. After it output to nabuu_result.txt, the axiom-scan process didnt stop and hang there(tested by running pgrep -af "axiom-scan", and i can see the proecss). the code is below ` import subprocess import sys import config import os current_dir = os.path.dirname(os.path.abspath(file)) from utilities import mysqldb,common_function,discordBot import loggingenv_copy = os.environ.copy() current_path = env_copy['PATH'] env_copy["PATH"] = os.pathsep.join([ config.GOBIN, # go bin path current_path, config.AXIOM_PATH # axiom path ])
cmd = f"axiom-scan {current_dir}/subdomains.txt -m naabu -c 10000 -j -o {current_dir}/nabuu_result.txt --fleet scanist"
process = subprocess.Popen(cmd.split(' '), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE,env=env_copy) stdout, stderr = process.communicate() ` Thanks in advance for the help. I am sorry if i asked in the wrong place.
command I used to run the script
nohup python3 automation.py &