mandiant/Ghidrathon

User-defined exception handlers set via sys.excepthook not executed in Ghidrathon

fariss opened this issue · 1 comments

User custom exception hooks set via sys.excepthook = <custom exception handler> are not executed in Ghidrathon. Though, this functionally works as intended in the builtin interpreter. See #101 (comment)

To repoduce this issue:

def my_exc_handler(type, value, traceback):
    print("This is a custom exception handler...")
    
import sys
sys.excepthook = my_exc_handler
raise Exception
s-ff commented

A potential fix for this issue in jepeval.py and jeprunscript.py could look something like this:

# Check if a custom exception hook has been set
if sys.excepthook != sys.__excepthook__:
    # Call the custom exception hook
    sys.excepthook(type(err), err, err.__traceback__)