-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0381beb
Showing
150 changed files
with
22,965 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: CheckStyle | ||
|
||
on: | ||
push: | ||
branches: [ '*' ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run java checkstyle | ||
uses: nikitasavinov/[email protected] | ||
with: | ||
checkstyle_version: '8.32' | ||
checkstyle_config: './.github/workflows/checks_rules.xml' | ||
fail_on_error: true | ||
level: error | ||
reporter: 'github-pr-check' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Integration test | ||
|
||
on: | ||
push: | ||
branches: [ '*' ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: | | ||
/opt/hostedtoolcache/z3 | ||
/opt/hostedtoolcache/ghidra | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
- name: Setup Ghidra | ||
uses: er28-0652/[email protected] | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
version: '10.1.2' | ||
- name: Download Z3 | ||
uses: pavpanchekha/[email protected] | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
version: '4.8.15' | ||
architecture: 'x64' | ||
distribution: 'glibc-2.31' | ||
- name: Setup Environment variables if use cache | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
run: | | ||
echo "CPATH=/opt/hostedtoolcache/z3/4.8.15/x64/z3-4.8.15-x64-glibc-2.31/include" >> $GITHUB_ENV | ||
echo "GHIDRA_INSTALL_DIR=/opt/hostedtoolcache/ghidra/10.1.2/x64" >> $GITHUB_ENV | ||
- name: Setup Z3 | ||
run: | | ||
cp $CPATH/../bin/com.microsoft.z3.jar $GITHUB_WORKSPACE/lib/com.microsoft.z3.jar | ||
sudo cp $CPATH/../bin/*.so /lib | ||
- name: Checkout binaries | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: KeenSecurityLab/BinAbsInspector-binaries | ||
path: src/integration/resources/binaries | ||
- name: Integration test | ||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee | ||
with: | ||
gradle-version: current | ||
arguments: integrationTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Unit test | ||
|
||
on: | ||
push: | ||
branches: [ '*' ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: | | ||
/opt/hostedtoolcache/z3 | ||
/opt/hostedtoolcache/ghidra | ||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | ||
- name: Setup Ghidra | ||
uses: er28-0652/[email protected] | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
version: '10.1.2' | ||
- name: Download Z3 | ||
uses: pavpanchekha/[email protected] | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
version: '4.8.15' | ||
architecture: 'x64' | ||
distribution: 'glibc-2.31' | ||
- name: Setup Environment variables if use cache | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
run: | | ||
echo "CPATH=/opt/hostedtoolcache/z3/4.8.15/x64/z3-4.8.15-x64-glibc-2.31/include" >> $GITHUB_ENV | ||
echo "GHIDRA_INSTALL_DIR=/opt/hostedtoolcache/ghidra/10.1.2/x64" >> $GITHUB_ENV | ||
- name: Setup Z3 | ||
run: | | ||
cp $CPATH/../bin/com.microsoft.z3.jar $GITHUB_WORKSPACE/lib/com.microsoft.z3.jar | ||
sudo cp $CPATH/../bin/*.so /lib | ||
- name: Unit test | ||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee | ||
with: | ||
gradle-version: current | ||
arguments: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/bin/ | ||
build/ | ||
dist/ | ||
.gradle | ||
.classpath | ||
.project | ||
.DS_Store | ||
.settings/ | ||
.vscode/ | ||
.idea/ | ||
ghidra_test/ | ||
*.sh | ||
gradle.properties | ||
.editorconfig | ||
/src/integration/resources/binaries | ||
/out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
ARG UBUNTU_MIRROR=mirrors.tuna.tsinghua.edu.cn | ||
|
||
FROM gradle:7-jdk11 | ||
|
||
ARG UBUNTU_MIRROR | ||
# Non-interactive installation requirements | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Set installation options | ||
RUN echo 'debconf debconf/frontend select Noninteractive' > /debconf-seed.txt && \ | ||
echo 'tzdata tzdata/Areas select Asia' >> /debconf-seed.txt && \ | ||
echo 'tzdata tzdata/Zones/Asia select Shanghai' >> /debconf-seed.txt && \ | ||
echo 'locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8' >> /debconf-seed.txt && \ | ||
echo 'locales locales/default_environment_locale select en_US.UTF-8' >> /debconf-seed.txt && \ | ||
debconf-set-selections /debconf-seed.txt | ||
|
||
# Use custom mirror | ||
RUN sed -i "s/archive.ubuntu.com/${UBUNTU_MIRROR}/g" /etc/apt/sources.list | ||
|
||
RUN apt-get update -qq && apt-get install -y \ | ||
wget unzip make cmake build-essential python3-distutils | ||
|
||
# Ghidra installation | ||
|
||
ARG GHIDRA_RELEASE_TAG=Ghidra_10.1.2_build | ||
ARG GHIDRA_VERSION=ghidra_10.1.2_PUBLIC | ||
ARG GHIDRA_BUILD=${GHIDRA_VERSION}_20220125 | ||
|
||
RUN wget https://github.com/NationalSecurityAgency/ghidra/releases/download/${GHIDRA_RELEASE_TAG}/${GHIDRA_BUILD}.zip && \ | ||
unzip -d ghidra ${GHIDRA_BUILD}.zip && \ | ||
rm ${GHIDRA_BUILD}.zip && \ | ||
mv ghidra/ghidra_* /opt/ghidra | ||
|
||
ENV PATH="/opt/ghidra:/opt/ghidra/support:${PATH}" | ||
ENV GHIDRA_INSTALL_DIR="/opt/ghidra" | ||
|
||
ARG Z3_VERSION="4.8.14" | ||
RUN mkdir /opt/z3 && cd /opt/z3 \ | ||
&& wget -qO- https://github.com/Z3Prover/z3/archive/z3-${Z3_VERSION}.tar.gz | tar xz --strip-components=1 \ | ||
&& mkdir build && cd build && cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DZ3_BUILD_JAVA_BINDINGS=ON \ | ||
-DZ3_INSTALL_JAVA_BINDINGS=ON .. \ | ||
&& make -j8 && make install \ | ||
&& cp /opt/z3/build/*.so /lib64 | ||
|
||
RUN mkdir -p /data/workspace | ||
COPY BinAbsInspector /data/workspace/BinAbsInspector | ||
|
||
WORKDIR /data/workspace | ||
|
||
# Build extension | ||
RUN cd BinAbsInspector \ | ||
&& gradle compileJava --warning-mode all \ | ||
&& gradle buildExtension --warning-mode all | ||
|
||
# Install extension | ||
RUN mkdir -p "${HOME}/.ghidra/.${GHIDRA_VERSION}/Extensions" && \ | ||
cp BinAbsInspector/dist/*.zip "${HOME}/.ghidra/.${GHIDRA_VERSION}/Extensions" && \ | ||
cd "${HOME}/.ghidra/.${GHIDRA_VERSION}/Extensions" && unzip *.zip | ||
|
||
# Provide an easy way to run the plugin | ||
ENTRYPOINT ["analyzeHeadless", "~", "tmp", "-deleteProject", "-overwrite", "-postScript", "BinAbsInspector.java"] |
Oops, something went wrong.