-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
print environment details upon stack trace (#101)
* print environment details upon stack trace * Add Ghidrathon plugin version number * Move exception handling and whitelisting to utils.py * 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 * refactor: pass exception object to log_env_details --------- Co-authored-by: Soufiane Fariss <[email protected]>
- Loading branch information
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import sys | ||
import platform | ||
|
||
import jep | ||
import ghidrathon | ||
from java.lang import System | ||
|
||
ALLOWED_EXCEPTIONS = (RuntimeError, OSError) | ||
|
||
|
||
def log_env_details(exc): | ||
exc_type = type(exc) | ||
if issubclass(exc_type, ALLOWED_EXCEPTIONS): | ||
print( | ||
f"Python={platform.python_version()}, " | ||
f"Arch={System.getProperty('os.arch')}, " | ||
f"OS={System.getProperty('os.name')}, " | ||
f"Ghidra={getGhidraVersion()}, " | ||
f"Java={System.getProperty('java.version')}, " | ||
f"Ghidrathon={ghidrathon.GhidrathonPlugin.getVersion()}, " | ||
f"Jep={jep.__version__}", | ||
file=sys.stderr, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters