MCPcopy Index your code
hub / github.com/br0kej/bin2ml

github.com/br0kej/bin2ml @v0.4.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.3 ↗ · + Follow
472 symbols 978 edges 28 files 46 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

bin2ml

bin2ml is a command line tool to extract machine learning ready data from software binaries. It's ideal for researchers and hackers to easily extract data suitable for training machine learning approaches such as natural language processing (NLP) or Graph Neural Networks (GNN's) models using data derived from software binaries.

  • Extract a range of different data from binaries such as Attributed Control Flow Graphs, Basic Block random walks and function instructions strings powered by Radare2.
  • Multithreaded data processing throughout powered by Rayon.
  • Save processed data in ready to go formats such as graphs saved as NetworkX compatible JSON objects.
  • Experimental support for creating machine learning embedded basic block CFG's using tch-rs and TorchScript traced models.

bin2ml is under active development and is in an alpha state. Things will change as the tool is developed and built upon further.

Pre-Requisites

  • Radare2 Installed - Info on how to do this can be found here.

Quickstart

git clone https://github.com/br0kej/bin2ml
cd bin2ml
cargo build --release

Alternatively, there are two Dockerfile's provided. Dockerfile.build can be used to build the bin2ml binary without having to have cargo on your workstation or Dockerfile builds bin2ml as well as installing radare2 to provide a means of doing processing within the container.

Docs

bin2ml does come with some documentation (albeit incomplete) and has been developed using mdbook. The documentation can be locally served by installing the platform relevant version of mdbook from here and then executing the commands below:

cd bin2ml/docs
mdbook serve

Alternatively, they can be viewed raw by going to the docs folder here

License

The bin2ml source and documentation are released under the MIT license.

Citation

@misc{collyer2023bin2ml,
  author = {Josh Collyer},
  title = {bin2ml},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/br0kej/bin2ml/}},
}

Extension points exported contracts — how you extend this code

PCodeToNLP (Interface)
(no doc) [2 implementers]
src/pcode.rs

Core symbols most depended-on inside this repo

r
called by 39
docs/book/highlight.js
add
called by 29
docs/book/highlight.js
load_and_deserialize
called by 24
src/files.rs
get_save_file_path
called by 22
src/utils.rs
n
called by 22
docs/book/highlight.js
exec
called by 19
docs/book/highlight.js
build_local_call_graph
called by 14
src/agcj.rs
write_to_json
called by 13
src/extract.rs

Shape

Method 195
Function 157
Class 99
Enum 20
Interface 1

Languages

Rust74%
TypeScript26%
C1%

Modules by API surface

src/extract.rs72 symbols
docs/book/highlight.js71 symbols
src/dedup.rs38 symbols
src/normalisation.rs35 symbols
src/bb.rs29 symbols
src/files.rs28 symbols
src/agfj.rs25 symbols
src/agcj.rs22 symbols
src/networkx.rs20 symbols
src/pcode.rs19 symbols
docs/book/searcher.js19 symbols
docs/book/book.js19 symbols

For agents

$ claude mcp add bin2ml \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact