From 0fe976b49e85eecab751c6df761757c5a7642d61 Mon Sep 17 00:00:00 2001 From: VyacheslavIurevich Date: Fri, 1 Nov 2024 10:23:41 +0300 Subject: [PATCH 1/2] fix: change docker image in test.yml Signed-off-by: VyacheslavIurevich --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9921850..01449c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: build: runs-on: ubuntu-latest container: - image: blacktop/ghidra + image: blacktop/ghidra:11.1.0 env: GHIDRA_INSTALL_DIR: /ghidra strategy: @@ -26,7 +26,7 @@ jobs: run: | apt update apt install build-essential -y - apt install pip -y + python -m pip install --upgrade pip pip install -r requirements.txt - name: Run tests run: | From 442822b35933706b6eeb0733cdefa4e17b589e73 Mon Sep 17 00:00:00 2001 From: VyacheslavIurevich Date: Fri, 1 Nov 2024 10:42:28 +0300 Subject: [PATCH 2/2] fix: readme actualization Signed-off-by: VyacheslavIurevich --- README.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8c98857..464f6a3 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,22 @@ # recompilation_postprocessor -![Pylint](https://github.com/VyacheslavIurevich/recompilation_postprocessor/actions/workflows/pylint.yml/badge.svg) +![Pylint](https://github.com/VyacheslavIurevich/recompilation_postprocessor/actions/workflows/lint.yml/badge.svg) -This script provides ability to postprocess code, which is decompiled via Ghidra, to make it recompilable. +This script provides ability to postprocess code, which is decompiled via Ghidra, to make it closer to recompilable. # Technologies used * [Python 3.12](https://www.python.org/) * [pyhidra](https://github.com/dod-cyber-crime-center/pyhidra) -* [Ghidra](https://github.com/NationalSecurityAgency/ghidra) +* [Ghidra 11.1.0](https://github.com/NationalSecurityAgency/ghidra) Development: * [Pylint](https://www.pylint.org/) * [Pytest](https://docs.pytest.org/en/stable/) * [Shellcheck](https://www.shellcheck.net/) + +Running tests: +* [GCC](https://gcc.gnu.org/) + # Setup -Ensure that you do have Python with installed used technologies and Ghidra app. +Ensure that you do have Python with installed pip, Ghidra app and GCC compiler. If you want to run CI scripts, ensure you do have shellcheck installed. Then just clone the repo using HTTPS: ```shell @@ -46,6 +50,7 @@ python3 run.py {path to input binary} {output .c file path} ``` For example: ```shell +mkdir -p res/out python3 run.py res/in/hello_world res/out/hello_world.c ``` After this, you can try to compile output code. Example with GCC: @@ -53,6 +58,15 @@ After this, you can try to compile output code. Example with GCC: gcc res/out/hello_world.c ``` Enjoy! +# Running tests +Ensure you do have res/out directory set. +```shell +mkdir -p res/out +``` +After that, you can run our tests using pytest. +```shell +pytest src/tests/user_tests.py +``` # File structure ``` ├── run.py # Runs the postprocessor @@ -94,7 +108,7 @@ Enjoy! * Vyacheslav Kochergin. [GitHub](https://github.com/VyacheslavIurevich), [Contact](https://t.me/se4life). * Vasilii Sarapulov. [GitHub](https://github.com/Sarapulov-Vas), [Contact](https://t.me/sarpaulov). # Project status -In development. +Paused. Check our Ghidra [fork](https://github.com/VyacheslavIurevich/recompilation-ghidra) # Contributing See [CONTRIBUTING.md](./CONTRIBUTING.md) # License