I want to use mitmproxy to capture my emulator's flow. My idea is using
proc = subprocess.Poen('mitmproxy -T -w emulator.log', shell=True)
to start mitmproxy as a parallel process and using kill pid
to stop mitmproxy.
But prco.pid
shows thay prco
is a new shell, mitmproxy is subprocess of proc
.
os.killpg(pid, signal.SIGKILL)
can't kill process in diffferent shell;
os.getpid
get current shell's pid;
subprocess.Popen(str('kill ',proc.pid), shell=True)
can't kill mitmproxy.
So, how can I kill mitmproxy which was called python script? Or other method to capture my emulator's flow by mitmproxy.