konsumer / rawproto

Guess structure of protobuf binary from raw data
https://konsumer.js.org/rawproto/
37 stars 10 forks source link

ui features #14

Open konsumer opened 6 months ago

konsumer commented 6 months ago

Related to #12 & #13

ui should have these features integrated:

iw-an commented 6 months ago

I think a good ui feature would be the ability to rename fields, would aid in the reversing of protobufs greatly. Would love to contribute to this anywhere possible.

konsumer commented 6 months ago

Agreed. Part of the "choices" idea (mentioned in #12) is being able to dial in types for JSON or proto-generation, and I think name-maps would be helpful there, too.

This issue is about the ui (buttons and select for utilizing features in the library) but the feature you are describing is more about the parser/lib, so maybe the discussion should continue at #12 ? I will add it to the list, too, though.

On the UI side, I think I may need to use a modal or something, due to limited space in the tree, visually. I think adding a bunch of selects to every branch will be a bit annoying, but a lil icon-button to popup a modal would be great.

konsumer commented 6 months ago

Maybe it's ok for it to only be a UI thing. I was originally thinking that choices would be integrated with parsing, but I could see parsing just being creating the initial tree, and types/names could be part of the UI. Additionally, you could export that from UI and maybe use them in the lib too (with a simple util that applies names/types.)

I have this idea forming in my head, where you have a standard tree (to describe a message) & can walk that with a little function, and I am going to try to replace the ui code with that (a walker that returns react) once I get it working in lib.

konsumer commented 6 months ago

With new ideas, I setup a name/type map system.

Here is an example map:

{
  "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"
}

That works nicely with this fairly complex proto.

Although this is less convenient than an inline-editor, I think it will save some space, and keep the UI simple, and isn't too bad.

Screenshot 2024-05-15 at 8 16 21 PM

After it all merges and I get the library published, I can address the other features.