Skip to content

Commit 1a73990

Browse files
committed
[WARP] Update documentation with new functionality
1 parent a1bedad commit 1a73990

File tree

2 files changed

+82
-41
lines changed

2 files changed

+82
-41
lines changed

docs/guide/warp.md

Lines changed: 82 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ When a function matches, we will apply the following information:
4141
Files are automatically loaded from two locations when Binary Ninja starts:
4242

4343
- [Install Directory] + `/signatures/`
44-
- Can be disabled using the setting `analysis.warp.loadBundledFiles`.
44+
- Can be disabled using the setting `warp.container.loadBundledFiles`.
4545
- [User Directory] + `/signatures/`
46-
- Can be disabled using the setting `analysis.warp.loadUserFiles`.
46+
- Can be disabled using the setting `warp.container.loadUserFiles`.
4747

4848
???+ Danger "Warning"
4949
Always place your signature libraries in your user directory. The installation path is wiped whenever Binary Ninja auto-updates. You can locate it with `Open Plugin Folder` in the command palette and navigate "up" a directory.
@@ -112,6 +112,62 @@ Information in the WARP file will be deduplicated across all processed files aut
112112
If your files are too large, try and adjust the file data to something like "Symbols" only, and if you are looking to
113113
make the files load quicker, turn off compression.
114114

115+
## Networked Functionality
116+
117+
WARP for Binary Ninja provides the ability to lazily pull data (functions, types) from a WARP server, by default, networked
118+
functionality is disabled, as it requires sending the functions platform (`windows-x86`) and GUID (`2f893a32-8592-54e2-8052-207603976686`)
119+
which can be considered sensitive information, see [Connecting](#connecting) to learn how to enable this functionality.
120+
121+
### Connecting
122+
123+
To enable turn on `network.enableWARP` and restart, server connection settings exist in the regular WARP setting group,
124+
and the default primary server is https://warp.binary.ninja. You can also give it an API token so that you can be logged
125+
in as your user, and have access to push data to your sources using `warp.container.serverApiKey`.
126+
127+
Once restarted, you should see a log message indicating you have connected. You can also verify connections in the WARP
128+
sidebar under the "Containers" tab which should list the provided WARP server(s) alongside any of your sources you have created.
129+
130+
### Pulling Networked Data
131+
132+
To pull networked data, you must have successfully connected and have an open binary view, after which,
133+
you can use the command `WARP\\Fetch` or using the ⬇ button within the WARP sidebar. This will open a
134+
dialog which will, in batches, pull down all the necessary data for matching all functions in a binary.
135+
136+
By default, we will only ever pull down data from "official" and "trusted" tagged sources. You can change the default
137+
globally by modifying the setting `warp.fetcher.allowedSourceTags` as a comma separated list. These tags are assigned
138+
from within the server UI, either by source users or the server admin, the tags "official" and "trusted" may only be added
139+
or removed by the server admin.
140+
141+
![Fetch Dialog](../img/warp/fetch_dialog.png "Fetch Dialog")
142+
143+
???+ Info "Tip"
144+
Fetching of function information from the server will also be done on demand when navigating to a function for the first time
145+
with the WARP sidebar open. The fetched functions will be shown in the "Matched Functions" sidebar automatically, however,
146+
you will need to run the matcher to apply the information to the analysis.
147+
148+
In the case where you want fetching to be done automatically, set `analysis.warp.fetcher` to true, this will cause the fetcher
149+
to run at the end of the analysis, useful if you are working with binaries headlessly and do not mind waiting for the fetcher
150+
to complete.
151+
152+
### Pushing Networked Data
153+
154+
To push data to the server, you must provide an API key. This can be done either self-service or by the server admin.
155+
156+
To get an API key using the website:
157+
158+
1. Navigate to the account settings page (https://warp.binary.ninja/account)
159+
2. Give a name to the key and hit "Add Key"
160+
3. Copy the API key and open Binary Ninja
161+
4. Paste the API key into the setting `warp.container.serverApiKey`
162+
163+
Once restarted, you should see a log message indicating you have connected as the associated user.
164+
165+
After logging in, you can create a new source on the server by right-clicking in the container sources tab and selecting
166+
"Add Source" you can also do this via the website.
167+
168+
Once you have created a source, you can start pushing your WARP files to them using the command `WARP\\Commit File` or
169+
using the ⬆ button within the WARP sidebar.
170+
115171
## Overwriting Matched Functions
116172

117173
WARP will not always be able to identify the unique function in the matcher. In this case we give the user a few
@@ -123,56 +179,32 @@ options for resolving the matched function:
123179

124180
All matched functions are stored in the BNDB, so you do not need to provide signature files when distributing databases.
125181

182+
## Removing Matched Functions
183+
184+
Using the command "WARP\\Remove Matched Function" or via the context menu in the WARP sidebar, you can remove matched function
185+
information. You may also want to run the complementary command `WARP\\Ignore Function` which will prevent the selected function
186+
from being matched automatically in the future.
187+
126188
## API
127189

128190
To create, query and load WARP data programmatically, we provide a [Python API]. For those looking to interact with WARP
129191
from Rust because the plugin is open source, you can depend _directly_ on the [Rust plugin], skipping the FFI entirely.
130192

193+
### Rust example (recommended)
194+
195+
This example will use the Rust API directly to generate WARP files from given inputs, it will automatically parallelize
196+
the work, so it will be much faster than the Python example.
197+
198+
Find the example [here](https://github.com/Vector35/binaryninja-api/tree/dev/plugins/warp/examples/headless).
199+
131200
### Python example
132201

133202
This example will open a binary in Binary Ninja then output a WARP signature file.
134203

135-
```python
136-
import sys
137-
from pathlib import Path
138-
from binaryninja import load
139-
from binaryninja.warp import WarpContainer, WarpFunction, WarpTarget
140-
141-
def process_binary(input_file: str, output_dir: str) -> None:
142-
input_path = Path(input_file)
143-
output_dir = Path(output_dir)
144-
output_dir.mkdir(parents=True, exist_ok=True)
145-
bv = load(input_path)
146-
bv.update_analysis_and_wait()
147-
if not bv:
148-
return
149-
150-
# Sources exist only in containers, so we will just pull off the first available container.
151-
# In the future we might make container construction available to the API.
152-
container = WarpContainer.all()[0]
153-
output_file = output_dir / f"{input_path.stem}_analysis.warp"
154-
# Add the source so we can add functions to it and then commit it (write to disk)
155-
source = container.add_source(str(output_file))
156-
157-
# NOTE: You probably want to pull the platform from the function, but for this example it's fine.
158-
target = WarpTarget(bv.platform)
159-
# NOTE: You probably want to filter for functions with actual annotations, no point to signature a function with no symbol.
160-
functions_to_warp = [WarpFunction(func) for func in bv.functions]
161-
container.add_functions(target, source, functions_to_warp)
162-
163-
# Actually write the warp file to disk.
164-
container.commit_source(source)
165-
bv.file.close()
166-
167-
if __name__ == "__main__":
168-
if len(sys.argv) != 3:
169-
print(f"Usage: {sys.argv[0]} <input_binary> <output_directory>")
170-
sys.exit(1)
171-
process_binary(sys.argv[1], sys.argv[2])
172-
```
173-
174204
The flexibility of the API allows you to include or exclude any functions you want from the creation of the signature file.
175205

206+
Find the example [here](https://github.com/Vector35/binaryninja-api/tree/dev/plugins/warp/examples/create_signatures.py).
207+
176208
## Troubleshooting
177209

178210
### Why do these very similar functions have a different function GUID?
@@ -198,6 +230,11 @@ When running the matcher manually, you may get a warning about no relocatable re
198230
sections or segments in your view. For WARP to work we must have some range of address space to work with, without it the
199231
function GUID's will likely be inconsistent if the functions can be based at different addresses.
200232

233+
### Failed to connect to the server
234+
235+
If you fail to connect to a WARP server, you will receive an error in the log. Outside typical network connectivity issues
236+
it is possible the provided server URL is malformed, verify that the URL looks similar to the default server URL: `https://warp.binary.ninja`
237+
201238
## Glossary
202239

203240
Here is a list of terms used and a simplified description, please see the [WARP] spec repository for a more detailed description.
@@ -211,6 +248,10 @@ A **Container** stores and manages WARP data, whether in memory, on disk or over
211248
### Source
212249
A **Source** is a collection of WARP data within a container, like a file containing function and type information.
213250

251+
### Source Tag
252+
A **Source Tag** is an arbitrary string that is used for filtering fetched function data from containers, useful when dealing with larger potentially
253+
untrusted datasets.
254+
214255
### Function
215256
A **Function** in WARP represents the collection of metadata that we wish to transfer, such as the symbol, comments and types.
216257

docs/img/warp/fetch_dialog.png

120 KB
Loading

0 commit comments

Comments
 (0)