Last active
August 29, 2015 14:18
-
-
Save jantore/8d7504c572003c2a591b to your computer and use it in GitHub Desktop.
AirLink 89300 AutoWPA PSK generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, re | |
if len(sys.argv) != 2: | |
sys.exit("Usage: {0} <MAC address>".format(sys.argv[0])) | |
mac = bytearray(sys.argv[1].lower().translate(None, '-:')) | |
# straight from /bin/AutoWPA | |
alphabet = bytearray("2345679abcdefghjklmnopqrstuvwxyzACDEFGHIJKLMNPQRSTUVWXYZ") | |
# kinda, sorta emulate atol(3) | |
l = 0 | |
match = re.search('^(\d+)', mac[6:]) | |
if match: | |
l = match.group(0) | |
wpa = ( | |
((l + mac[11] + mac[ 5]) * (mac[ 9] + mac[ 3] + mac[11])), | |
((l + mac[11] + mac[ 6]) * (mac[ 8] + mac[10] + mac[11])), | |
((l + mac[ 3] + mac[ 5]) * (mac[ 7] + mac[ 9] + mac[11])), | |
((l + mac[ 6] + mac[ 7]) * (mac[11] + mac[ 4] + mac[ 5])), | |
((l + mac[ 6] + mac[ 7]) * (mac[ 8] + mac[ 9] + mac[11])), | |
((l + mac[ 5] + mac[11]) * (mac[11] + mac[ 3] + mac[ 4])), | |
((l + mac[ 4] + mac[11]) * (mac[11] + mac[ 6] + mac[ 8])), | |
((l + mac[10] + mac[11]) * (mac[11] + mac[ 7] + mac[ 8])) | |
) | |
print bytearray(map(lambda x:alphabet[x % 56], wpa)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment