Closed themyops closed 2 years ago
This is an ugly fix which may well break the script on Windows - no idea how the environment presents there. I'm running ghidra on barebones kali / debian.
Hi, can you share your jython version? Also, run platform.system()
and write the value as well.
I'm running Ghidra 9.1.2 public, which comes with Jython standalone, v 2.7.1 (jython-standalone-2.7.1.jar) as part of the Ghidra tarball.
Run from inside Ghidra, the output of a plaform script
import platform print(platform.system())
is:
platform.py> Running... Java platform.py> Finished!
Would be interested to see what this turns up with Ghidra on Windows, but I don't have that set up.
@themyops I fixed that, sort of, with #10
I think I fixed this issue in this PR - https://github.com/intezer/analyze-community-ghidra-plugin/pull/16/commits/1b4c869cc0722da92748503f6109d95b47312f5d
I am using a Ghidra docker image that uses openjdk:11-jdk-slim.
Greetings,
The following pull request change may help you: https://github.com/intezer/analyze-community-ghidra-plugin/pull/20
Also, if that does not help you, the diagnostic process that I used to view how each of the conditions resolves inside Ghidra should at least show you where the problem is located:
>>> import os
>>> import sys
>>> (os.name == "Posix") and (("Linux") in os.uname())
False
>>> os.name == "java"
True
>>> ("Darwin") in os.uname()
True
>>> os.name == "nt" or ("windows") in java.lang.System.getProperty("os.name").lower()
False
>>> os.name
PyShadowString('java', 'posix')
>>> os.uname()
('Darwin', 'example.com', '20.6.0', 'Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64', 'x86_64')
I just had the problem that the plugin doesn't want to import 'requests' despite it being installed and working from the command line.
Some analysis (ok, adding print statements to the code) indicated to me that my os.name is 'java' inside of Ghidra, not 'posix'. As a result I got the Windows path extension, and of course 'requests' wasn't anywhere to be seen. Modified line 11 of the script to
if (os.name == "posix" or os.name=='java'):
and then the script works.