Consensys / mythx-cli

A command line interface for the MythX smart contract security analysis API
https://mythx-cli.readthedocs.io/
MIT License
84 stars 29 forks source link

What's the right way to pass in bytecode? #6

Closed maurelian closed 5 years ago

maurelian commented 5 years ago

Description

I'm trying to process creation bytecode.

What I Did

I saved the bytecode to a file call Token.bin. I tried running mythx analyze --mode quick --async Token.bin. No luck. I tried: cat Whitelist.bin | mythx analyze --mode quick --async /dev/stdin and cat Whitelist.bin | mythx analyze --mode quick --async

What eventually worked was: mythx analyze --mode quick --async \cat Whitelist.bin`` which seems kind of odd.

dmuhs commented 5 years ago

mythx by default does not support stdin to pass parameters. That makes detection a bit harder. What you can do however is use xargs, which ships with all common Linux distros and MacOS:

cat foo.bin | xargs mythx analyze

It will basically take each line of the file and add it as a parameter to the specified command. You can also use this to fetch the reports of multiple UUIDs as outlined in the usage docs: https://mythx-cli.readthedocs.io/en/latest/usage.html#asynchronous-analysis

Let me know if this helps :slightly_smiling_face:

maurelian commented 5 years ago

Yep, xargs works for me.