Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 0 additions & 67 deletions .github/scripts/bump_revengai.py

This file was deleted.

38 changes: 37 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build

on:
pull_request:
branches: [ "main" ]
branches: [ "main", "staging" ]

jobs:
build:
Expand Down Expand Up @@ -66,6 +66,7 @@ jobs:
run: $GHIDRA_INSTALL_DIR/support/sleigh $GHIDRA_INSTALL_DIR/Ghidra/Processors/x86/data/languages/x86-64.slaspec

- name: Run tests
id: tests
run: xvfb-run ./gradlew test

- name: Upload test results
Expand All @@ -76,9 +77,44 @@ jobs:
path: build/reports/tests/test/

- name: Publish test report
id: report
if: always()
# Updating the check run right after creating it intermittently 404s, which failed jobs whose
# tests had passed. Failing tests already fail "Run tests", so the report is display only.
continue-on-error: true
uses: dorny/test-reporter@d61b558e8df85cb60d09ca3e5b09653b4477cea7 # v1
with:
name: Tests (Ghidra ${{ matrix.ghidra }})
path: build/test-results/test/*.xml
reporter: java-junit

- name: Complete a test report left in progress
# When the reporter's update 404s, the check run it created stays "in progress" for good, so the PR never
# shows all checks finished. Complete it with the outcome of the tests. Display only, like the report.
if: always() && steps.report.outcome == 'failure'
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
CHECK_NAME: Tests (Ghidra ${{ matrix.ghidra }})
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
CONCLUSION: ${{ steps.tests.outcome == 'success' && 'success' || 'failure' }}
run: |
summary="The test reporter could not attach the results to this check (HTTP 404). See the Run tests step and the test-results artifact."
# The check run may not be visible to the API yet, which is what made the reporter's update fail
for attempt in 1 2 3 4 5; do
ids=$(gh api -X GET "repos/$GITHUB_REPOSITORY/commits/$HEAD_SHA/check-runs" \
-f check_name="$CHECK_NAME" -f filter=all \
--jq '.check_runs[] | select(.status != "completed") | .id') || ids=""
completed=true
for id in $ids; do
gh api -X PATCH "repos/$GITHUB_REPOSITORY/check-runs/$id" \
-f status=completed -f conclusion="$CONCLUSION" \
-f "output[title]=$CHECK_NAME" -f "output[summary]=$summary" >/dev/null || completed=false
done
if [ -n "$ids" ] && [ "$completed" = true ]; then
echo "Completed '$CHECK_NAME' ($ids) as $CONCLUSION"
exit 0
fi
sleep 5
done
echo "::warning::Could not find or complete an in-progress '$CHECK_NAME' check"
101 changes: 0 additions & 101 deletions .github/workflows/bump-revengai-sdk.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ and use it for Binary Code Similarity to help you Reverse Engineer stripped bina

## Installation

### Install script

Close Ghidra, then run:

```sh
# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/RevEngAI/plugin-ghidra/main/install.sh | bash
```

```powershell
# Windows (PowerShell)
irm https://raw.githubusercontent.com/RevEngAI/plugin-ghidra/main/install.ps1 | iex
```

The script finds your Ghidra installs (asking which one if several), downloads the matching release, installs it and enables the plugins in the CodeBrowser.
Set `GHIDRA_INSTALL_DIR` to target a specific install, or `REVENG_PLUGIN_VERSION` (e.g. `v1.1.2`) to pin a release.

### Manual installation

The builds for latest stable version of the RevEng.AI Ghidra plugin for common Ghidra versions can be downloaded from the [Releases](https://github.com/revengai/plugin-ghidra/releases/latest) page.

### Supported Ghidra versions
Expand Down
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ dependencies {
implementation group: 'com.fifesoft', name: 'rsyntaxtextarea', version: '3.5.2'
implementation 'org.commonmark:commonmark:0.24.0'
implementation 'org.commonmark:commonmark-ext-gfm-tables:0.24.0'
implementation('ai.reveng:sdk:4.75.0')
implementation('ai.reveng:sdk:4.77.1')
testImplementation('junit:junit:4.13.1')
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.8.2")
// Version comes from the junit-bom pulled in by junit-vintage-engine.
testRuntimeOnly('org.junit.platform:junit-platform-launcher')
// Compile-time API for ForkTempDir; matches the runtime version above.
testCompileOnly('org.junit.platform:junit-platform-launcher:1.8.2')

// https://mvnrepository.com/artifact/org.jetbrains/annotations
implementation group: 'org.jetbrains', name: 'annotations', version: '26.0.2'
Expand All @@ -84,9 +86,6 @@ dependencies {
// Maven repository:
//
// ./gradlew buildExtension -PrevengSdkVersion=<version>
//
// The pin in the dependencies block stays the literal default so that
// .github/scripts/bump_revengai.py can still find and rewrite it.
if (project.hasProperty('revengSdkVersion')) {
configurations.all {
resolutionStrategy.force "ai.reveng:sdk:${project.revengSdkVersion}"
Expand All @@ -107,6 +106,10 @@ test {
useJUnitPlatform()
jvmArgs '--add-exports=java.desktop/sun.awt=ALL-UNNAMED'
systemProperty "ghidra.test.property.batch.mode", 'true'
// Parent of the per-fork Ghidra temp dirs created by ForkTempDir.
def forkTempRoot = layout.buildDirectory.dir('tmp/ghidra-test-forks').get().asFile
systemProperty 'reveng.test.fork.tmproot', forkTempRoot.path
doFirst { forkTempRoot.mkdirs() }

// Ghidra 12.1+ installs a serial filter factory during application initialization. The JVM
// only allows this if no ObjectInputStream has been constructed yet, but Gradle's test
Expand Down
38 changes: 38 additions & 0 deletions data/reveng.theme.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[Defaults]

color.bg.reveng.tag = rgba(14,169,104,.08)
color.border.reveng.tag = rgba(14,169,104,.35)
color.border.reveng.title = [color]laf.color.Separator.foreground

color.fg.reveng.similarity.critical = #b31d1d
color.fg.reveng.similarity.high = #ac3f09
color.fg.reveng.similarity.medium = #985a04
color.fg.reveng.similarity.low = #137236

color.bg.reveng.diff.deleted = rgba(201,55,55,.15)
color.bg.reveng.diff.inserted = rgba(14,169,104,.15)
color.bg.reveng.diff.changed = rgba(184,108,0,.15)
color.bg.reveng.diff.placeholder = rgba(7,9,13,.04)

icon.reveng.mark.16 = images/reveng_16.png
icon.reveng.mark.24 = images/reveng_24.png
icon.reveng.mark.large = images/icon.png

[Dark Defaults]

color.bg.reveng.tag = rgba(92,240,163,.06)
color.border.reveng.tag = rgba(92,240,163,.3)

color.fg.reveng.similarity.critical = #f26d6d
color.fg.reveng.similarity.high = #f08b3c
color.fg.reveng.similarity.medium = #f5c04a
color.fg.reveng.similarity.low = #47d17a

color.bg.reveng.diff.deleted = rgba(255,107,107,.15)
color.bg.reveng.diff.inserted = rgba(92,240,163,.15)
color.bg.reveng.diff.changed = rgba(255,180,84,.15)
color.bg.reveng.diff.placeholder = rgba(255,255,255,.03)

icon.reveng.mark.16 = images/reveng_16_dark.png
icon.reveng.mark.24 = images/reveng_24_dark.png
icon.reveng.mark.large = images/icon_dark.png
2 changes: 1 addition & 1 deletion docs/FEATURE_STANDARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature support is declared in [`scripts/emit_features.py`](../scripts/emit_feat
- `build_manifest()` merges the two.

`.revengai/features.json` is generated from this script — never edit the JSON by hand. The
script is build tooling (a small Python script, like `.github/scripts/bump_revengai.py`)
script is build tooling (a small Python script)
and is not part of the Ghidra extension under `src/`.

## Status values
Expand Down
4 changes: 4 additions & 0 deletions ghidra_scripts/RevEngExamplePostScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
public class RevEngExamplePostScript extends GhidraScript {
@Override
protected void run() throws Exception {
if (currentProgram == null) {
printerr("No program open");
return;
}
// Services are not available in headless mode, so we have to instantiate it ourselves
var ghidraRevengService = new GhidraRevengService(ApiInfo.fromConfig(ReaiPluginPackage.DEFAULT_CONFIG_PATH));

Expand Down
Loading
Loading