crytic / rattle

evm binary static analysis
https://www.trailofbits.com/presentations/rattle/
344 stars 41 forks source link

Can't run example of project #19

Closed nxqbao closed 5 years ago

nxqbao commented 5 years ago

I ran this command to test this tool at beginning python3 rattle-cli.py --input inputs/kingofether/KingOfTheEtherThrone.bin -0

But got following error:

File "rattle-cli.py", line 46
    logger.info(f"Rattle running on input: {args.input.name}")
                                                            ^
SyntaxError: invalid syntax
disconnect3d commented 5 years ago

Hey, thanks for the issue!

This is because we use Literal String Interpolation (see pep-498) that was introduced in Python 3.6. That being said rattle needs to be run with Python >= 3.6.

Side note: You can use pyenv to manage multiple versions of Python on your system (it also works fine with virtualenv).

We will add this info to README soon.

disconnect3d commented 5 years ago

@mrssource Hmm, it is weird that your Python didn't die on this assertion: https://github.com/trailofbits/rattle/blob/c9b016ee61e465fdc94cb9924fd07b385d8521da/rattle-cli.py#L15

Can you show what does it print:

python3 -c "import sys; print(sys.version_info)"
nxqbao commented 5 years ago

Can you show what does it print:

python3 -c "import sys; print(sys.version_info)"

It seems weird to me also. Here is my output

sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0)
disconnect3d commented 5 years ago

Idk why it happens. If you want to help looking up why is that happening, let us know if you find sth.

withzombies commented 5 years ago

Can you show what does it print:

python3 -c "import sys; print(sys.version_info)"

It seems weird to me also. Here is my output

sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0)

You should update your python version to 3.6 or later. I personally am running 3.7:

$ python3 -c "import sys; print(sys.version_info)"
sys.version_info(major=3, minor=7, micro=0, releaselevel='final', serial=0)
nxqbao commented 5 years ago

Idk why it happens. If you want to help looking up why is that happening, let us know if you find sth.

A code written in Python gets parsed, analyzed, and fed into an interpreter sequentially. Hence, the complier begins with a parser which raises syntax errors (due to incompatible version as my above error) first. Your assertion was still not reached in this step.

disconnect3d commented 5 years ago

@mrssource Oh right, that makes sense. Thanks :).