{"id":23345,"library":"bbpb","title":"Blackbox Protobuf","description":"Library for encoding and decoding protobuf messages without needing a .proto type definition. It infers the schema automatically and supports repeated fields, enums, and nested messages. Current version 1.4.2, supports Python 3.8+, released irregularly.","status":"active","version":"1.4.2","language":"python","source_language":"en","source_url":"https://github.com/nccgroup/blackboxprotobuf","tags":["protobuf","serialization","reverse-engineering","no-schema"],"install":[{"cmd":"pip install bbpb","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Used for serialization/deserialization of wire format","package":"protobuf","optional":false}],"imports":[{"note":"The package is imported as 'bbpb', not the full name 'blackboxprotobuf'.","wrong":"from blackboxprotobuf import encode_message","symbol":"encode_message","correct":"from bbpb import encode_message"},{"note":"Direct import from top-level 'bbpb' package, not from submodule 'lib'.","wrong":"from blackboxprotobuf.lib import decode_message","symbol":"decode_message","correct":"from bbpb import decode_message"},{"note":"There is no separate 'decode' submodule; the function is in __init__.","wrong":"from bbpb.decode import decode_message","symbol":"decode_message","correct":"from bbpb import decode_message"}],"quickstart":{"code":"from bbpb import decode_message, encode_message\n\n# Example protobuf raw bytes (from a known message)\nraw_bytes = b'\\x08\\x96\\x01'  # field 1, varint 150\n\n# Decode to a plain data structure\ndecoded = decode_message(raw_bytes)\nprint(decoded)  # {'data': {1: 150}, 'typedef': {'1': {'type': 'uint'}}}\n\n# Modify and re-encode\nencoded = encode_message({'data': {1: 200}}, decoded['typedef'])\nprint(encoded.hex())  # 08c801\n","lang":"python","description":"Decode and encode protobuf binary data without a .proto file. The library infers a type definition (typedef) that can be reused for encoding."},"warnings":[{"fix":"Update code to handle dict: result = decode_message(blob); data = result['data']; typedef = result['typedef']","message":"Version 1.4.0 changed the return format of decode_message: it now returns a dict with 'data' and 'typedef' keys, not a tuple. Old code expecting a tuple will break.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Test against known messages; verify round-trip encoding/decoding. For complex schemas, consider using actual .proto files.","message":"The library does not support all protobuf features (e.g. groups, maps, oneofs). It may misinterpret or skip unsupported wire types silently.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace decode_message_with_type(blob, typedef) with decode_message(blob, typedef). Note the return format change.","message":"The function 'decode_message_with_type' is deprecated since v1.3.0 and removed in v1.4.0. Use decode_message instead.","severity":"deprecated","affected_versions":">=1.4.0"},{"fix":"Use integer keys: data[1] not data['1']. The typedef dict uses string keys for field numbers.","message":"Field numbers are treated as keys in the data dict; they are integers, not strings. Attempting to access by string will fail.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install bbpb and import as 'from bbpb import ...'.","cause":"Importing using the full library name instead of 'bbpb'.","error":"ImportError: No module named 'blackboxprotobuf'"},{"fix":"Update to v1.4.0+ and use: result = decode_message(blob); data = result['data']; typedef = result['typedef'].","cause":"Passing a byte string as the second argument, but the function signature changed in v1.4.0.","error":"TypeError: decode_message() missing 1 required positional argument: 'data'"},{"fix":"This library does not support groups. Use the original .proto file and protobuf library instead.","cause":"Encountered a protobuf field with wire type 5 (32-bit group start) which is not supported.","error":"ValueError: Unknown wire type 5"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}