Finding all the collisions for a given hash
#4
I made a python script to do the work.

Code:
import re
import subprocess
import math
import os

with open('hashes.txt','r') as f:
   hashes=f.readlines()
   hashes=list(map(str.strip,hashes))


def status(hash):
   with open(hash[:8]+'.txt','r')as f:
       lines=f.readlines()
   for line in lines:
       if re.match('Status\.\.\.\.\.\.\.\.\.: \w*',line):
           s=re.match('Status\.\.\.\.\.\.\.\.\.: \w*',line).group()
           break
   print s[17:]
   if s[17:]=='Exhausted':
       return 0
   else:
       return 1

def offset(hash):
   keyspace=int(subprocess.check_output(['hashcat64.exe', '-a' ,'3' ,'-m' ,'11500','--keyspace','?a?a?a?a?a']))
   print int(keyspace)
   with open(hash[:8]+'.txt','r')as f:
       lines=f.readlines()
   for line in lines:
       if re.match('Progress\.\.\.\.\.\.\.:.*',line):
           progress=re.match('Progress\.\.\.\.\.\.\.: .*',line).group()
           progress=float(progress[-8:].strip(' ()%'))/100
           break
   print progress
   off=int(math.ceil(progress*keyspace))
   return off
def cracks(hash):
   with open(hash[:8]+'.txt','r')as f:
       lines=f.readlines()
   for line in lines:
       if re.search(re.escape(hash)+'.*',line):
           crack=re.search(re.escape(hash)+'.*',line).group()
           break
   return crack

def main():
   for hash in hashes:
       print hash
       f1=open(hash[:8]+' cracked.txt','a')
       subprocess.call(['hashcat64.exe', '-a' ,'3' ,'-m' ,'11500',hash, '?a?a?a?a?a' ,'--potfile-disable'],stdout=open(str(hash[:8])+'.txt','w'))
       f1.write(cracks(hash)+'\n')
       while (status(hash)):
           off=offset(hash)
           print(off)
           subprocess.call(['hashcat64.exe', '-a' ,'3' ,'-m' ,'11500','-s',str(off),hash, '?a?a?a?a?a' ,'--potfile-disable'],stdout=open(str(hash[:8])+'.txt','w'))
           try:
               f1.writelines(cracks(hash)+'\n')
           except:
               print 'Exhausted'
       os.remove(str(hash[:8])+'.txt')

if __name__ == '__main__':
   main()    


Messages In This Thread
RE: Finding all the collisions for a given hash - by jj - 09-11-2016, 01:29 PM