def _get_file_type(full_targ_path):
# This function takes the full path of a target sample and determines/returns the file type via python-magic.
try:
#magicObj = magic.open(magic.MAGIC_NONE)
#magicObj.load()
#magic_out = str(magicObj.file(full_targ_path))
magicObj = magic.Magic(magic_file=r'C:/Program Files (x86)/GnuWin32/share/misc/magic', mime=True)
magic_out = str(magicObj.from_file(full_targ_path))
print magic_out
except AttributeError:
magic_out = str(magic.from_file(full_targ_path))
print magic_out+" ERROR?!?!?!!?"
return(magic_out)
评论列表
文章目录