Skip to content

Commit

Permalink
API changes and docker images for Ghidra 11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
clearbluejar committed Oct 8, 2024
1 parent 269b78d commit c6aefbd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "ghidrecomp",
// image from https://github.com/clearbluejar/ghidra-python
"image": "ghcr.io/clearbluejar/ghidra-python:11.0.3ghidra3.12python-bookworm",
"image": "ghcr.io/clearbluejar/ghidra-python:11.2ghidra3.12python-bookworm",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
Expand Down
11 changes: 10 additions & 1 deletion .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@ pip install --upgrade pip
pip install ghidra-stubs

# If linux arm64 os, need to build native binaries for Ghidra
# If arm64 os, need to build native binaries for Ghidra
if uname -a | grep -q 'aarch64'; then
$GHIDRA_INSTALL_DIR/support/buildNatives
if [ -e $GHIDRA_INSTALL_DIR/support/buildNatives ]
then
$GHIDRA_INSTALL_DIR/support/buildNatives
else
# needed for Ghidra 11.2+
pushd $GHIDRA_INSTALL_DIR/support/gradle/
gradle buildNatives
popd
fi
fi

# install local workspace and test requirements
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest-devcontainer-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# cover the latest and all versions of all subreleases
image: [
"latest",
"11.0.1ghidra3.12python-bookworm",
"11.1.2ghidra3.12python-bookworm",
"11.0ghidra3.11python-bookworm",
"10.4ghidra3.11python-bookworm",
"10.4ghidra3.9python-bookworm",
Expand Down
2 changes: 1 addition & 1 deletion ghidrecomp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.5.3'
__version__ = '0.5.4'
__author__ = 'clearbluejar'

# Expose API
Expand Down
18 changes: 14 additions & 4 deletions ghidrecomp/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ def get_pdb(prog: "ghidra.program.model.listing.Program") -> "java.io.File":
from ghidra.util.task import ConsoleTaskMonitor
from pdb_ import PdbPlugin

find_opts = FindOption.of(FindOption.ALLOW_REMOTE)
# find_opts = FindOption.NO_OPTIONS
if hasattr(FindOption, 'ALLOW_UNTRUSTED'):
# Ghidra 11.2 +
find_opts = FindOption.of(FindOption.ALLOW_UNTRUSTED)
else:
# Ghidra < 11.2
find_opts = FindOption.of(FindOption.ALLOW_REMOTE)

# Ghidra/Features/PDB/src/main/java/pdb/PdbPlugin.java#L191
pdb = PdbPlugin.findPdb(prog, find_opts, ConsoleTaskMonitor())
Expand Down Expand Up @@ -148,8 +152,14 @@ def set_remote_pdbs(program: "ghidra.program.model.listing.Program", allow: bool
from ghidra.app.plugin.core.analysis import PdbUniversalAnalyzer
# Enable Remote Symbol Servers

PdbUniversalAnalyzer.setAllowRemoteOption(program, allow)
PdbAnalyzer.setAllowRemoteOption(program, allow)
if hasattr(PdbUniversalAnalyzer, 'setAllowUntrustedOption'):
# Ghidra 11.2 +
PdbUniversalAnalyzer.setAllowUntrustedOption(program, True)
PdbAnalyzer.setAllowUntrustedOption(program, True)
else:
# Ghidra < 11.2
PdbUniversalAnalyzer.setAllowRemoteOption(program, True)
PdbAnalyzer.setAllowRemoteOption(program, True)


def apply_gdt(program: "ghidra.program.model.listing.Program", gdt_path: Union[str, Path], verbose: bool = False):
Expand Down

0 comments on commit c6aefbd

Please sign in to comment.