Skip to main content

Python package for managing the LOOBins model and schema.

Project description

PyLOOBins

PyLOOBins is a Python SDK and command-line utility for programmatically interacting with LOOBins.

You can download PyLOOBins from PyPI by running the following command: pip install pyloobins

PyLOOBins requires Python 3.8 or later.

Usage

Command-line

You can run pyloobins --help to see the available commands and options.

>>> pyloobins --help

Usage: pyloobins [OPTIONS] COMMAND [ARGS]...

  Create, validate, and view LOOBin objects.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  create       Create a YAML template file for a new LOOBin.
  export-stix  Export the LOOBins STIX bundle file.
  get          Get a LOOBin object.
  validate     Validate a LOOBin YAML file.

You can run pyloobins <command> --help to see the available options for a specific command.

>>> pyloobins validate --help
Usage: pyloobins validate [OPTIONS]

  Validate a LOOBin YAML file.

Options:
  --path TEXT  The path of the LOOBin YAML file to validate.  [required]
  --help       Show this message and exit.

SDK

You can use pyloobins as a Python SDK to programmatically interact with LOOBins.

pyloobins.util

The util module can be used to get LOOBin objects from the LOOBins API, validate LOOBin YAML files, and create LOOBin YAML templates.

Example: get all LOOBins and print a list of the use case code.

from pyloobins import util

loobins = util.get_loobins()

for loobin in loobins:
  for uc in loobin.example_use_cases:
    print(f"{loobin.name}: {uc.code}")

pyloobins.models

The models module contains the classes that represent a LOOBin and its various components.

Example: programmitcally create a LOOBin object.

from pyloobins.models import Detection, ExampleUseCase, LOOBin, Resource

l = LOOBin(
        name="",
        short_description="A short description of the binary goes here.",
        full_description="A full length description of the binary goes here.",
        author="Enter your name or alias here.",
        created=date.today(),
        example_use_cases=[
            ExampleUseCase(
                name="An Example Use Case",
                description="A description of the use case goes here.",
                code="A code snippet goes here.",
                tactics=["Discovery"],
                tags=["example_tag", "another_tag"],
            )
        ],
        paths=["/enter/binary/path/here"],
        detections=[
            Detection(
                name="A detection source (e.g. Sigma)",
                url="https://urltodetection.here",
            )
        ],
        resources=[
            Resource(
                name="Name of resources.",
                url="https://urlofexternalreference.here",
            )
        ],
        acknowledgements=["Enter any acknowledgements here."],
    )

with open ("loobin.yaml", "w") as f:
  f.write(l.to_yaml())

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

pyloobins-2.0.1.tar.gz (43.3 kB view details)

Uploaded Source

Built Distribution

pyloobins-2.0.1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file pyloobins-2.0.1.tar.gz.

File metadata

  • Download URL: pyloobins-2.0.1.tar.gz
  • Upload date:
  • Size: 43.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1015-azure

File hashes

Hashes for pyloobins-2.0.1.tar.gz
Algorithm Hash digest
SHA256 a8223c0a111e51ce263931a53e1c52cbb3c4ff124c415a187cc82cf80df4065d
MD5 df825a0bd4b0e841366de28709f4e659
BLAKE2b-256 617d692e8e34427cff9d91c267faf1eed14d8bdbc5e94739b9692527bf988ecd

See more details on using hashes here.

File details

Details for the file pyloobins-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyloobins-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1015-azure

File hashes

Hashes for pyloobins-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55c7e527850712272c43b6188d5385c5093414bc1c2fed1f4fa5e7a507386953
MD5 c74699be88a4fbe6da44af234f280b3d
BLAKE2b-256 7d5843bf63a235fe8e3294e7eab3ab84f133f480e9b0b469d6853c695633c0f1

See more details on using hashes here.

Supported by

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