Skip to main content

A library for code similarity estimation using PIC hashing over basic blocks.

Project description

PicBlocks

An experimental project using position-independent code hashing over basic blocks for code similarity estimation.

Usage

Both module files in ./picblocks are runnable and contain examples of their usage:

  • $ python -m picblocks.blockhasher <target_binary_path> - produces a block-report for a single binary.
  • $ python -m picblocks.blockhashmatcher <block_reports_path> - creates a new ./db/picblocksdb.json from the block-reports located in <block_reports_path>
  • $ python -m blocks.blockhashmatcher <block_reports_path> <target_binary_path> - matches a binary against data stored in ./db/picblocksdb.json if it exists, or otherwise creates ./db/picblocksdb.json from the block-reports located in <block_reports_path>

Creating a database

The script hash_malpedia.py is an example of how to process a collection of binaries into ./block-reports, which will then be aggreated into a ./db/picblocksdb.json.

Running a service

If a ./db/picblocksdb.json exists, you can run

$ python app.py

to spawn a local demo server (https://127.0.0.1:9001) to query against.

Version History

  • 2021-09-12: v1.0.6 - added submission form fields for bitness and base address to force overrides for those values.
  • 2021-08-24: v1.0.5 - improved parsing of bitness from submission filenames.
  • 2021-08-20: v1.0.4 - Tweaked result visualization, now showing all unique matches beyond the first 20.

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

picblocks-1.0.6.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file picblocks-1.0.6.tar.gz.

File metadata

  • Download URL: picblocks-1.0.6.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.10

File hashes

Hashes for picblocks-1.0.6.tar.gz
Algorithm Hash digest
SHA256 782a1374e6febc15d8c04859313ccc8ffb9813ddb0e5bb7963225312696ee37f
MD5 139df5171fd9758b645c3759f0813390
BLAKE2b-256 c7f6a260a37348a4284f29d5a5028cdd7d80ec38df7061765cba03b108646130

See more details on using hashes here.

Supported by

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