
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Guess structure of protobuf binary from raw data, query binary protobuf without the schema, and output guessed JSON or schema, some CLI utils, and a web tool for exploring raw protobuf.
You can explore your proto binary data here. Use it to view, generate proto/json files, or select how to parse fields.
If you are coming form an older version, or anothe rlibrary, check out migration instructions.
npm i rawproto will add this to your project.
You can also use npx rawproto to run the CLI.
If you just want the CLI, and don't use node, you can also find standalone builds here.
Install it in your path with npm i -g rawproto or use it 1-off with npx rawproto. Get help with rawproto --help
You can use it in code like this:
import { readFile } from 'fs/promises'
import RawProto from 'rawproto'
// load proto
const proto = new RawProto(await readFile('data.pb'))
// get a single field, without parsing the whole tree
console.log(proto.query('1.2.4.10.5:string'))
// you can also pull things like they are arrays/values
console.log(proto['1'][0]['2'][0]['4'][0]['10'].map(r => r['5'][0].string ))
// guess to decode as JS object
console.log(proto.toJS())
// guess to generate .proto file string
console.log(proto.toProto())
// walk over all fields recursively, calling your callback.
const mydata = proto.walk((field) => {
console.log(field)
// just do whatever it normally does to make JS-object
return walkerJS(field)
})
Protobuf encodes several different possible types for every wire-type. In this lib, we guess the type based on some context-clues, but it will never be perfect, without hand-tuning. Here are the possible types we support:
VARINT - int, bool, string
FIXED64 - uint, int, bytes, float, string
LEN - string, bytes, packedIntVar, packedInt32, packedInt64, string
FIXED32 - int, uint, bytes, float, string
raw for any type to get the raw field with bytes + meta.LEN message-fieldsLEN will try to be parsed as sub-tree, but you can override with other types in query (for example if it tries to make a sub-message with part of a string)Many things (ui, toJS, toProto, cli) use queryMap which is just a map of name to path:type. Here is one that works well with hearthstone test data:
{
"id": "1.2.4.1:string",
"title": "1.2.4.5:string",
"company": "1.2.4.6:string",
"description": "1.2.4.7:string",
"media": "1.2.4.10",
"dimensions": "1.2.4.10.2",
"width": "1.2.4.10.2.3:uint",
"height": "1.2.4.10.2.4:uint",
"url": "1.2.4.10.5:string",
"type": "1.2.4.10.1:uint",
"bg": "1.2.4.10.15:string"
}
You can use any types, from above, and set the name to whatever you want.
I used to have the functionality of this lib split up into several other projects. Here is migration instructions, if you want to update to this one (recommended):
toJS (see tests for examples.) It may require a little bit more custom-code, if you were not using it with defaults, but overall should work better, and merges shared code that was in both libs. Main thing is that regular toJS, without a custom-mapper, will make all values an array, since it's possible for any field ID to be found multiple times.FAQs
Guess structure of protobuf binary from raw data
The npm package rawproto receives a total of 1,159 weekly downloads. As such, rawproto popularity was classified as popular.
We found that rawproto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.