I have this little script that puts your wireless device in monitoring mode. It performs an airodump scan, and then after the scan is complete, it outputs the output to a .txt file or variable, so I can clear the BSSID and any other information that I may need.
I feel that I did not understand the concept or the difference between subprocess.call()and subprocess.Popen().
This is what I have:
def setup_device():
try:
output = open("file.txt", "w")
put_device_down = subprocess.call(["ifconfig", "wlan0", "down"])
put_device_mon = subprocess.call(["iwconfig", "wlan0", "mode", "monitor"])
put_device_up = subprocess.call(["iwconfig", "wlano", "up"])
start_device = subprocess.call(["airmon-ng", "start", "wlan0"])
scanned_networks = subprocess.Popen(["airodump-ng", "wlan0"], stdout = output)
time.sleep(10)
scanned_networks.terminate()
except Exception, e:
print "Error:", e
I still don’t know where and when and how to use subprocess.call()andsubprocess.Popen()
What, in my opinion, confuses me more is the arguments stdoutand stderr. What is PIPE?
Another thing that I could fix as soon as I get a better understanding:
running subprocess.Popen() airodump , . ?