Skip to content

Commit 46f45fd

Browse files
committed
Renamed jeputils & reformatted env details string
This commit: - renames utils.py to jeputils.py avoid confusion. - reformats environment details string as a format string - enables getVersion method to be called statically
1 parent c1a8400 commit 46f45fd

File tree

5 files changed

+27
-29
lines changed

5 files changed

+27
-29
lines changed

data/python/jepeval.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ def _jepeval(line):
7979
# in the Ghidra console window
8080
import traceback
8181

82-
import utils
82+
import jeputils
8383

8484
traceback.print_exc()
85-
utils.log_env_details(type(err))
85+
jeputils.log_env_details(type(err))
8686

8787
return more_input_needed

data/python/jeprunscript.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def jep_runscript(path):
3636
# messages in the Ghidra console window
3737
import traceback
3838

39-
import utils
39+
import jeputils
4040

4141
traceback.print_exc()
42-
utils.log_env_details(type(err))
42+
jeputils.log_env_details(type(err))

data/python/jeputils.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
import platform
3+
4+
import jep
5+
import ghidrathon
6+
from java.lang import System
7+
8+
ALLOWED_EXCEPTIONS = [RuntimeError, OSError]
9+
10+
11+
def log_env_details(exc_type):
12+
if any(issubclass(exc_type, exc_class) for exc_class in ALLOWED_EXCEPTIONS):
13+
print(
14+
f"Python={platform.python_version()}, "
15+
f"Arch={System.getProperty('os.arch')}, "
16+
f"OS={System.getProperty('os.name')}, "
17+
f"Ghidra={getGhidraVersion()}, "
18+
f"Java={System.getProperty('java.version')}, "
19+
f"Ghidrathon={ghidrathon.GhidrathonPlugin.getVersion()}, "
20+
f"Jep={jep.__version__}",
21+
file=sys.stderr,
22+
)

data/python/utils.py

-24
This file was deleted.

src/main/java/ghidrathon/GhidrathonPlugin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ GhidrathonScript getInteractiveScript() {
7373
return interactiveScript;
7474
}
7575

76-
public String getVersion() {
76+
public static String getVersion() {
7777
return VERSION;
7878
}
7979

0 commit comments

Comments
 (0)