Python

The following Python interface is provided to facilitate exploitation of CBXP by Python callers.

 

The Python Interface for CBXP can be installed from PyPi using pip.


python3 -m pip install cbxp

The Python Interface for CBXP may also optionally be downloaded from GitHub.

cbxp.cbxp()

def cbxp(
        control_block: str, 
        includes: list[str] = [], 
        debug: bool = False
) -> dict:

📄 Description

Extract Control Blocks from Live Memory (storage) and post-process them into a Python Dictionary.

📥 Parameters

  • control_block
    The name of the Control Block to extract.

  • includes
    A List of Include Patterns that describe Additional Control Blocks to include that are accessible from the Root Control Block being extracted.

  • debug
    A Boolean that if set to True indicates that Debug Messages should be printed. If set to False, no Debug Messages will be printed.

📤 Returns

  • dict
    A Python Dictionary that contains the Extracted Control Block Data requested.

❌ Raises

  • CBXPError
    Raises CBXPError when an error or condition that prevents the operation from completing successfully occurs.

💻 Examples

The following example extracts the PSA control block and prints Debug Messages.

Python Script
from cbxp import cbxp

cbdata = cbxp("psa", debug=True)

 

The following example extracts the CVT, includes the ECVT and the ASVT, and includes all Known Control Blocks that are pointed to directly by the ASVT.

Python Script
from cbxp import cbxp

cbdata = cbxp("cvt", includes=["ecvt", "asvt.*"])

 

The followng example extracts all ASCB control blocks and uses the built-in Python library json to convert the resulting Python dictionary into a JSON String.

Python Script
import json
from cbxp import cbxp

cbdata = cbxp("ascb")
cbjson = json(cbdata, indent=2)