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

Can't open the plugin #5

Open
Dolomich opened this issue Nov 13, 2020 · 3 comments
Open

Can't open the plugin #5

Dolomich opened this issue Nov 13, 2020 · 3 comments

Comments

@Dolomich
Copy link

After adding the plugin in the script manager and trying to open it I seem to always get that error :

Error running script: Cantordust.java
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Users/Dolo/Downloads/images/dbf5s3hi0ky11.jpg
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Users/Dolo/Downloads/images/dbf5s3hi0ky11.jpg
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at Cantordust.getJavaData(Cantordust.java:114)
	at Cantordust.getData(Cantordust.java:71)
	at Cantordust.run(Cantordust.java:50)
	at ghidra.app.script.GhidraScript.executeNormal(GhidraScript.java:365)
	at ghidra.app.script.GhidraScript.doExecute(GhidraScript.java:220)
	at ghidra.app.script.GhidraScript.execute(GhidraScript.java:198)
	at ghidra.app.plugin.core.script.RunScriptTask.run(RunScriptTask.java:57)
	at ghidra.util.task.Task.monitoredRun(Task.java:126)
	at ghidra.util.task.TaskRunner.lambda$startTaskThread$1(TaskRunner.java:94)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

---------------------------------------------------
Build Date: 2020-Feb-12 1149 EST
Ghidra Version: 9.1.2
Java Home: C:\Program Files\Java\jdk-11.0.9
JVM Version: Oracle Corporation 11.0.9
OS: Windows 7 6.1 amd64

I have some files open in Ghidra, I tried running it in administrator mode, I even tried different JDK versions but I keep getting it.

Clearly this seems path related, but I'm not sure what to do about it.

@Dolomich
Copy link
Author

I tried using Ghidra v9.1, same error

Error running script: Cantordust.java
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Users/Dolo/Desktop/DF_divination_2.jpg
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/Users/Dolo/Desktop/DF_divination_2.jpg
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at Cantordust.getJavaData(Cantordust.java:114)
	at Cantordust.getData(Cantordust.java:71)
	at Cantordust.run(Cantordust.java:50)
	at ghidra.app.script.GhidraScript.executeNormal(GhidraScript.java:365)
	at ghidra.app.script.GhidraScript.doExecute(GhidraScript.java:220)
	at ghidra.app.script.GhidraScript.execute(GhidraScript.java:198)
	at ghidra.app.plugin.core.script.RunScriptTask.run(RunScriptTask.java:57)
	at ghidra.util.task.Task.monitoredRun(Task.java:126)
	at ghidra.util.task.TaskRunner.lambda$startTaskThread$1(TaskRunner.java:94)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

---------------------------------------------------
Build Date: 2019-Oct-23 1737 EDT
Ghidra Version: 9.1
Java Home: C:\Program Files\Java\jdk-15.0.1
JVM Version: Oracle Corporation 15.0.1
OS: Windows 7 6.1 amd64

I also tried using v9.2, still don't start but different error

GhidraProvider
java.lang.NoClassDefFoundError: GhidraProvider
	at Cantordust.writeBinLocation(Cantordust.java:127)
	at Cantordust.run(Cantordust.java:48)
	at ghidra.app.script.GhidraScript.executeNormal(GhidraScript.java:379)
	at ghidra.app.script.GhidraScript.doExecute(GhidraScript.java:234)
	at ghidra.app.script.GhidraScript.execute(GhidraScript.java:212)
	at ghidra.app.plugin.core.script.RunScriptTask.run(RunScriptTask.java:47)
	at ghidra.util.task.Task.monitoredRun(Task.java:124)
	at ghidra.util.task.TaskRunner.lambda$startTaskThread$1(TaskRunner.java:94)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

---------------------------------------------------
Build Date: 2020-Nov-13 1112 EST
Ghidra Version: 9.2
Java Home: C:\Program Files\Java\jdk-15.0.1
JVM Version: Oracle Corporation 15.0.1
OS: Windows 7 6.1 amd64

@sengi12
Copy link
Contributor

sengi12 commented Nov 20, 2020

Thanks for bringing this to our attention @Dolomich! As far as I see there are two different issues here.

Issue 1 (v9.1):
There is a Ghidra function that Cantordust relies on to get the bytes from the file: currentProgram.getExecutablePath();
When this function runs in Linux, it outputs a full path to the file as expected. However in Windows, it outputs the full path with an extra / at the beginning. Notice how the error occurs with this path: /C:/Users/Dolo/Desktop/DF_divination_2.jpg.

Our current work around is to simply check if the OS is Windows 10, and if so remove the extra /. (See Cantordust.java: line 111) However your test was done using Windows 7, which is not checked for as Windows 7 technically reached its EOL as of January 14th, 2020.

A simple work around for your case would be to change Cantordust.java: line 111, so that it removes the extra / for Windows 7 too. Let me know, but that should work!

Issue 2 (v9.2):
After some investigation, it appears that the NSA's newest release of Ghidra (9.2) has a changed how it compiles plugins. In its current state, Cantordust is not compatible with v9.2 sadly. I'll look into this over the next few days and see if I can get it working again.

I hope this was helpful! Please let me know if run into any other problems 🙂

@Dolomich
Copy link
Author

Thanks for you answer, I managed to get the plugin working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants