Skip to content

Commit

Permalink
First commit of pate binja plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-carciofini committed Feb 10, 2024
1 parent c5558ab commit c29b3a0
Show file tree
Hide file tree
Showing 24 changed files with 1,976 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pate_binja/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trace.txt
__pycache__
*.log
3 changes: 3 additions & 0 deletions pate_binja/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions pate_binja/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pate_binja/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pate_binja/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions pate_binja/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pate_binja/.idea/pate_binja.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions pate_binja/.idea/runConfigurations/test_may23_c10_live.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions pate_binja/.idea/runConfigurations/test_may23_c10_replay.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions pate_binja/.idea/runConfigurations/test_nov23_t1_rm1018_live.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions pate_binja/.idea/runConfigurations/test_nov23_t1_rm1018_replay.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pate_binja/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 61 additions & 0 deletions pate_binja/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# PATE Verifier Plugin for Binary Ninja

This is an early release of the PATE plugin for Binary Ninja (Binja). At this time, there is no interface to specify PATE parameters. There are three hard coded demos that can be run in replay or live mode:

- May23 Challenge 10
- Nov23 Target 1 Room 1018
- Nov23 Target 4 Room 1011 dendy

## Installation

The plugin was developed on macOS. It should run on linux, but has not been tested (yet). It will not run on Windows due to process and path handling differences.

To use this plugin in Binja, put this directory (or a symlink to this directory) in:
- macOS: ~/Library/Application Support/Binary Ninja/plugins/
- Linux: ~/.binaryninja/plugins/

Clone the [PATE Binja Demos repo](https://gitlab-ext.galois.com/pate/pate-binja-demos) and define an environment variable to point at the cloned directory;
```bash
export PATE_BINJA_DEMOS=<pate binja demos directory>
```

To run replays of the PATE Verifier you do not need any more configuration.

If you want to run the PATE Verifier live, you need to install a PATE docker image or build PATE from source. See the [PATE project](https://github.com/GaloisInc/pate) for instructions. To run PATE built from source you do not also need to define these the environment variables:
```bash
export PATE=<pate source directory>
export PATE_BINJA_MODE=BUILD
```

No environment variables are needed to run PATE docker.

## Running

To run the PATE Verifier live (docker or built from source) you need to start Binja from a bash shell because it needs your bash environment. For example, on macOS:
```bash
open /Applications/Binary\ Ninja.app
```
If you only want to run replays, you can launch Binary Ninja from the macOS Dock.

Once Binary Ninja is running, the demos are available in the "Plugins" menu.

## Developer Notes (macOS with PyCharm Pro)

You must launch PyCharm Pro from a bash shell because it needs your bash environment. For example, on macOS:
```bash
open /Applications/PyCharm.app
```

To install the Binja api for completion in PyCharm:

- Setup project with venv (Python 3.11 or newer)
- Go to python console (runs within venv)
- python /Applications/Binary\ Ninja.app/Contents/Resources/scripts/install_api.py

To setup debugging:

- See https://docs.binary.ninja/dev/plugins.html#remote-debugging-with-intellij-pycharm
- In Binja settings specify python interpreter and site package dir to point at your Pycharm project venv installs.
- Create the run config. Note "pip install ..." command line for next step. Pick a port.
- In Pycharm python console (venv) execute the "pip install ..." command.
- May also need/want to set python interpreter and site packages in Binary Ninja settings to the venv for the pyCharm project.
2 changes: 2 additions & 0 deletions pate_binja/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import view

Loading

0 comments on commit c29b3a0

Please sign in to comment.