SHARE
TWEET

RadiusWPE2John

winfang Jan 24th, 2012 815 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. ###############################################################################
  4. # Free Radius WPE log file convertor to John The Ripper formatted file for
  5. # password cracking.  Use the following format for John:
  6. # ./john --format=NETNTLM freeradius.john
  7. #
  8. # 12/19/2011 - Josh Kelley
  9. ###############################################################################
  10.  
  11. import sys
  12.  
  13. if len(sys.argv) < 2:
  14.         print "Please feed me the path to the Free Radius WPE log file"
  15.         exit()
  16.  
  17. fileIn = open(sys.argv[1],'r')
  18. fileOut = open('freeradius.john','w')
  19.  
  20. i = 0
  21. for line in fileIn:
  22.         lineClean = line.strip()
  23.         lineSplit = lineClean.split(':')
  24.         if lineSplit[0] == "mschap":
  25.                 i = i + 1
  26.         if lineSplit[0] == "username":
  27.                 username = lineSplit[1].strip()
  28.                 i = i + 1
  29.         if lineSplit[0] == "challenge":
  30.                 challenge = ""
  31.                 for x in lineSplit[1:]:
  32.                         challenge = challenge + x
  33.                 challenge = challenge.strip()
  34.                 i = i + 1
  35.         if lineSplit[0] == "response":
  36.                 response = ""
  37.                 for x in lineSplit[1:]:        
  38.                         response = response + x
  39.                 response = response.strip()
  40.                 i = i + 1
  41.         if i == 4:
  42.                 lineNew = "%s:$NETNTLM$%s$%s" % (username, challenge, response)
  43.                 fileOut.write("%s\n" % lineNew.strip('\n'))
  44.                 i = 0
  45. fileIn.close()
  46. fileOut.close()
RAW Paste Data
Top