Skip to content

Instantly share code, notes, and snippets.

@casprwang
Created April 13, 2017 23:54
Show Gist options
  • Save casprwang/1cf5e2dcd63515d60952e5d34ff4de4d to your computer and use it in GitHub Desktop.
Save casprwang/1cf5e2dcd63515d60952e5d34ff4de4d to your computer and use it in GitHub Desktop.
hash.py
# Please put the Hash fils and Malware folder in the same directory, and run with python3 filename
# by Singh Prabhjot && Song Wang
import hashlib
import os
import fileinput
hash_list = []
for line in fileinput.input(['Hash']):
if line != '\n':
hash_list.append(line[:-1])
# print ( hash_list )
BLOCKSIZE = 65536
hasher = hashlib.md5()
with open('./Malware/Android.Malware.at_plapk.a/com.fdhgkjhrtjkjbx.model.apk', 'rb') as afile:
buf = afile.read(BLOCKSIZE)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(BLOCKSIZE)
mid = hasher.hexdigest()
if mid in hash_list:
print ("yes, it's in the hashF")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment