Skip to main content

BloodHound OpenGraph exporter for mfpandas RACF data

Project description

mfpandas-racfhound

Transforms a parsed mfpandas IRRDBU00 object into BloodHound OpenGraph JSON for RACF attack path analysis.

Installation

pip install mfpandas-racfhound

Requires Python 3.10+ and mfpandas.

Usage

Parse your IRRDBU00 unload with mfpandas, then pass it to to_bloodhound:

import time
from mfpandas import IRRDBU00
from mfpandas_racfhound import to_bloodhound

racf = IRRDBU00(irrdbu00="/path/to/irrdbu00.dump")
racf.parse()
while racf._state < IRRDBU00.STATE_READY:
    time.sleep(0.1)

graph = to_bloodhound(
    racf,
    apf_libs={"SYS1.LINKLIB", "SYS1.SVCLIB"},
    parmlib_datasets={"SYS1.PARMLIB"},
    proclib_datasets={"SYS1.PROCLIB"},
)

to_bloodhound returns a dict ready for upload to the BloodHound API:

{
    "graph": {
        "nodes": [...],
        "edges": [...]
    }
}

Parameters

Parameter Type Description
racf mfpandas.IRRDBU00 Parsed IRRDBU00 instance
apf_libs set[str] APF library DSNs (uppercase). Used to resolve generic dataset profiles to concrete APF libraries.
parmlib_datasets set[str] PARMLIB dataset DSNs
proclib_datasets set[str] PROCLIB dataset DSNs

All DSN sets are optional and default to empty. Without them, generic profile resolution against APF/PARMLIB/PROCLIB libraries is skipped.

Writing output to a file

import json

with open("racf_opengraph.json", "w") as f:
    json.dump(graph, f)

Uploading to BloodHound

import httpx

resp = httpx.post(
    "https://<bloodhound-host>/api/v2/graphs/upload",
    headers={"Authorization": f"Bearer {token}"},
    json=graph,
)
resp.raise_for_status()

mfpandas integration

mfpandas-racfhound can be wired into the mfpandas.IRRDBU00 class as an optional plugin, exposing racf.to_bloodhound() directly without making it a hard dependency:

# In mfpandas IRRDBU00 class:
def to_bloodhound(self, **kwargs):
    try:
        from mfpandas_racfhound import to_bloodhound
        return to_bloodhound(self, **kwargs)
    except ImportError:
        raise ImportError("Install mfpandas-racfhound for BloodHound export support")

Once wired up, users can call:

graph = racf.to_bloodhound(apf_libs={"SYS1.LINKLIB"})

Running tests

pip install pytest
pytest

The test suite uses a self-contained fixture dump built from raw IRRDBU00 records — no external files or mainframe access required.

To run a specific test file:

pytest tests/test_generics.py    # wildcard matching and specificity unit tests
pytest tests/test_integration.py # end-to-end graph output tests

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

mfpandas_racfhound-0.1.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

mfpandas_racfhound-0.1.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file mfpandas_racfhound-0.1.1.tar.gz.

File metadata

  • Download URL: mfpandas_racfhound-0.1.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for mfpandas_racfhound-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5acd8dfe1b25e8972ec53d99b632587869e967ed08ac886e315cf62d1f56caad
MD5 6d58034475c07c63a6f8afb3710b4b0d
BLAKE2b-256 7e7d3e491bb5f696151608099e8531815f339bc77b45072effbb5d9e09e8824a

See more details on using hashes here.

File details

Details for the file mfpandas_racfhound-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mfpandas_racfhound-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36d90af1e511aa047da61203694cc7b75a90bd45f983461d75241d49ce07b582
MD5 ad731c78a008343340a7d70c372545f1
BLAKE2b-256 fb7317d4592fae54bab80b894f2d9406494610479a5291be30c6ba4b648fc3e4

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