Commit b1b4b486 authored by root's avatar root

fucking state machine

parent a0177509
......@@ -108,6 +108,40 @@ def start_wpa(interface):
kill_proc("wpa_supplicant", interface)
sh("/sbin/wpa_supplicant -s -B -P /run/wpa_supplicant."+interface+".pid -i wlan0 -D nl80211,wext -C /run/wpa_supplicant")
def show_fuck_list(nets):
print('\nHere it is your fucking networks...:\n')
i=0
netind={}
for net in nets.keys():
netconf=""
sig=nets[net]['Signal Level']
qual=nets[net]['Quality']
enc='Open'
if 'Encryption' in nets[net].keys():
enc=nets[net]['Encryption']
freq=nets[net]['Frequency']
nconf = read_netconf(net)
if nconf['saved']:
nauto = 'NO'
if nconf['auto']:
nauto = 'YES'
netconf="AUTO: "+nauto+", PRIO: "+str(nconf['prio'])
print(" "+str(i)+": "+colors.BLUE+net+colors.ENDC+" ("+sigcol(qual)+"sig: "+sig+", qual: "+qual+", freq: "+freq+", enc: "+enc+colors.ENDC+") "+netconf)
netind[str(i)] = nets[net]
i=i+1
return netind
def nofuck(fuck):
if not fuck or fuck!='none':
print("\n "+colors.RED+"FUCK YOU! MAKE A FUCKING CHOICE!"+colors.ENDC)
def fuckquit(fuck):
if fuck.lower()=='q':
print(colors.RED+"\n I'M FUCKING KILLING MYSELF!\n"+colors.ENDC)
sys.exit(0)
if len(sys.argv) > 1 and sys.argv[1] == 'boot':
print(' * start to fucking with your wireless... ')
boot=True
......@@ -156,49 +190,58 @@ else:
print("fucking wpa_supplicant for "+interface+" already fucked but still down, refucking it")
start_wpa(interface)
# detect all networks...
netw = iw_parse.get_interfaces(interface="wlan0")
i=1
nets={}
for net in netw:
if 'Mode' in net.keys() and net['Mode'] == 'Master':
if 'Name' in net.keys() and net['Name']:
nets[net['Name']] = net
else:
name='NoEssid_'+str(i)
i=i+1
nets[name] = net
def show_fuck_list(nets):
print('\nHere it is your fucking networks...:\n')
i=0
netind={}
for net in nets.keys():
netconf=""
sig=nets[net]['Signal Level']
qual=nets[net]['Quality']
enc='Open'
if 'Encryption' in nets[net].keys():
enc=nets[net]['Encryption']
freq=nets[net]['Frequency']
nconf = read_netconf(net)
if nconf['saved']:
nauto = 'NO'
if nconf['auto']:
nauto = 'YES'
netconf="AUTO: "+nauto+", PRIO: "+str(nconf['prio'])
print(" "+str(i)+": "+colors.BLUE+net+colors.ENDC+" ("+sigcol(qual)+"sig: "+sig+", qual: "+qual+", freq: "+freq+", enc: "+enc+colors.ENDC+") "+netconf)
netind[str(i)] = nets[net]
i=i+1
return netind
netind = {}
fuck = "none"
while fuck not in netind.keys() and fuck.lower() not in ['e', 'R', 'q']:
netind = show_fuck_list(nets)
fuck = input("\n Choose a fucking one by index, or press E for edit, R to remove, Q to shit the hell out: ")
SM="init"
EXIT=False
while not EXIT:
if SM=="init":
SM="detect"
nets={}
elif SM=="detect":
# detect all networks...
print(colors.GREEN+"\n LET'S FUCKING SCAN AND SEE WHO IS AROUND... \n"+colors.ENDC)
netw = iw_parse.get_interfaces(interface="wlan0")
i=1
nets={}
for net in netw:
if 'Mode' in net.keys() and net['Mode'] == 'Master':
if 'Name' in net.keys() and net['Name']:
nets[net['Name']] = net
else:
name='NoEssid_'+str(i)
i=i+1
nets[name] = net
SM="main"
elif SM=="main":
netind = {}
fuck = "none"
while fuck not in netind.keys() and fuck.lower() not in ['e', 'r', 'q','s']:
nofuck(fuck)
netind = show_fuck_list(nets)
fuck = input("\n Choose a fucking one by index, or press E for edit, R to remove, S tore-scan, Q to shit the hell out: ")
fuckquit(fuck)
if fuck.lower()=='r':
SM="remove"
elif fuck.lower()=='s':
SM="detect"
elif SM=="remove":
print("\n FOR FUCK SAKE, are you too lazy to do a rm by hand in "+NETPATH+"?\n")
netind = {}
fuck = "none"
while fuck not in netind.keys() and fuck.lower() not in ['b', 'q']:
nofuck(fuck)
netind = show_fuck_list(nets)
fuck = input("\n Choose a fucking one by index, or press B for back, Q do shit the hell out: ")
fuckquit(fuck)
if fuck.lower()=='b':
SM="main"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment