Advertisement
Guest User

helpsam

a guest
Nov 29th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. def compare_bad_hashes(page):
  2. print '[*] compare_bad_hashes'
  3. directory = 'C:\\temp\\pythonfiles\\'
  4. badfiles = {'9d377b10ce778c4938b3c7e2c63a229a':'contraband_file1.jpg',
  5. '6bbaa34b19edd6c6fa06cccf29b33125':'contraband_file2.jpg',
  6. 'e4e7c3451a35944ca8697f9f2ac037f1':'contraband_file3.jpg',
  7. '1d6d9c72e3476d336e657b50a77aee05':'contraband_file4.gif'}
  8.  
  9. for filename in os.listdir(directory):
  10. fh = open(os.path.join(directory,filename), 'r')
  11. file_content = fh.read()
  12. hashmatch = hashlib.md5(file_content)
  13. md5hash = hashmatch.hexdigest()
  14. print md5hash
  15. for compare in badfiles:
  16. if md5hash == compare:
  17. print '[+] Badfile recovered: %s'% (compare)
  18. else:
  19. print '[-] Badfile not recovered'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement