-
Notifications
You must be signed in to change notification settings - Fork 0
/
pwn.py
executable file
·67 lines (57 loc) · 1.95 KB
/
pwn.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/python
import subprocess
import re
from time import sleep
import Adafruit_CharLCD as LCD
# Initialize the LCD using the pins
lcd = LCD.Adafruit_CharLCDPlate()
# function to switch through menu items on LCD
def menuSwitcher ( menuItems ):
indexCounter = 0
indexEnd = len(menuItems) - 1
lcd.clear()
# show first entry
lcd.message(str(indexCounter) + ". " + menuItems[indexCounter][0] + "\n" + menuItems[indexCounter][1])
while True:
if (lcd.is_pressed(LCD.RIGHT)):
lcd.clear()
indexCounter += 1
if indexCounter > indexEnd:
indexCounter = 0
lcd.message(str(indexCounter) + ". " + menuItems[indexCounter][0] + "\n" + menuItems[indexCounter][1])
sleep(0.5)
elif (lcd.is_pressed(LCD.LEFT)):
lcd.clear()
indexCounter -= 1
if indexCounter == 0:
indexCounter = indexEnd
lcd.message(str(indexCounter) + ". " + menuItems[indexCounter][0] + "\n" + menuItems[indexCounter][1])
sleep(0.5)
elif (lcd.is_pressed(LCD.SELECT)):
lcd.clear()
break
return menuItems[indexCounter][0], menuItems[indexCounter][1]
# set wifi interface
wif = "wlan0"
# turn lcd back on
lcd.message("Search for WiFis")
lcd.enable_display(True)
lcd.set_backlight(1)
# check for WiFis nearby
wifi_out = subprocess.Popen(["iwlist", wif, "scan"],stdout=subprocess.PIPE)
#wifi_out = subprocess.Popen(["cat", "iwlist"],stdout=subprocess.PIPE)
wifi_data = iter(wifi_out.stdout.readline,'')
wifi = []
# go through the list to display them
for line in wifi_data:
searchObj = re.search( r'.* Cell [0-9][0-9] - Address: .*', line, re.M|re.I)
if searchObj:
word = line.split()
nexthing = next(wifi_data).split('"')
wifi.append((nexthing[1],word[4]))
sleep(1)
wifitoHack = menuSwitcher(wifi)
print wifitoHack[0]
print wifitoHack[1]
lcd.set_backlight(0)
lcd.backlight(lcd.OFF)