How to add/wait for user input?
Can't solve how to add or wait for user input and then process this input
for that script.
I am asking for help because I want to convert this program with py2exe.
Right now, I have to launch the program with:
python wifi.py f09j8h
I want to have Internet wherever I am, so the program must work with
Windows without requiring Python to be installed.
Also, how do you limit the input to 6 characters as well as catch if any
special characters were inserted?
import sys
import hashlib
ssid_end = sys.argv[1].lower()
offset = 40-(len(ssid_end))
charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
year_list = [2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016]
def ascii2hex(char):
return hex(ord(char))[2:]
print 'Possible keys for SSID ending %s:' % ssid_end.upper()
count = 0
for year in [y-2000 for y in year_list]:
for week in range(1,53): #1..52
#print 'Trying year 200%d week %d' % (year,week)
for char1 in charset:
for char2 in charset:
for char3 in charset:
sn = 'CP%02d%02d%s%s%s' %
(year,week,ascii2hex(char1),ascii2hex(char2),ascii2hex(char3))
hash =
hashlib.sha1(sn.upper()).hexdigest()
if hash[offset:] == ssid_end:
print hash[0:10].upper()
count += 1;
print 'Done. %d possible keys found.' % count
No comments:
Post a Comment