### Install Ghidrathon Python Dependencies and Configure Source: https://github.com/mandiant/ghidrathon/blob/main/README.md These commands guide the user through installing the necessary Python packages for Ghidrathon from a `requirements.txt` file and then executing the `ghidrathon_configure.py` script. The configuration script integrates Ghidrathon with the specified Ghidra installation directory, setting up the Python 3 environment for Ghidra. ```Bash $ python -m pip install -r requirements.txt $ python ghidrathon_configure.py ``` -------------------------------- ### Ghidrathon System Requirements Source: https://github.com/mandiant/ghidrathon/blob/main/README.md This section outlines the essential software and their minimum version requirements for successfully installing and operating Ghidrathon. It serves as a quick reference for users to ensure their environment meets the necessary prerequisites before proceeding with the installation. ```APIDOC Tool | Version |Source ---|---|--- Ghidrathon | >= 4.0.0 | https://github.com/mandiant/Ghidrathon/releases Python | >= 3.8.0 | https://www.python.org/downloads Jep | == 4.2.0 | https://pypi.org/project/jep Ghidra | >= 10.3.2 | https://github.com/NationalSecurityAgency/ghidra/releases Java | >= 17.0.0 | https://adoptium.net/temurin/releases ``` -------------------------------- ### Build Ghidrathon using Gradle Source: https://github.com/mandiant/ghidrathon/blob/main/doc/building.md Execute this Gradle command from the Ghidrathon source directory to build the project. The `GHIDRA_INSTALL_DIR` property must be set to the absolute path of your Ghidra installation. Ensure the supported Jep JAR release is downloaded to the `\lib` directory before running this command. ```Shell $ gradle -PGHIDRA_INSTALL_DIR= ``` -------------------------------- ### Specify Jep Library Version for Python Source: https://github.com/mandiant/ghidrathon/blob/main/util/requirements.txt This snippet defines a specific version requirement for the 'jep' library, commonly used in Python dependency files like `requirements.txt`. It ensures that version 4.2.0 of 'jep' is installed, preventing compatibility issues. ```Python jep==4.2.0 ``` -------------------------------- ### Set Ghidrathon Save Path Environment Variable (Windows) Source: https://github.com/mandiant/ghidrathon/blob/main/README.md This command illustrates how to set the `GHIDRATHON_SAVE_PATH` environment variable on Windows systems. By setting this variable, users can define a specific directory for Ghidrathon to store its `ghidrathon.save` file, providing flexibility beyond the default Ghidra installation location. ```Batch $ set GHIDRATHON_SAVE_PATH="C:\path\to\custom\dir" ``` -------------------------------- ### Set Ghidrathon Save Path Environment Variable (Linux/MacOS) Source: https://github.com/mandiant/ghidrathon/blob/main/README.md This command demonstrates how to set the `GHIDRATHON_SAVE_PATH` environment variable on Linux or MacOS systems. This variable allows users to specify a custom directory for Ghidrathon to write its `ghidrathon.save` file, overriding the default behavior of writing it to the Ghidra installation directory. ```Bash $ export GHIDRATHON_SAVE_PATH="/path/to/custom/dir" ``` -------------------------------- ### Identify Code Formatting Errors with Linting Tools Source: https://github.com/mandiant/ghidrathon/blob/main/doc/contributing.md Use these shell commands to check for formatting errors in Python and Java source files within the Ghidrathon project. The commands utilize `isort` and `black` for Python code, and `google-java-format` for Java code, performing a dry run to report issues without applying changes. ```Bash $ isort --profile black --length-sort --line-width 120 -c /local/path/to/src $ black -l 120 -c /local/path/to/src $ find /local/path/to/src -name "*.java" -type f -print | xargs java -jar google-java-format-1.19.2-all-deps.jar --dry-run --set-exit-if-changed ``` -------------------------------- ### Executing Ghidra Python Scripts in Headless Mode Source: https://github.com/mandiant/ghidrathon/blob/main/README.md This snippet demonstrates how to run a Ghidra Python 3 script using the `analyzeHeadless` command-line tool. It shows the command syntax and typical output, allowing for automated analysis without the Ghidra GUI. ```Shell $ analyzeHeadless C:\Users\wampus example -process example.o -postScript ghidrathon_example.py [...] INFO SCRIPT: C:\Users\wampus\.ghidra\.ghidra_10.0.3_PUBLIC\Extensions\Ghidrathon-master\ghidra_scripts\ghidrathon_example.py (HeadlessAnalyzer) Function _init @ 0x101000: 3 blocks, 8 instructions Function FUN_00101020 @ 0x101020: 1 blocks, 2 instructions Function __cxa_finalize @ 0x101040: 1 blocks, 2 instructions Function printf @ 0x101050: 1 blocks, 2 instructions Function _start @ 0x101060: 1 blocks, 13 instructions Function deregister_tm_clones @ 0x101090: 4 blocks, 9 instructions Function register_tm_clones @ 0x1010c0: 4 blocks, 14 instructions Function __do_global_dtors_aux @ 0x101100: 5 blocks, 14 instructions [...] INFO REPORT: Post-analysis succeeded for file: /example.o (HeadlessAnalyzer) INFO REPORT: Save succeeded for processed file: /example.o (HeadlessAnalyzer) ``` -------------------------------- ### Accessing Ghidra Scripting API in Python 3 Source: https://github.com/mandiant/ghidrathon/blob/main/README.md This section outlines how Ghidrathon makes Ghidra's `GhidraScript` state variables and `FlatProgramAPI` methods available to Python 3 scripts. It emphasizes that state variables are accessed as function calls (e.g., `currentProgram()`) to ensure correct state during execution, and these are available to all imported modules. ```APIDOC GhidraScript State Variables (Python 3 Access): - currentProgram(): Returns the current Ghidra program object. - (Other GhidraScript state variables are similarly exposed as function calls.) FlatProgramAPI Methods (Python 3 Access): - findBytes(start_address, end_address, byte_pattern, mask, find_forward): Searches for byte patterns within a specified address range. - (Other FlatProgramAPI methods are directly accessible.) Note: All Python modules imported by your script have access to these variables and methods via the Python builtins scope. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.