oshogbo / ghidra-lx-loader

A Ghidra loader module for the Linear eXecutable Module Format
https://oshogbo.vexillium.org/blog/70/
45 stars 11 forks source link

'Unknwon file format: PE' Error #8

Open ElijahBI opened 3 years ago

ElijahBI commented 3 years ago

I was attempting to look at a file which I believe is LX, however it is responding with the error below. Do you think you could offer some assistance as to how I can move forward in getting this file open?

Unknwon file format: PE
java.lang.UnknownError: Unknwon file format: PE
    at lx.LXHeader.<init>(LXHeader.java:130)
    at lx.LX.<init>(LX.java:116)
    at lx.LXLoader.load(LXLoader.java:66)
    at ghidra.app.util.opinion.AbstractLibrarySupportLoader.doLoad(AbstractLibrarySupportLoader.java:347)
    at ghidra.app.util.opinion.AbstractLibrarySupportLoader.loadProgram(AbstractLibrarySupportLoader.java:83)
    at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:112)
    at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:400)
    at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:349)
    at ghidra.util.task.TaskLauncher$1.run(TaskLauncher.java:90)
    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:831)
oshogbo commented 3 years ago

Is it a PE binary or clear LX file?

ElijahBI commented 3 years ago

I am pretty sure it is a PE, though am just now getting started with all of this so I could be mistaken...

oshogbo commented 3 years ago

Can you share the binary?

ElijahBI commented 3 years ago

Hey, sorry for the late response. Here is a link to the exe https://mega.nz/file/d1tllYhD#ikIKonxGx8XJ4dzVG2qB0_W0e2woRtSIFeQO9NjqCYI

oshogbo commented 3 years ago

This binary worked for me. 2021-05-22-214930_708x465_scrot 2021-05-22-214937_787x827_scrot

Did you import the plugin? Did you build plugin by yourself or did you use one of the releases? Which version of ghidra are you using?

oshogbo commented 3 years ago

Can you try this build https://github.com/oshogbo/ghidra-lx-loader/releases/tag/1.4 with the ghidra 9.2.3?

ElijahBI commented 3 years ago

I am still having issues an am unsure as to why exactly...

I have tried the 9.2 and 9.2.3 release builds now (with their respective versions of ghidra)

Here are some screen grabs: 9.2.3 9 2 3 Import options (only format selection is raw binary) 9 2 3 2 9.2 a9 2 Import options (only format selection is raw binary and LXMF) a9 2 2

I'm extracting the zips to 'ghidra root\Ghidra\Extensions' and then checking in the 'install extensions' screen to see that they are indeed installed. Sorry if I am missing something simple here, it seems like you should be able to just pop this in and go...

One thing I did note: when I extracted your 9.2.3 build into my ghidra 9.2.3 install it would not start up the application until I renamed the folder from LX2 to LX. I kept getting a "Exited with error" message

oshogbo commented 3 years ago

You don't have to extract it. This scenario works for me: 2021-05-23-164217_700x593_scrot

Click plus in the right top corner.

2021-05-23-164323_791x546_scrot Select the Extension.

2021-05-23-164348_697x592_scrot Click ok.

2021-05-23-164415_410x48_scrot Restart ghidra.

And you should get the Portable Executable (PE) with the LE:32. 2021-05-23-164536_496x208_scrot

After all that steps the binary is loaded: 2021-05-23-164656_751x794_scrot

I used the newest version of ghidra. 2021-05-23-164758_493x106_scrot

What error do you get after fallowing these steps?

ElijahBI commented 3 years ago

So your guide is working up until I restart ghidra.

I download the zip for the Build for Ghidra 9.2.3 release and place it on my desk top, then I launch ghidra, go to file > install extensions, hit the + in the upper right, select your zip from my desktop and hit okay. At this point it shows up in the extensions list: 1 it will then ask me to restart: 2 but when I restart the extension will suddenly be missing from the extensions list: 3

Here are my version numbers, I did note that I have a higher java version than you do in your image: 4

oshogbo commented 3 years ago

Oh thats really weird. Did you check if ghidra core plugins are enabled?

ElijahBI commented 3 years ago

If the following is what you are referring to, yes it is enabled:

1

oshogbo commented 3 years ago

To be honest I don't have much more idea why this disappeared. What os are you using?

madebr commented 2 years ago

Deselecting the checkbox in front of the ghidra-lx-loader extension and clicking on OK, will remove the extension. The Install Extensions dialog only shows the default extensions + those that are installed AND enabled.