comsecuris / gdbghidra Goto Github PK
View Code? Open in Web Editor NEWgdbghidra - a visual bridge between a GDB session and GHIDRA
License: MIT License
gdbghidra - a visual bridge between a GDB session and GHIDRA
License: MIT License
In order to work with a remote target (such as a device with openocd), it was necessary to stub out the relocation and mappings methods. Otherwise python would throw an exception that "Can't determine the current process's PID: you must name one". As a quick hack I patched around it, but perhaps there is a better way:
diff --git a/data/gdb_ghidra_bridge_client.py b/data/gdb_ghidra_bridge_client.py
index f2bb7a9..e9a0f5f 100755
--- a/data/gdb_ghidra_bridge_client.py
+++ b/data/gdb_ghidra_bridge_client.py
@@ -297,6 +297,8 @@ class GhidraBridgeCommand(gdb.Command):
class GDBUtils:
@staticmethod
def get_relocation():
+ if True:
+ return "0x0"
r = GDBUtils.query_gdb('info proc stat', 'relocation', 'Start of text: ', 'End of text: ')
if r == "unknown":
return "0x0"
@@ -356,6 +358,8 @@ class GDBUtils:
@staticmethod
def get_mapping(named):
+ if True:
+ return None
m = GDBUtils.query_gdb("info proc mappings", "mappings")
if "unable to open" in m:
return None
For some reason, the GhidraBridgeCommand
__init__
method creates the bridge and sends the first message instead of invoke
meaning that the host and port are always the defaults, and that it always attempts to connect the bridge when the script is sourced instead of when the command is run.
Gradle version: 6.0.1
Ghidra version: 9.1 (2019-OCT-23 1737 EDT)
output:
$ gradle -PGHIDRA_INSTALL_DIR=/usr/share/ghidra
Task :compileJava FAILED
/home/fabio/src/gdb% gradle -PGHIDRA_INSTALL_DIR=/usr/share/ghidraTask :compileJava FAILED
/home/fabio/src/gdbghidra/src/main/java/gdbghidra/GDBReceiver.java:46: error: cannot access Address
import ghidra.program.model.address.Address;
^
bad class file: /usr/share/ghidra/Ghidra/Framework/SoftwareModeling/lib/SoftwareModeling.jar(ghidra/program/model/address/Address.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':compileJava'.
ghidra/src/main/java/gdbghidra/GDBReceiver.java:46: error: cannot access Address
import ghidra.program.model.address.Address;
^
bad class file: /usr/share/ghidra/Ghidra/Framework/SoftwareModeling/lib/SoftwareModeling.jar(ghidra/program/model/address/Address.class)
class file has wrong version 55.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':compileJava'.
Hello -
I followed the instructions outlined in README.md, and tried to build this for Ghidra version 10.0.4, which I have an active project in. I get the following error and cannot seem to build this.
$pwd
/opt/gdbghidra
$gradle -PGHIDRA_INSTALL_DIR=/opt/ghidra
FAILURE: Build failed with an exception.
* Where:
Script '/opt/ghidra/support/buildExtension.gradle' line: 80
* What went wrong:
A problem occurred evaluating script.
> Could not set unknown property 'archiveBaseName' for task ':buildExtension' of type org.gradle.api.tasks.bundling.Zip.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
Specs:
OS: Ubuntu 20.04.3 LTS
Ghidra Version: 10.0.4 PUBLIC 2021-Sep-28 1538 EDT
Java:
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17.0.1+12-Ubuntu-120.04, mixed mode, sharing)
Gradle:
Gradle 4.4.1
Build time: 2012-12-21 00:00:00 UTC
Revision: none
Groovy: 2.4.17
Ant: Apache Ant(TM) version 1.10.7 compiled on October 24 2019
JVM: 11.0.13 (Ubuntu 11.0.13+8-Ubuntu-0ubuntu1.20.04)
OS: Linux 5.4.0-91-generic amd64
Any ideas what I'm doing wrong / how I could get gdbghidra
built for 10.0.4?
Thanks!
Lyell
On https://github.com/NationalSecurityAgency/ghidra/tree/adedcde30f893fe3f48291f15866aed05df04fc9 (newest commit as of the time of this issue being opened) the plugin crashes when the gdb client sends the stack information:
Uncaught Exception!
RuntimeException - ghidra.util.exception.DuplicateNameException: Space named [stack] already exists!
java.lang.RuntimeException: ghidra.util.exception.DuplicateNameException: Space named [stack] already exists!
at ghidra.app.util.MemoryBlockUtils.createInitializedBlock(MemoryBlockUtils.java:303)
at gdbghidra.events.MemoryEvent.handleEvent(MemoryEvent.java:104)
at gdbghidra.GDBReceiver.handleConnection(GDBReceiver.java:134)
at gdbghidra.GDBReceiver.run(GDBReceiver.java:79)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: ghidra.util.exception.DuplicateNameException: Space named [stack] already exists!
at ghidra.program.model.address.DefaultAddressFactory.addAddressSpace(DefaultAddressFactory.java:380)
at ghidra.program.database.ProgramAddressFactory.addOverlayAddressSpace(ProgramAddressFactory.java:113)
at ghidra.program.database.ProgramDB.addOverlaySpace(ProgramDB.java:1325)
at ghidra.program.database.mem.MemoryMapDB.createOverlaySpace(MemoryMapDB.java:469)
at ghidra.program.database.mem.MemoryMapDB.createInitializedBlock(MemoryMapDB.java:490)
at ghidra.app.util.MemoryBlockUtils.createInitializedBlock(MemoryBlockUtils.java:298)
... 4 more
Hi, I'm trying to debug an issue with this on Ghidra 9.1, and I can't figure out where logging output goes.
E.g., for a line like above.
Ghidra maps stdout/stderr to /dev/null
, so I'm not sure what's going on here.
Any help would be appreciated, thanks!
Seems like the latest build is incompatible with Ghidra's 2020-Feb-12 release.
GDBReceiver.relocate
is initialized as 0, and used as a base in
.relocate
prior to toggling a breakpoint, the address sent to GDB will be wrong.
Ghidra Version: https://github.com/NationalSecurityAgency/ghidra/tree/adedcde30f893fe3f48291f15866aed05df04fc9
gdbghidra Version: c817839
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.