Skip to main content

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

Project description

python-nrbf

PyPI version Python versions License

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

Installation

pip install nrbf

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. .NET enum values are unwrapped to plain ints.

Command-line usage

nrbfdump is installed automatically with the package. It 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
  • .NET enum values → int

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.1.tar.gz (8.5 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.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nrbf-0.1.1.tar.gz
  • Upload date:
  • Size: 8.5 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.1.tar.gz
Algorithm Hash digest
SHA256 10dc2536b0cde146ad654a3a46ad444a7944260707e75002d327fd251273ed76
MD5 44b34cd441f93b99e309d64ba519a002
BLAKE2b-256 ebe6a552f6b412ff56aa73d52e52e70b0f8e086545964df9c10cce7e9afd4d75

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nrbf-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19da0a40fe349e894f1766810355adffed64b0f22d4c181586c0604e8bb0008c
MD5 74acff1476955f44b44811c1264c5518
BLAKE2b-256 273372922996fba0522c725c77de92a1c5e9d789a57ab46f61d2ec53d321630e

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