Skip to content

Commit

Permalink
Add support for Ghidra 11.1.x (#4)
Browse files Browse the repository at this point in the history
* Refactor to work with Ghidra's new WildcardAssembler
* Reworked lexer/parser to use Antlr4 rather than a custom solution
* Updates to support newer Rust versions
* Code cleanup
* Improved documentation

---------

Co-authored-by: Wes Jordan <[email protected]>
  • Loading branch information
plucia-mitre and Wes Jordan authored Jul 28, 2024
1 parent 748990f commit a52e7eb
Show file tree
Hide file tree
Showing 262 changed files with 3,250 additions and 24,356 deletions.
117 changes: 57 additions & 60 deletions .github/workflows/pc_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,31 @@ permissions:
contents: read

jobs:

# This builds the rust search components for x86 macs
build_rust_mac_x86_64:
runs-on: macos-latest
env:
RUST_VERSION: nightly-2023-09-01
steps:
- uses: actions/checkout@v3
- name: Install Rust Nightly
run: |
rustup toolchain install $RUST_VERSION --component rustfmt clippy
rustup default $RUST_VERSION
- uses: actions/checkout@v4
- name: Build
working-directory: search
run: cargo build --release --verbose
- name: Archive PC Rust
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pickled_canary_rust_tools_mac_x86_64
path: search/target/release/treesearchtool

# This builds and tests the rust search components for Linux and Windows
build_rust:
runs-on: ubuntu-latest
env:
RUST_VERSION: nightly-2023-09-01
steps:
- uses: actions/checkout@v3
- name: Install Rust Nightly
- uses: actions/checkout@v4
- name: Install Windows Rust cross compiler
working-directory: search
run: |
rustup toolchain install $RUST_VERSION --component rustfmt clippy
rustup default $RUST_VERSION
sudo apt-get install -yqq gcc-mingw-w64
rustup target add x86_64-pc-windows-gnu
rustup component add rust-std-x86_64-pc-windows-gnu
- name: Format Rust
working-directory: search
run: cargo fmt --all -- --color=always --check
Expand All @@ -62,7 +53,7 @@ jobs:
mkdir target/release/binaries
mv target/release/treesearchtool target/x86_64-pc-windows-gnu/release/treesearchtool.exe target/release/binaries
- name: Archive PC Rust
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pickled_canary_rust_tools
path: search/target/release/binaries/*
Expand Down Expand Up @@ -111,49 +102,58 @@ jobs:
# GHIDRA_BUILD_DATE: "20230614"
# - GHIDRA_VERSION: "10.3.2"
# GHIDRA_BUILD_DATE: "20230711"
- GHIDRA_VERSION: "10.3.3"
GHIDRA_BUILD_DATE: "20230829"
- GHIDRA_VERSION: "10.4"
GHIDRA_BUILD_DATE: "20230928"
# - GHIDRA_VERSION: "10.3.3"
# GHIDRA_BUILD_DATE: "20230829"
# - GHIDRA_VERSION: "10.4"
# GHIDRA_BUILD_DATE: "20230928"
# - GHIDRA_VERSION: "11.0"
# GHIDRA_BUILD_DATE: "20231222"
- GHIDRA_VERSION: "11.1"
GHIDRA_BUILD_DATE: "20240607"
- GHIDRA_VERSION: "11.1.1"
GHIDRA_BUILD_DATE: "20240614"
- GHIDRA_VERSION: "11.1.2"
GHIDRA_BUILD_DATE: "20240709"
env:
GHIDRA_LABEL: ${{ matrix.GHIDRA_VERSION }}_${{ matrix.GHIDRA_BUILD_DATE }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get latest Ghidra version
env:
GHIDRA_URL: https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${{ matrix.GHIDRA_VERSION }}_build/ghidra_${{ matrix.GHIDRA_VERSION }}_PUBLIC_${{ matrix.GHIDRA_BUILD_DATE }}.zip
run: |
echo "trying ${{ matrix.GHIDRA_VERSION }} on ${{ matrix.GHIDRA_BUILD_DATE }}"
mkdir ../Ghidra && wget --no-check-certificate -O ghidra.zip $GHIDRA_URL && unzip ghidra.zip && rm ghidra.zip && mv ghidra* ../Ghidra
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.5
- name: Execute Gradle build
env:
GHIDRA_INSTALL_DIR: ${{ github.workspace }}/../Ghidra/ghidra_${{ matrix.GHIDRA_VERSION }}_PUBLIC
run: |
gradle build
gradle
- name: Execute Gradle test and coverage
env:
GHIDRA_INSTALL_DIR: ${{ github.workspace }}/../Ghidra/ghidra_${{ matrix.GHIDRA_VERSION }}_PUBLIC
run: gradle test jacocoTestReport
- name: Archive PC Extension
uses: actions/upload-artifact@v3
with:
path: dist/*.zip
- name: Archive Coverage Report
uses: actions/upload-artifact@v3
with:
name: pickled_canary-${{ env.GHIDRA_LABEL }}_coverage_report
path: build/reports/jacoco/test/*
- name: Get latest Ghidra version
env:
GHIDRA_URL: https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${{ matrix.GHIDRA_VERSION }}_build/ghidra_${{ matrix.GHIDRA_VERSION }}_PUBLIC_${{ matrix.GHIDRA_BUILD_DATE }}.zip
run: |
echo "trying ${{ matrix.GHIDRA_VERSION }} on ${{ matrix.GHIDRA_BUILD_DATE }}"
mkdir ../Ghidra && wget --no-check-certificate -O ghidra.zip $GHIDRA_URL && unzip ghidra.zip && rm ghidra.zip && mv ghidra* ../Ghidra
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
- name: Execute Gradle build
env:
GHIDRA_INSTALL_DIR: ${{ github.workspace }}/../Ghidra/ghidra_${{ matrix.GHIDRA_VERSION }}_PUBLIC
run: |
gradle build
gradle
- name: Execute Gradle test and coverage
env:
GHIDRA_INSTALL_DIR: ${{ github.workspace }}/../Ghidra/ghidra_${{ matrix.GHIDRA_VERSION }}_PUBLIC
run: gradle test jacocoTestReport
- name: Archive PC Extension
uses: actions/upload-artifact@v4
with:
name: pickled_canary-${{ env.GHIDRA_LABEL }}
path: dist/*.zip
- name: Archive Coverage Report
uses: actions/upload-artifact@v4
with:
name: pickled_canary-${{ env.GHIDRA_LABEL }}_coverage_report
path: build/reports/jacoco/test/*

# Bundle up a draft release if the version is tagged
release:
Expand All @@ -162,23 +162,20 @@ jobs:
needs: [build, build_rust, build_rust_mac_x86_64]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Make ouptut directory
run: mkdir output_release
- name: Download Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: output_release
merge-multiple: true
- name: Make zip
run: |
cd output_release
mkdir ../output_release_coverage
mv *_coverage_report ../output_release_coverage
mv pickled_canary_rust_tools_mac_x86_64/treesearchtool pickled_canary_rust_tools/treesearchtool_mac_x86_64
rmdir pickled_canary_rust_tools_mac_x86_64
mv artifact/* .
rmdir artifact
zip -r pickled_canary-${{ github.ref_name }}.zip *
ls -la
cp pickled_canary-${{ github.ref_name }}.zip ../
Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ bin
/build/
search/pickled_canary/pickled_canary_lib.cpython-38-x86_64-linux-gnu.so
/dist
generated-src/
.idea/


*.cpython-312-darwin.so

### Windows ###
# Windows thumbnail cache files
Expand Down Expand Up @@ -42,4 +44,6 @@ Icon


# Thumbnails
._*
._*
.DS_STORE
/foobartest/
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.enableFiletypes": [
"github-actions-workflow"
]
}
Loading

0 comments on commit a52e7eb

Please sign in to comment.