Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def compare_bad_hashes(page):
- print '[*] compare_bad_hashes'
- directory = 'C:\\temp\\pythonfiles\\'
- badfiles = {'9d377b10ce778c4938b3c7e2c63a229a':'contraband_file1.jpg',
- '6bbaa34b19edd6c6fa06cccf29b33125':'contraband_file2.jpg',
- 'e4e7c3451a35944ca8697f9f2ac037f1':'contraband_file3.jpg',
- '1d6d9c72e3476d336e657b50a77aee05':'contraband_file4.gif'}
- for filename in os.listdir(directory):
- fh = open(os.path.join(directory,filename), 'r')
- file_content = fh.read()
- hashmatch = hashlib.md5(file_content)
- md5hash = hashmatch.hexdigest()
- print md5hash
- for compare in badfiles:
- if md5hash == compare:
- print '[+] Badfile recovered: %s'% (compare)
- else:
- print '[-] Badfile not recovered'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement