本文整理匯總了Python中pefile.__version__方法的典型用法代碼示例。如果您正苦於以下問題:Python pefile.__version__方法的具體用法?Python pefile.__version__怎麽用?Python pefile.__version__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pefile
的用法示例。
在下文中一共展示了pefile.__version__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: scan
# 需要導入模塊: import pefile [as 別名]
# 或者: from pefile import __version__ [as 別名]
def scan(filelist, conf=DEFAULTCONF):
results = []
libmagicresults, libmagicmeta = REQUIRES[0]
for fname, libmagicresult in libmagicresults:
if fname not in filelist:
print("DEBUG: File not in filelist")
if not libmagicresult.startswith('PE32'):
continue
result = {}
pe = pefile.PE(fname)
result['pehash'] = _get_pehash(pe)
check, sha = _get_rich_header(pe)
if check:
result['rich_header_checksum'] = check
if sha:
result['rich_header_sha256'] = sha
if callable(getattr(pe, 'get_imphash', None)):
try:
result['import_hash'] = pe.get_imphash()
except Exception as e:
# TODO: log exception
pass
if hasattr(pe, 'DIRECTORY_ENTRY_RESOURCE'):
result['resource_data'] = _dump_resource_data("ROOT",
pe.DIRECTORY_ENTRY_RESOURCE,
pe,
False)
result['sections'] = _get_sections(pe)
if hasattr(pe, 'DIRECTORY_ENTRY_IMPORT'):
result['imports'] = _get_imports(pe)
else:
result['imports'] = None
if hasattr(pe, 'DIRECTORY_ENTRY_EXPORT'):
result['exports'] = _get_exports(pe)
else:
result['exports'] = None
result['pe_timestamp'] = _get_timestamp(pe)
if hasattr(pe, 'DIRECTORY_ENTRY_DEBUG'):
result['debug_info'] = _get_debug_info(pe)
if hasattr(pe, 'VS_VERSIONINFO'):
result['version_info'] = _get_version_info(pe)
if hasattr(pe, 'DIRECTORY_ENTRY_TLS'):
ret = _get_tls_info(pe)
if ret:
result['tls_callback_info'] = ret
result = convert_encoding(result)
results.append((fname, result))
metadata = {}
metadata["Name"] = NAME
metadata["Type"] = TYPE
metadata["Version"] = pefile.__version__
metadata["Include"] = False
return (results, metadata)
# This section is an adaption from the CRITS pefile service
# https://github.com/MITRECND/crits_services/blob/master/peinfo_service/__init__.py