Skip to content

Commit 6d092b9

Browse files
committed
Added high level README
1 parent 7f76ccf commit 6d092b9

File tree

6 files changed

+74
-11
lines changed

6 files changed

+74
-11
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# CodeCut Plugin for Ghidra
2+
3+
Ghidra Plugin for DeepCut / CodeCut GUI
4+
5+
## Theory of Operation
6+
CodeCut allows a user to assign functions to object files in Ghidra, and then interact with the binary at the object file level. Functions are assigned to object files by setting the `Namespace` field in the Ghidra database. DeepCut attempts to establish initial object file boundaries which the user can then adjust using the CodeCut Table window.
7+
8+
## Plugin Installation
9+
Follow normal Ghidra extension installation procedures. Copy the CodeCut and DeepCut extension zip into `$GHIDRA_INSTALL_DIR/Extensions` then in the main Ghidra window selection **File -> Install Extensions** and select the CodeCut and DeepCut boxes. Ghidra will tell you it needs to restart.
10+
11+
**NOTE:** After restarting and loading a CodeBrowser window, Ghidra will tell you it has found new plugins and ask if you want to configure them. Only CodeCut shows up in this window. This is because DeepCut is a "one-shot" analyzer (it is still installed).
12+
13+
## Configuring Native Python Paths & Python Dependencies
14+
Both CodeCut and DeepCut rely on native Python (outside of Ghidra) on your system. CodeCut uses native Python for guessing module names. DeepCut's model evaluation runs in native Python.
15+
16+
### Native Python Dependencies
17+
CodeCut:
18+
- nltk
19+
20+
DeepCut:
21+
- torch 1.7.1
22+
- torch-geometric 1.6.3
23+
- torch-cluster 1.5.8
24+
- torch-sparse 0.6.8
25+
- torch-scatter 2.0.5
26+
- torch-spline-conv 1.2.0
27+
28+
To install dependencies run:
29+
30+
```
31+
pip3 install nltk
32+
pip3 install torch==1.7.1+cpu torch-geometric==1.6.3 torch-cluster==1.5.8 torch-spare==0.6.8 torch-scatter==2.0.5 torch-spline-conv==1.2.0
33+
```
34+
35+
(assuming that pip3 points to the version of Python you plan to use below)
36+
37+
### Configuring CodeCut Python Path
38+
![](img/codecut-config.png)
39+
40+
Configure the native Python path for CodeCut by choosing **Edit -> Tool Options** and selecting "Python Executable."
41+
42+
### Configuring DeepCut Python Path
43+
![](img/deepcut-config.png)
44+
45+
Configure the native Python path for DeepCut by choosing **Analysis -> Analyze All Open...** and selecting **Deepcut (Prototype)**. After changing the path, click the **Apply** button.
46+
47+
## Running DeepCut Analysis
48+
DeepCut is best run as a one-shot analyzer *after* initial auto-analysis. Select **Analysis -> One Shot -> Deepcut**. After DeepCut runs, you can view the results by looking at the **Namespace** field in the **Symbol Table** view.
49+
50+
## Using CodeCut
51+
![](img/codecut-run.png)
52+
53+
After DeepCut runs, you can interact at an object file level with the **CodeCut Table** view. Select **Window -> CodeCut Table** You can have CodeCut guess the module names (based on string references) by choosing **Analysis -> Guess Module Names** in the CodeCut Table window. You can split/combine object files by right clicking on an object and choosing "Split Namespace Here" / "Combine Namespaces." You can move functions between object files (changing the boundaries of the object files) by dragging and dropping them.
54+
55+
## Building
56+
Specific build instructions are provided in the DeepCut and CodeCut subfolders.

codecut-gui/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# CodeCut / DeepCut GUI Plugin
21

3-
Ghidra Plugin for DeepCut / CodeCut GUI
2+
# Ghidra Plugin for CodeCut GUI
43

54
## Building and Installation
65

7-
JDK 11 (or newer) and Ghidra 9.1.0 (or newer) are required.
6+
Requirements are the same as the Ghidra build requirements, currently JDK 17 (or newer) is required for Ghidra 10.2.
87

98
Ghidra's standard Gradle build system is used. Set the `GHIDRA_INSTALL_DIR` environment variable before building, or set it as a Gradle property (useful for building in an IDE).
109

deepcut-ghidra/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Ghidra Deepcut Analyzer
22
=======================
33

4-
Implementation of the deepcut as a Ghidra one-shot analyzer.
4+
Implementation of Deepcut as a Ghidra one-shot analyzer.
55

66
## Building and Installation
7-
JDK 11 (or newer) and Ghidra 9.1.0 (or newer) are required.
7+
Requirements are the same as Ghidra. Currently JDK 17 (or newer) is required (for Ghidra 10.2).
88

99
Ghidra's standard Gradle build system is used. Set the
1010
`GHIDRA_INSTALL_DIR` environment variable before building, or set it as
@@ -13,7 +13,7 @@ a Gradle property (useful for building in an IDE):
1313
### Environment variable
1414
```bash
1515
$ export GHIDRA_INSTALL_DIR="/path/to/ghidra"
16-
$ ./gradlew
16+
$ ./gradle
1717
```
1818

1919
### Gradle property
@@ -30,11 +30,12 @@ used by your Ghidra installation. If you have multiple Java runtime
3030
environments installed, select the correct JRE by setting the
3131
`JAVA_HOME` environment variable before building.
3232

33-
### Python 3
34-
The deepcut graph based machine learning model needs Python 3 to
35-
execute. The analyzer calls and external python process to execute the
36-
model on a graph representation of the binary. There are no GPU
37-
requirements since the model converge quickly even running in CPU mode.
33+
### Native Python 3
34+
The Deepcut graph based machine learning model needs Python 3 to
35+
execute (outside of Ghidra). The analyzer calls an external Python
36+
process to execute the model on a graph representation of the binary.
37+
There are no GPU requirements since the model converge quickly even
38+
running in CPU mode.
3839

3940
#### Python 3 Path
4041
By default the analyzer use the command `/usr/local/bin/python3` to
@@ -73,3 +74,10 @@ Namespace field.
7374

7475
If there are any errors please make sure you are using the proper path
7576
to Python 3 and the requirement dependencies installed.
77+
78+
## Troubleshooting
79+
You can verify that dependencies are correct by navigating to:
80+
`~/.ghidra/.ghidra_${VERSION}/Extensions/deepcut-ghidra/data`
81+
and running `./python3 deepcut.py`. Python will throw errors if it
82+
can't find dependencies. If the process runs and sits there waiting
83+
for input, then the dependencies should be correct.

img/codecut-config.png

101 KB
Loading

img/codecut-run.png

50.7 KB
Loading

img/deepcut-config.png

70.2 KB
Loading

0 commit comments

Comments
 (0)