# -*- coding: utf-8 -*- # pack hashes with basewords matched by username, cmiyc 2019 # Field separator char is \x01 in output. # Basewords are wrapped into for --single=':=0#=m#DmD0M ... Q'. # Results are printed to stdout. # Warning: LOW QUALITY! # Copyright © 2016 Aleksey Cherepanov # Redistribution and use in source and binary forms, with or without # modification, are permitted. fsp = '\x01' border = '#' import sys if len(sys.argv) != 3: print >>sys.stderr, 'Usage: {} uncracked_hashes cracked_pairs'.format(sys.argv[0]) exit(1) uncracked_fname = sys.argv[1] cracks_fname = sys.argv[2] user_to_basewords_set = {} with open(cracks_fname, 'rb') as f: for l in f: l = l.rstrip('\r\n') u, c = l.split(':', 1) if u not in user_to_basewords_set: user_to_basewords_set[u] = set() user_to_basewords_set[u].add(c) with open(uncracked_fname, 'rb') as f: for l in f: l = l.rstrip('\r\n') u, h = l.split(':', 1) # CMIYC's -a, -b, -c suffixes u = u.rstrip('-abc') if u in user_to_basewords_set: for b in sorted(user_to_basewords_set[u]): print '{border}{baseword}{border}{fsp}{hash}'.format( border = border, fsp = fsp, baseword = b, hash = h)