Skip to main content

A utility to extract rust audit information from rust executable if audit enabled

Project description

A python package that extracts rust audit information from rust audit based executables.

Example usage

from pyrustaudit import get_rust_audit
import json


def test_get_info(file):
    res = get_rust_audit(file)
    print(json.dumps(res, indent=4))


test_get_info("foo/bar")
test_get_info("/usr/bin/du")
test_get_info("test-data/centos5-plain-Packages")

The result returned is always a dict object for errors the dictionary returned contains a key; "error" like;

{
    "error": "path error:foo/bar"
}

or

{
    "error": "/usr/bin/du: could not read Go build info from /usr/bin/du: unrecognized file format"
}

on success a python dict is rturned like this

{
    "packages": [
        {
            "name": "adler",
            "version": "1.0.2",
            "source": "registry",
            "kind": "build",
            "dependencies": null,
            "features": null,
            "root": false
        },
        {
            "name": "auditable",
            "version": "0.1.0",
            "source": "registry",
            "kind": "runtime",
            "dependencies": null,
            "features": null,
            "root": false
        },
        {
            "name": "auditable-build",
            "version": "0.1.0",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                3,
                5,
                7,
                15
            ],
            "features": null,
            "root": false
        },
        {
            "name": "auditable-serde",
            "version": "0.1.0",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                5,
                11,
                13,
                15
            ],
            "features": [
                "cargo_metadata",
                "default",
                "from_metadata"
            ],
            "root": false
        },
        {
            "name": "autocfg",
            "version": "1.2.0",
            "source": "registry",
            "kind": "build",
            "dependencies": null,
            "features": null,
            "root": false
        },
        {
            "name": "cargo_metadata",
            "version": "0.11.4",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                11,
                13,
                15
            ],
            "features": [
                "default"
            ],
            "root": false
        },
        {
            "name": "itoa",
            "version": "1.0.11",
            "source": "registry",
            "kind": "build",
            "dependencies": null,
            "features": null,
            "root": false
        },
        {
            "name": "miniz_oxide",
            "version": "0.4.4",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                0,
                4
            ],
            "features": null,
            "root": false
        },
        {
            "name": "proc-macro2",
            "version": "1.0.79",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                18
            ],
            "features": [
                "proc-macro"
            ],
            "root": false
        },
        {
            "name": "quote",
            "version": "1.0.35",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                8
            ],
            "features": [
                "proc-macro"
            ],
            "root": false
        },
        {
            "name": "ryu",
            "version": "1.0.17",
            "source": "registry",
            "kind": "build",
            "dependencies": null,
            "features": null,
            "root": false
        },
        {
            "name": "semver",
            "version": "0.10.0",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                12,
                13
            ],
            "features": [
                "default",
                "serde"
            ],
            "root": false
        },
        {
            "name": "semver-parser",
            "version": "0.7.0",
            "source": "registry",
            "kind": "build",
            "dependencies": null,
            "features": null,
            "root": false
        },
        {
            "name": "serde",
            "version": "1.0.197",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                14
            ],
            "features": [
                "default",
                "derive",
                "serde_derive",
                "std"
            ],
            "root": false
        },
        {
            "name": "serde_derive",
            "version": "1.0.197",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                8,
                9,
                16
            ],
            "features": [
                "default"
            ],
            "root": false
        },
        {
            "name": "serde_json",
            "version": "1.0.115",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                6,
                10,
                13
            ],
            "features": [
                "default",
                "std"
            ],
            "root": false
        },
        {
            "name": "syn",
            "version": "2.0.58",
            "source": "registry",
            "kind": "build",
            "dependencies": [
                8,
                9,
                18
            ],
            "features": [
                "clone-impls",
                "derive",
                "parsing",
                "printing",
                "proc-macro"
            ],
            "root": false
        },
        {
            "name": "test-data",
            "version": "0.1.0",
            "source": "local",
            "kind": "runtime",
            "dependencies": [
                1,
                2
            ],
            "features": null,
            "root": false
        },
        {
            "name": "unicode-ident",
            "version": "1.0.12",
            "source": "registry",
            "kind": "build",
            "dependencies": null,
            "features": null,
            "root": false
        }
    ]
}

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

pyrustaudit-0.0.2.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distributions

pyrustaudit-0.0.2-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-pp310-pypy310_pp73-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pyrustaudit-0.0.2-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pyrustaudit-0.0.2-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pyrustaudit-0.0.2-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded PyPy macOS 10.9+ x86-64

pyrustaudit-0.0.2-cp312-cp312-musllinux_1_1_x86_64.whl (886.0 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

pyrustaudit-0.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-cp312-cp312-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

pyrustaudit-0.0.2-cp311-cp311-musllinux_1_1_x86_64.whl (886.0 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

pyrustaudit-0.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-cp311-cp311-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

pyrustaudit-0.0.2-cp310-cp310-musllinux_1_1_x86_64.whl (886.0 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

pyrustaudit-0.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-cp310-cp310-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

pyrustaudit-0.0.2-cp39-cp39-musllinux_1_1_x86_64.whl (886.0 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

pyrustaudit-0.0.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-cp39-cp39-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

pyrustaudit-0.0.2-cp38-cp38-musllinux_1_1_x86_64.whl (886.0 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

pyrustaudit-0.0.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-cp38-cp38-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

pyrustaudit-0.0.2-cp37-cp37m-musllinux_1_1_x86_64.whl (886.0 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

pyrustaudit-0.0.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.7 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-cp37-cp37m-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

pyrustaudit-0.0.2-cp36-cp36m-musllinux_1_1_x86_64.whl (886.0 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ x86-64

pyrustaudit-0.0.2-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (865.8 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

pyrustaudit-0.0.2-cp36-cp36m-macosx_10_9_x86_64.whl (921.4 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

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