Skip to content

Bintropy

Bintropy logo

Bintropy estimates how likely a binary is to contain compressed or encrypted bytes, which is a strong hint that it is packed. It implements the entropy-based analysis tool of Lyda and Hamrock, Using Entropy Analysis to Find Encrypted and Packed Malware, as a Python package with a console script.

PyPi Python Versions Build Status Security DOI License

Features

  • The two criteria of the paper (see How it works): a binary is packed when both its average block entropy and its highest block entropy reach a threshold.
  • Three modes of operation: the whole binary and per section, as in the paper, plus per segment.
  • Three executable formats: PE, ELF and Mach-O, parsed with LIEF.
  • Configurable: block size, thresholds and the handling of blocks that are mostly zeros (or mostly one byte).
  • Plots of the entropy along the binary, with its sections and entry point.
  • A command-line tool, bintropy, and a Python API.

Quick start

$ pip install bintropy
$ bintropy /bin/ls
False
$ bintropy /bin/ls --do-not-decide
5.932568219905103 5.012807161052562

From Python:

from bintropy import bintropy

print(bintropy("program.exe"))                # True or False
print(bintropy("program.exe", decide=False))  # (highest block entropy, average block entropy)

With --plot, Bintropy draws the entropy of the binary along its sections:

Example of plot

Bintropy is part of the packing-box ecosystem:

License

Bintropy is released under the GNU General Public License v3 or later.