Skip to main content

A toolset to help identify malware in Python projects.

Project description

A toolset to identify malware in Python projects.

PyPI - Version PyPI - Implementation PyPI - Python Version PyPI - Status Static Badge Static Badge Static Badge Documentation Status PyPI - License PyPI - Wheel

Overview

The badsnakes project is a CPython library and command line utility which plugs the gap in malware analysis for Python-based malware by employing code and syntax analysis, searching for various patterns and techniques used by threat actors.

After a Python module is analysed, a report can be generated showing the module's 'classification' as OK, SUSPECT or DANGEROUS. If run in verbose mode, each offending statement is displayed to the terminal, along with the reason for the classification. Additionally, all SUSPECT and DANGEROUS statements can be written to a log file for further inspection and analysis.

Note: This tool will flag false-positives, as we feel it's better to fail-safe.

Many lower-level libraries use similar techniques to threat actors by leveraging the inner-workings of the Python language beyond PEP-oriented or production-style code. As such, this is an advisory system designed to highlight statements which may be considered suspect, and worth investigating further. This is not designed to be a GO / NO-GO system.

The Toolset

The current toolset enables malware inspection from the following input sources, either as a library, to be imported and wrapped by your own project(s), or as a command line utility.

  • Directory search
  • Single or multiple Python modules
  • Single or multiple Python wheels

For descriptive usage, please refer to the Using the Library or From the Command Line sections.

Installation

Likely, the easiest way to install badsnakes is using pip after activating your virtual environment::

pip install badsnakes

This will install both the library and the command line utility.

Additional (older) releases can be found either at PyPI in GitHub Releases.

Using the Library

The documentation suite contains detailed explanation and example usage for each of the library's importable modules. For detailed documentation, usage examples and links the source code itself, please refer to the Library API Documentation section of the documentation.

From the Command Line

In addition to being an importable library, badsnakes is also a command line utility, capable of analysing, reporting and logging the following input types:

  • Directories
  • Single or multiple Python modules
  • Single or multiple Python wheels

To call up the help menu, simply type:

$ badsnakes --help

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

badsnakes-0.1.0.tar.gz (8.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

badsnakes-0.1.0-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

Details for the file badsnakes-0.1.0.tar.gz.

File metadata

  • Download URL: badsnakes-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for badsnakes-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb33059c8a38f2205dac7922d9e6e6c97d9e913e99c78ebbda8fe46d3fc2fd4f
MD5 fbc15ecf1c801f1a9c4b90fe484acb81
BLAKE2b-256 63d9262f0c704dfe77d1df33bd8c986dd8906b5eeb878b4fecda833ac4cd4801

See more details on using hashes here.

File details

Details for the file badsnakes-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: badsnakes-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for badsnakes-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed44c98a59c5e304823710e5e13271823cf25fb6c87797149d2f7e821316d4e2
MD5 0608ad5ddfd6ef7b1e095fff9dd4482f
BLAKE2b-256 60ed7445316a2f9127cefde7c9e9001011f0453b1d87f5c969074da717543a46

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