Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify using decode_raw in bash pipelines #5

Open
uranix opened this issue Jul 6, 2024 · 2 comments
Open

Simplify using decode_raw in bash pipelines #5

uranix opened this issue Jul 6, 2024 · 2 comments

Comments

@uranix
Copy link

uranix commented Jul 6, 2024

Thank you for the great tool, was very useful to extract data from raw protobuf captures without writing any code.

However, decode_raw is not very friendly with pipeline processing in bash: it always output data with terminal colors on, even if tool output is piped to another utility.

If it is possible, please add some "raw" flags, that suppress colorizing the output and data type hints - they are great for debugging, but complicate processing with tools like xxd -r -p (to convert hex to binary). For now it requires the following to get data for a bytes field:

$ decode_raw --full .7 < test.pb | cut -d ' ' -f 4 | sed -e 's/\x1b\[[0-9;]*m//g' | xxd -r -p > buffer.raw

It would be great to simplify that into

$ decode_raw --full --raw .7 < test.pb | xxd -r -p > buffer.raw

or even

$ decode_raw --full --raw .7 < test.pb > buffer.raw

However, I have no idea how --raw should work for several fields. Probably the tool can mimic jq -r

@webmaster128
Copy link
Member

Hey! Great to hear the tool is useful.

Please note this section from the README:

It does not intend to:

Provide stable outputs for scripting

That being said, we could introduce a --no-color option that just disables all colouring

@uranix
Copy link
Author

uranix commented Jul 10, 2024

I am sorry, took the fast path and did not read the README carefully.

Yes, --no-color would be just great. Still, I have a workaround, so I can live with current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants