def crack(hash): print (logo) print ('[*] Pattern SHA1 Hash : %s\n' % hash.upper()) # make it as fast as possible # pattern -> 1234 -> 01020304 -> \x01\x02\x03\x04 then sha1 hash for i in range(4, 10): permutations = itertools.permutations(x_list, i) perm_list = map(''.join, permutations) for j in perm_list: sha_hash = sha(j.encode('utf-8')).hexdigest() if hash == sha_hash: p = hexlify(j.encode('utf-8')).decode('utf-8') pt = ''.join([p[o] for o in range(1, len(p), 2)]) print ('[+] Pattern Length \t: %s\n' % len(pt)) print ('[+] Pattern \t\t: %s\n' % pt) patt = svg.draw(pt) sv = open('%s.svg' % pt, 'wb') sv.write(patt.encode('utf-8')) sv.close() print ('[+] Pattern SVG\t\t: %s.svg\n' % pt) print ('[*] Time \t\t: %s sec' % round(time.time() - now, 2)) exit() print ('[-] Pattern not found !')
#!/usr/bin/env python #def stepx(r, x, count): # for i in range(count): # x = r * x * (1 - x) # return x def everything(rs, xs, count): for r in rs: for x in xs: #x = stepx(r, x, count) for i in range(count): x = r * x * (1 - x) yield (r, x) if __name__ == "__main__": import random rs = [2 + 2 * random.random() for i in range(500)] xs = [random.random() for i in range(200)] import svg import time started = time.time() with open("test.svg", "w") as fout: for line in svg.draw(everything(sorted(rs), sorted(xs), 2000)): print >> fout, line print "steps/s", 500 * 200 * 2000 / (time.time() - started)
#!/usr/bin/env python import cyt if __name__ == "__main__": import random rs = [2 + 2 * random.random() for i in range(500)] xs = [random.random() for i in range(200)] import svg import time started = time.time() with open("test.svg", "w") as fout: for line in svg.draw(cyt.everything(sorted(rs), sorted(xs), 2000)): print >> fout, line print "steps/s", 500 * 200 * 2000 / (time.time() - started)
print(logo) print ("[-] empty file or it's too large") exit() crack(hash.decode('utf-8')) elif sys.argv[1] == '-p': hash = sys.argv[2] hash = hash.lower() if hash.isupper() else hash crack(hash) elif sys.argv[1] == '-g': print (logo) pat = sys.argv[2] try: gt = ''.join([chr(int(i)) for i in pat]) patt = svg.draw(pat) sv = open('%s.svg' % pat, 'wb') sv.write(patt.encode('utf-8')) sv.close() print ('[+] Pattern SVG\t\t: %s.svg\n' % pat) output = open('gesture.key', 'wb') output.write(sha(gt.encode('utf-8')).digest()) output.close() print ('[+] Pattern file\t: gesture.key') except: print('[-] Pattern must be valid number from 0-8 see info.svg\n') print( '[!] if you want to make pattern like letter M ' 'the pattern will be "6304258"') else: exit()