in hexforge_modules/misc_modules.py [0:0]
def _action(self) -> None:
from PyQt5.Qt import QApplication
current_ea = idc.get_screen_ea()
# Map the VA to the corresponding file offset
file_offset = idaapi.get_fileregion_offset(current_ea)
if file_offset != -1:
print(f"Current Address: 0x{current_ea:X}")
print(f"File Offset: 0x{file_offset:X}")
try:
QApplication.clipboard().setText(f"0x{file_offset:X}")
except (binascii.Error, UnicodeDecodeError) as e:
print(e)
return None
else:
print("Failed to compute file offset.")