import pefile
pathFile = ".\\PE"
def File2Read():
filePE = open(pathFile, "rb")
dataPE = filePE.read()
global hexPE
hexPE = binascii.b2a_hex(dataPE).decode('utf-8').upper()
filePE = pefile.PE(pathFile)
# RAV = VA - ImageBase
RAV = VA - filePE.OPTIONAL_HEADER.ImageBase
FileOffset = filePE.get_offset_from_rva(RVA)