python 2.7 - Hashing sections of a PE file using pefile module -
i have written script in python uses pefile module parse pe files. 1 of features of script ability generate md5 , sha256 hash each section contained within pe file. looking code pefile module there class called sectionstructure. within class there methods allow return of both md5 , sha256 hash of pe section's data. not sure how access these methods within script , seeking advice of more seasoned developers assist this. can please point me in right direction in getting functionality work? share script upon request.
the list pe.sections
contains section object each pe section. iterate on , use methods get_hash_md5()
, get_hash_sha256()
. example:
import pefile pe = pefile.pe('/path/to/file') sect in pe.sections: print sect.name print sect.get_hash_md5() print sect.get_hash_sha256() print
Comments
Post a Comment