1. import pefile
    2. pathFile = ".\\PE"
    3. def File2Read():
    4. filePE = open(pathFile, "rb")
    5. dataPE = filePE.read()
    6. global hexPE
    7. hexPE = binascii.b2a_hex(dataPE).decode('utf-8').upper()
    8. filePE = pefile.PE(pathFile)
    9. # RAV = VA - ImageBase
    10. RAV = VA - filePE.OPTIONAL_HEADER.ImageBase
    11. FileOffset = filePE.get_offset_from_rva(RVA)