You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,8 +72,11 @@ Three backends are supported, selected with `--backend` (default `auto`, which p
72
72
73
73
The angr export is structurally identical to the others (same files and metadata); its pseudo-C is lower quality than Hex-Rays or r2ghidra.
74
74
75
+
4.**Binary Ninja**, is opt-in (`--backend binja`) and never chosen by `auto`, because it drives a running Binary Ninja instead of reading a file. See [Binary Ninja](#binary-ninja) below.
76
+
75
77
Other disassemblers may be added in the future.
76
78
79
+
77
80
### Using
78
81
79
82
ToCode supports Windows, Linux, and macOS with Python 3.10 or newer.
The Binary Ninja backend exports the binary you already have **open** in Binary Ninja, emitting its Pseudo C. It does **not** need a Binary Ninja *headless* license: ToCode connects to the running GUI over a small RPC bridge.
132
+
133
+
Since I don't have access to Binary Ninja headless, run this script once in Binary Ninja's Python console to open an RPC server ToCode can connect to:
print("ToCode RPC server listening on 127.0.0.1:18812")
154
+
```
155
+
156
+
It exposes the whole Binary Ninja Python VM with no authentication, so keep it bound to `127.0.0.1`. The [binja-headless](https://github.com/hugsy/binja-headless) plugin exposes the same interface if you prefer a packaged option.
157
+
158
+
Then drive it from ToCode:
159
+
160
+
```bash
161
+
tocode --backend binja --list-binja # list open views with an index
162
+
tocode --backend binja -o out/ # export the focused view
163
+
tocode --backend binja --binja-view 1 -o out/ # export a specific view by index
164
+
tocode --backend binja --all-views -o out/ # export every open view, one folder each
165
+
```
166
+
167
+
Use `--binja-host` / `--binja-port` (or `TOCODE_BINJA_HOST` / `TOCODE_BINJA_PORT`; default `127.0.0.1:18812`) to reach Binary Ninja on another machine.
168
+
169
+
Already scripting inside Binary Ninja? Skip the server and export the live view directly:
0 commit comments