Skip to main content

Pure-Python parser for .NET BinaryFormatter (MS-NRBF) streams

Project description

python-nrbf

A pure-Python parser for .NET BinaryFormatter streams (MS-NRBF spec). No dependencies beyond the standard library.

Library usage

import nrbf

# From a file
with open("data.dat", "rb") as f:
    data = nrbf.load(f)

# From bytes
data = nrbf.loads(raw_bytes)

Both functions return plain Python objects — dict, list, str, int, float, bool, or None. The .NET type name is preserved in a __class__ key on dicts so you can identify types if needed.

System.Collections.Generic.List<T> and Dictionary<K,V> are automatically unwrapped to Python list and dict.

Command-line usage

nrbfdump reads a BinaryFormatter file (or stdin) and prints it. It automatically decompresses gzip input.

usage: nrbfdump [FILE] [--format FORMAT]

positional arguments:
  FILE                  input file (default: stdin)

options:
  -h, --help            show this help message and exit
  --format, -f          json (default), pprint, yaml

Examples:

# Decode a file to JSON
nrbfdump data.dat

# Pipe a gzip-compressed file
cat data.dat.gz | nrbfdump

# Pretty-print for quick inspection
nrbfdump data.dat --format pprint

# YAML output (requires: pip install pyyaml)
nrbfdump data.dat --format yaml

What's decoded

All MS-NRBF record types are supported:

  • All 16 primitive types (bool, int, float, double, DateTime, TimeSpan, Char, etc.)
  • Strings, object references, nulls
  • Single-dimensional and multi-dimensional arrays (primitive, object, string)
  • Classes with full member type info (ClassWithMembersAndTypes, SystemClassWithMembersAndTypes, ClassWithId)
  • System.Collections.Generic.List<T>list
  • System.Collections.Generic.Dictionary<K,V>dict

License

MIT — see LICENSE.

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

nrbf-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

nrbf-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nrbf-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nrbf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 be5687ca1cc1e177fc1f7ebcb5d19404cc21a55e01296f30a425030794d28e68
MD5 ca6898f320d8f8eb385f6561b72fb726
BLAKE2b-256 5ac59e17fedb8e1057928d2a62c1b469ca7dfd502b33d77cae8b82e8e6bca51a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nrbf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nrbf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 362250a3143870c5ed10fedbe85cf952212c1e1f391b376c0fb9ebb28bd486ee
MD5 16576a176ab3f10bc4be88b27652719c
BLAKE2b-256 8f1576a16a152cc1a1731495eff902c7009899b963ce42e689cdeb84a04b1da6

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