-
Notifications
You must be signed in to change notification settings - Fork 0
/
Aggressive.py
45 lines (33 loc) · 1.07 KB
/
Aggressive.py
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
41
42
43
44
45
import subprocess, os, sys, time
from datetime import datetime
script_name = sys.argv[0]
# duration
Nseconds = 3600*2
# create a unique file prefix for this experiment
date_prefix = datetime.now().strftime('%Y-%m-%d_%H-%m')
# create a dir for this experiment
wifi = "/wifi/"+date_prefix
import socket
hostname = socket.gethostname()
file_prefix = hostname+'_'+date_prefix
print wifi
print ["mkdir","-p",wifi]
subprocess.call(["mkdir","-p",wifi])
print("[%s] About to put card in monitor mode."%(script_name) )
subprocess.call(['ifconfig','wlan0','down'])
subprocess.call(['iwconfig','wlan0','mode','monitor'])
subprocess.call(['ifconfig','wlan0','up'])
print "Done."
# construct the airodump command and pipe all its output to /dev/null so it doesn't blow up the syslog
FNULL = open(os.devnull,'w')
the_cmd = ['besside-ng','wlan0','-W']
# call it
p = subprocess.Popen(the_cmd, cwd=wifi)
#p = subprocess.Popen(the_cmd,
# stdout=FNULL, stderr=subprocess.STDOUT,
# cwd=wifi)
# wait for it
time.sleep(Nseconds)
# aaaaand bail
p.kill()
print("[%s] Success!"%(script_name) )