-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add requirements
- Loading branch information
Showing
8 changed files
with
39 additions
and
49 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -168,3 +168,4 @@ res/out | |
|
||
.vscode/ | ||
.idea/ | ||
.venv/ |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# recompilation_postprocessor | ||
![Pylint](https://github.com/VyacheslavIurevich/recompilation_postprocessor/actions/workflows/pylint.yml/badge.svg) | ||
|
||
This script provides ability to postprocess code, which is decompiled via Ghidra, to make it buildable. | ||
This script provides ability to postprocess code, which is decompiled via Ghidra, to make it recompilable. | ||
# Technologies used | ||
* [Python 3.12](https://www.python.org/) | ||
* [pyhidra](https://github.com/dod-cyber-crime-center/pyhidra) | ||
|
@@ -22,18 +22,31 @@ or SSH: | |
```shell | ||
git clone [email protected]:VyacheslavIurevich/recompilation_postprocessor.git | ||
``` | ||
# Usage | ||
Set the GHIDRA_INSTALL_DIR environment variable to point to the directory where Ghidra is installed. | ||
```shell | ||
export GHIDRA_INSTALL_DIR={path to Ghidra} | ||
``` | ||
Go to main folder of repository | ||
```shell | ||
cd recompilation-postprocessor | ||
``` | ||
Create a virtual environment: | ||
```shell | ||
python3 -m venv .venv | ||
source .venv/bin/activate | ||
``` | ||
Install requirements: | ||
```shell | ||
pip install -r requirements.txt | ||
``` | ||
# Usage | ||
Run the script with input and output command line arguments. | ||
```shell | ||
python run.py {path to input binary} {output .c file path} | ||
python3 run.py {path to input binary} {output .c file path} | ||
``` | ||
For example: | ||
```shell | ||
python run.py res/in/hello_world res/out/hello_world.c | ||
python3 run.py res/in/hello_world res/out/hello_world.c | ||
``` | ||
After this, you can try to compile output code. Example with GCC: | ||
```shell | ||
|
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 |
---|---|---|
@@ -1,11 +1,3 @@ | ||
#!/bin/bash | ||
echo "Running pylint" | ||
git ls-files '*.py' | xargs pylint | ||
pylint_check_status=$? | ||
if [[ $pylint_check_status -ne 0 ]]; then | ||
echo "pylint fail" | ||
exit 1 | ||
else | ||
echo "pylint OK" | ||
exit 0 | ||
fi |
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 |
---|---|---|
@@ -1,11 +1,3 @@ | ||
#!/bin/bash | ||
echo "Running shellcheck" | ||
git ls-files '*.sh' | xargs shellcheck | ||
shellcheck_check_status=$? | ||
if [[ $shellcheck_check_status -ne 0 ]]; then | ||
echo "shellcheck fail" | ||
exit 1 | ||
else | ||
echo "shellcheck OK" | ||
exit 0 | ||
fi |
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 |
---|---|---|
@@ -1,12 +1,4 @@ | ||
#!/bin/bash | ||
echo "Run tests" | ||
mkdir res/out | ||
mkdir -p res/out | ||
pytest src/tests/user_tests.py | ||
pytest_check_status=$? | ||
if [[ $pytest_check_status -ne 0 ]]; then | ||
echo "Tests fail" | ||
exit 1 | ||
else | ||
echo "Tests OK" | ||
exit 0 | ||
fi |
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,3 @@ | ||
pyhidra==1.2.0 | ||
pytest==8.3.2 | ||
pylint==3.2.6 |
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
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