You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm looking through the documentation and I don't think there is currently a way to check if a file / bytes is a valid PE file, other than via the following try...except excerpt:
importpefiletry:
pefile.PE(filename)
print("Valid PE file")
exceptpefile.PEFormatError:
print("Invalid PE file")
Looking through the functions available, I see the function is_valid in peutils.py, but it currently does nothing (simply a pass statement).
Would it be alright for me to create a pull request, targeting the updating of this function? This will help to implement the functionality of checking if a file is valid PE file, similar to the zipfile standard library's function is_zipfile.
The text was updated successfully, but these errors were encountered:
Hi, if you have a use for such functionality, feel free to send a PR.
I would avoid the "is valid PE" naming. I feel like saying that a PE is valid implies that it is a correct, well-formed, functioning PE, which is a hard thing to say for sure. I would limit it to a is_pe_file() method that attempts a light-weight parse (with fast_load=True). That would differentiate between a parseable PE and non-PE data.
Hi, I'm looking through the documentation and I don't think there is currently a way to check if a file / bytes is a valid PE file, other than via the following
try...except
excerpt:Looking through the functions available, I see the function
is_valid
inpeutils.py
, but it currently does nothing (simply apass
statement).Would it be alright for me to create a pull request, targeting the updating of this function? This will help to implement the functionality of checking if a file is valid PE file, similar to the
zipfile
standard library's functionis_zipfile
.The text was updated successfully, but these errors were encountered: