Skip to main content

A framework to analyze programs running in environments

Project description

Binharness

Binharness is a framework to facilitate analyzing binary programs in various environments. It enables users to specify targets and environments to analyze those targets in.

Features

  • Run targets in a local environment
  • Run targets in a remote environment using Binharness agent
  • Allow clients to detach from the agent and reconnect later (ie. for long-running analyses and road-warrior scenarios)
  • Automatically bootstrap a remote environment over SSH
  • Automatically bootstrap a remote environment in Docker
  • Automatically bootstrap a remote environment in Kubernetes

Quickstart

Binharness is currently in a pre-alpha state. While it is possible to use it, expect the API to change as new ideas are explored.

Concepts

  • Environment: A machine that can run targets. This can be a local machine or a remote machine. It could also be a virtual machine or a container. At its core, Binharness is not about managing environments, but bootstraping some environments like containers is planned for ease of use.

    There are two seperate implemenations of the environment: a local environment that is implemented in Python, and a remote environment that is implemented in Rust and uses a client/server archetecture.

  • Target: A program to analyze. A target exists independently of an environment. A target can be loaded from an environment, or it can be loaded from a file and "injected" into an environment where it is used.

  • Injection: An injection is how Binharness models adding files into an environment.

  • Executor: An executor is a way to run a target. It is a wrapper around the target that provides a consistent interface for running the target. It also provides a way to collect results from the target. Examples of programs that can be used to create Binharness Executors are tracers, fuzzers, debuggers and translation layers.

Development

Project layout

Binharness contains a few different components, written in a mix of Python in Rust. The Rust code contains three crates: a client, a server, and a shared library. The server is intended to be a highly-portable binary that can be statically compiled and run in as many environments as possible. The client is a PyO3-based Python module that can be imported and used by Python code. The shared library contains code that is shared between the client and server. The Python code implements the primary user-facing API, and is intended to be used as a library in applications that use Binharness. The PyO3 module is intended to be a relievely low-overhead wrapper around the Rust code, and is not intended to be used directly by users. By comparison, the Python code is intended to implement a higher-level, "Pythonic" API that is easy and intuitive to use.

The directories looks like this:

binharness/
  crates/
    bh_agent_client/ - Client code for communicating with the binharness agent
    bh_agent_common/ - Shared code between the agent client and server
    bh_agent_server/ - The agent server program
  python/
    binharness/ - User facing-python module
    tests/ - Test code

Prior art

  • archr - A framework for "target-based" program analysis. It is similar to Binharness in that it can run targets in local and containerized environeents, however it defines a target as the binary and the system or container where it is run. Binharness seeks to improve on this by separating the target from the environment, allowing more flexibility, as well as allowing detaching from an analysis and retrieving results later.
  • angr - A binary analysis framework. angr is an excellent python-based framework for binary analysis, and it has good support for modeling the environment that a binary is run in, including controlling behaviour at the function level using simprocedures and at the OS level using SimOS. Binharness looks to avoid modeling the environment and instead allow the user to use an existing environment, like a container. For use cases that benefit from a tool like angr, Binharness looks to be able to integrate with it.
  • docker - A containerization platform. Docker is the go-to tool for containerization, and has popularized using container images to couple programs with configured environements. While it has been successfully used for program analysis through existing tools like archr, it is not desgined for this use case and requires other tools to make effective use of it. Binharness looks to leverage docker and its ecosystem to take advatage of its strengths like image management and runtime isolation.
  • SSH SSH is the primary protocol for remote access and management of machines. Binharness uses SSH as one of the primary ways to bootrap remote environments. In a previous version, Binharness used SSH as the primary way to communicate with remote environments as well, but this has been replaced with a custom protocol due to limitations of SSH.
  • Ansible - A configuration management tool. Ansible is a popular tool for configuring remote machines, and could be used as an alternative to Binharness for bootstrapping remote environments. However, it lacks support for collecting results from remote machines in a convenient way. It also doesn't have an interface to integrate analyses, so the user would need to manually orchestrate the analysis.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

binharness-0.1.1.tar.gz (32.5 kB view hashes)

Uploaded Source

Built Distributions

binharness-0.1.1-cp312-none-win_amd64.whl (327.9 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

binharness-0.1.1-cp312-none-win32.whl (312.1 kB view hashes)

Uploaded CPython 3.12 Windows x86

binharness-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (416.7 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

binharness-0.1.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl (518.5 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ s390x

binharness-0.1.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (451.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ppc64le

binharness-0.1.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (417.4 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARMv7l

binharness-0.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (400.5 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

binharness-0.1.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl (424.3 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.12+ i686

binharness-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (362.5 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

binharness-0.1.1-cp312-cp312-macosx_10_12_x86_64.whl (379.5 kB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

binharness-0.1.1-cp311-none-win_amd64.whl (327.0 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

binharness-0.1.1-cp311-none-win32.whl (312.6 kB view hashes)

Uploaded CPython 3.11 Windows x86

binharness-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (417.2 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

binharness-0.1.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl (518.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ s390x

binharness-0.1.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (451.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

binharness-0.1.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (419.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARMv7l

binharness-0.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (401.1 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

binharness-0.1.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl (424.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.12+ i686

binharness-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (363.1 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

binharness-0.1.1-cp311-cp311-macosx_10_12_x86_64.whl (378.8 kB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

binharness-0.1.1-cp310-none-win_amd64.whl (326.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

binharness-0.1.1-cp310-none-win32.whl (312.5 kB view hashes)

Uploaded CPython 3.10 Windows x86

binharness-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (417.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

binharness-0.1.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl (518.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ s390x

binharness-0.1.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (451.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

binharness-0.1.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (419.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARMv7l

binharness-0.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (401.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

binharness-0.1.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl (424.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ i686

binharness-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (363.0 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

binharness-0.1.1-cp310-cp310-macosx_10_12_x86_64.whl (378.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.12+ x86-64

binharness-0.1.1-cp39-none-win_amd64.whl (327.2 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

binharness-0.1.1-cp39-none-win32.whl (312.7 kB view hashes)

Uploaded CPython 3.9 Windows x86

binharness-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (417.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

binharness-0.1.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl (518.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ s390x

binharness-0.1.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (452.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

binharness-0.1.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (419.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARMv7l

binharness-0.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (401.2 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

binharness-0.1.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl (425.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686

binharness-0.1.1-cp39-cp39-macosx_11_0_arm64.whl (363.3 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

binharness-0.1.1-cp39-cp39-macosx_10_12_x86_64.whl (379.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.12+ x86-64

binharness-0.1.1-cp38-none-win_amd64.whl (327.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

binharness-0.1.1-cp38-none-win32.whl (312.7 kB view hashes)

Uploaded CPython 3.8 Windows x86

binharness-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (417.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

binharness-0.1.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl (518.8 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ s390x

binharness-0.1.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (452.2 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

binharness-0.1.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (419.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARMv7l

binharness-0.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (401.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

binharness-0.1.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl (425.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

binharness-0.1.1-cp38-cp38-macosx_11_0_arm64.whl (363.3 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

binharness-0.1.1-cp38-cp38-macosx_10_12_x86_64.whl (379.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page