https://github.com/packing-box/bintropy
Analysis tool for estimating the likelihood that a binary contains compressed or encrypted bytes
https://github.com/packing-box/bintropy
binary-analysis elf elf-binaries elf-format entropy executable-packing lief mach-o malware-analysis malware-packers malware-research packing-detection pe-file pe-files pe-format python research-tools
Last synced: 3 days ago
JSON representation
Analysis tool for estimating the likelihood that a binary contains compressed or encrypted bytes
- Host: GitHub
- URL: https://github.com/packing-box/bintropy
- Owner: packing-box
- License: gpl-3.0
- Created: 2021-07-03T08:20:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-01T22:17:16.000Z (about 1 year ago)
- Last Synced: 2025-09-30T05:21:17.707Z (2 months ago)
- Topics: binary-analysis, elf, elf-binaries, elf-format, entropy, executable-packing, lief, mach-o, malware-analysis, malware-packers, malware-research, packing-detection, pe-file, pe-files, pe-format, python, research-tools
- Language: Python
- Homepage:
- Size: 334 KB
- Stars: 47
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-executable-packing - Bintropy - Prototype analysis tool that estimates the likelihood that a binary file contains compressed or encrypted bytes. (:wrench: Tools / Before 2000)
README

Bintropy
Detect packers on PE/ELF/Mach-O files using entropy.
[](https://pypi.python.org/pypi/bintropy/)
[](https://pypi.python.org/pypi/bintropy/)
[](https://github.com/packing-box/bintropy/actions/workflows/python-package.yml)
[](https://zenodo.org/badge/latestdoi/382563382)
[](https://pypi.python.org/pypi/bintropy/)
This tool is an implementation in Python of Bintropy, an analysis tool presented in [this paper](https://ieeexplore.ieee.org/document/4140989) in the scope of packing detection based on entropy. It implements both modes of operation and an additional one, respectively on the entire binary, per section or per segment. It uses the entropy values mentioned in the [paper](https://ieeexplore.ieee.org/document/4140989) for deciding whether the binary contains compressed/encrypted bytes.
It relies on [`lief`](https://github.com/lief-project/LIEF) for abstracting either **PE**, **ELF** or **Mach-O** executables. This tool thus supports these three formats.
```sh
$ pip install bintropy
```
```sh
$ bintropy --help
```
### Modes of operation
Use the `-m`/`--mode` option.
- `0`: full binary (default)
- `1`: per section
- `2`: per segment
Note that mode 2 will logically give results very similar to mode 0.
```sh
$ bintropy binary
<<< boolean >>>
$ bintropy binary --dot-not-decide
<<< highest block entropy, average block entropy >>>
```
```sh
$ bintropy binary --mode [1|2]
<<< boolean >>>
$ bintropy binary -m [1|2] --do-not-decide
<<< highest block entropy, average block entropy >>>
```
### Benchmarking
Use the `-b`/`--benchmark` option to get one more value, the processing time in seconds.
```sh
$ bintropy binary -b
<<< boolean, processing time >>>
$ bintropy binary -b --do-not-decide
<<< highest block entropy, average block entropy, processing time >>>
```
### Overriding default entropy values
The [reference paper](https://ieeexplore.ieee.org/document/4140989) uses 6.677 for the average block entropy and 7.199 for the highest block entropy (obtained by analyzing a dataset of PE files and using the first mode of operation). These values can be overriden with the dedicated options.
```sh
$ bintropy binary --threshold-average-entropy 5.678 --threshold-highest-entropy 6.789
[...]
```
### Plotting
This tool features plot generation for drawing binary's sections and the entropy within.
```sh
$ bintropy binary --plot
<<< boolean >>>
```
Example of generated figures:

## :star: Related Projects
You may also like these:
- [Awesome Executable Packing](https://github.com/packing-box/awesome-executable-packing): A curated list of awesome resources related to executable packing.
- [Dataset of packed ELF files](https://github.com/packing-box/dataset-packed-elf): Dataset of ELF samples packed with many different packers.
- [Dataset of packed PE files](https://github.com/packing-box/dataset-packed-pe): Dataset of PE samples packed with many different packers (fork of [this repository](https://github.com/chesvectain/PackingData)).
- [Docker Packing Box](https://github.com/packing-box/docker-packing-box): Docker image gathering packers and tools for making datasets of packed executables.
- [DSFF](https://github.com/packing-box/python-dsff): Library implementing the DataSet File Format (DSFF).
- [PEiD](https://github.com/packing-box/peid): Python implementation of the well-known Packed Executable iDentifier ([PEiD](https://www.aldeid.com/wiki/PEiD)).
- [PyPackerDetect](https://github.com/packing-box/pypackerdetect): Packing detection tool for PE files (fork of [this repository](https://github.com/cylance/PyPackerDetect)).
- [REMINDer](https://github.com/packing-box/reminder): Packing detector using a simple heuristic (inspired from [this paper](https://ieeexplore.ieee.org/document/5404211)).
## :clap: Supporters
[](https://github.com/packing-box/bintropy/stargazers)
[](https://github.com/packing-box/bintropy/network/members)