Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print environment details upon stack trace #101

Merged
merged 5 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data/python/jepeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def _jepeval(line):
# in the Ghidra console window
import traceback

import utils

traceback.print_exc()
utils.log_env_details(type(err))

return more_input_needed
3 changes: 3 additions & 0 deletions data/python/jeprunscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ def jep_runscript(path):
# messages in the Ghidra console window
import traceback

import utils

traceback.print_exc()
utils.log_env_details(type(err))
24 changes: 24 additions & 0 deletions data/python/utils.py
fariss marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import sys
import platform

import jep
import ghidrathon
from java.lang import System

ALLOWED_EXCEPTIONS = [RuntimeError, OSError]


def log_env_details(exc_type):
if any(issubclass(exc_type, exc_class) for exc_class in ALLOWED_EXCEPTIONS):
print(
"Python={python_version}, Arch={arch}, OS={os}, Ghidra={ghidra_version}, Java={java_version}, Ghidrathon={ghidrathon_version}, Jep={jep_version}".format(
fariss marked this conversation as resolved.
Show resolved Hide resolved
python_version=platform.python_version(),
arch=System.getProperty("os.arch"),
os=System.getProperty("os.name"),
ghidra_version=getGhidraVersion(),
java_version=System.getProperty("java.version"),
ghidrathon_version="4.0.0",
fariss marked this conversation as resolved.
Show resolved Hide resolved
jep_version=jep.__version__,
),
file=sys.stderr,
)
6 changes: 6 additions & 0 deletions src/main/java/ghidrathon/GhidrathonPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
public class GhidrathonPlugin extends ProgramPlugin
implements InterpreterConnection, OptionsChangeListener {

private static final String VERSION = "4.0.0";

private InterpreterConsole console;
private GhidrathonConsoleInputThread inputThread;
private TaskMonitor interactiveTaskMonitor;
Expand All @@ -71,6 +73,10 @@ GhidrathonScript getInteractiveScript() {
return interactiveScript;
}

public String getVersion() {
fariss marked this conversation as resolved.
Show resolved Hide resolved
return VERSION;
}

@Override
protected void init() {

Expand Down