Created
May 6, 2012 20:27
-
-
Save bensonk/2624224 to your computer and use it in GitHub Desktop.
This file contains 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 re | |
parser = re.compile(r'(.*?);(.*?);(.{3});(.*?);(.*?);') | |
def parse_line(l): | |
res = parser.match(l) | |
if res: | |
values = res.groups() | |
credential = {} | |
credential['username'] = values[0] | |
credential['hash'] = values[1] | |
credential['salt'] = values[2] | |
credential['email'] = values[3] | |
credential['ip_addr'] = values[4] | |
return credential | |
else: | |
return None | |
if __name__ == "__main__": | |
from pprint import pprint | |
from sys import argv | |
for fname in argv[1:]: | |
for credential in filter(lambda x: x, ( parse_line(l) for l in open(fname) )): | |
pprint(credential) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment