0

I try to run Airodump-ng Wlan0mon in python code using Threading or Multiprocess but i can't kill the process i try all solution in this site but it not work my code is

def RubAirdump():
 try:
     def ai():
      global Airdump
      Airdump = subprocess.Popen(["airodump-ng {}".format(CheckModeMonter())], stdout=subprocess.PIPE, stderr=subprocess.PIPE,shell=True,preexec_fn=os.setsid())
     airo1 = threading.Thread(target=ai)
     airo1.start()
     time.sleep(5)
     print(Airdump.stdout.read().decode("utf-8"))
 except Exception as EXC3:
     print("[-] There is some Error that say", EXC3)
     sys.exit()

i'm trying to use (os.kill) and (os.killpg) but its not work all i wan't is to make airodump run for 5 or 10 second then stop get the result printed and returned by this fuction

checkModeMonter() is returned to me wlan0mon

I want any way to do this ,, thanks

Kamal Samir
  • 71
  • 1
  • 11

1 Answers1

0

it is solved by using communicate(timeout=5)

Kamal Samir
  • 71
  • 1
  • 11
  • 1
    Great work solving your problem. Please consider elaborating more on the problem and solution in your answer to help others who come across it. – sytech Mar 22 '18 at 08:27