Consensys / mythril

Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Rootstock, Tron and other EVM-compatible blockchains.
https://mythx.io/
MIT License
3.88k stars 741 forks source link

How is this run on kali linux? #1583

Closed Astraioss closed 2 years ago

Astraioss commented 2 years ago

Sorry this isn't really a bug but this is the easiest way to get the problem noticed. I have mythril downloaded onto my kali desktop the myth analyze -a (addresstotest )
outputs... mythril.interfaces.cli [ERROR]: Please check whether the Infura key is set or use a different RPC method What do I do from here? in the interaces and cli it states its using the mainnet infura and I presume a key has autogenerated for this,

norhh commented 2 years ago

You need to be running a node to access on chain data, in which case you need to specify the rpc host and port of your node to mythril. The easier alternative would be to use infura. You need to sign up and generate an infura-id that can be used by mythril to access the chain data.

Astraioss commented 2 years ago

You need to be running a node to access on chain data, in which case you need to specify the rpc host and port of your node to mythril. The easier alternative would be to use infura. You need to sign up and generate an infura-id that can be used by mythril to access the chain data.

Yep so I know of infura but I couldn't find where I should be putting the infuraid and relevant information, do you know where it needs to go?

norhh commented 2 years ago

You can use the flag --infura-id <ID>, or fill it up in ~/.mythril/config.ini in [defaults] with key infura_id

Astraioss commented 2 years ago

You can use the flag --infura-id <ID>, or fill it up in ~/.mythril/config.ini in [defaults] with key infura_id

Great thanks , I'll give it a go a bit later on and see if it works

Astraioss commented 2 years ago

myth --infura-id (infuraid) ?

norhh commented 2 years ago

Yes (no need for a bracket, just to be clear), or add it into ~/.mythril/config.ini

Astraioss commented 2 years ago

Yes (no need for a bracket, just to be clear), or add it into ~/.mythril/config.ini

Yea didn't use the brackets dw. It still didn't work so will need to try the config.ini method

Astraioss commented 2 years ago

This is the error im getting `┌──(root💀kali)-[/home/kali/Desktop/mythril-develop] └─# myth --infura-id 27##26963cc#####b63752b0b25###

usage: myth [-h] [-v LOG_LEVEL] {safe-functions,analyze,a,disassemble,d,list-detectors,read-storage,function-to-hash,hash-to-address,version,help} ... myth: error: argument command: invalid choice: '27##26963cc#####b63752b0b25###' (choose from 'safe-functions', 'analyze', 'a', 'disassemble', 'd', 'list-detectors', 'read-storage', 'function-to-hash', 'hash-to-address', 'version', 'help') `

and sorry I cant find the config.ini file you are referring to, has it been renamed?

norhh commented 2 years ago

It's something like this myth analyze -a (addresstotest ) --infura-id <ID>

Astraioss commented 2 years ago

That didn't work either unfortunately. Didn't through the infura error but didn't analyse it either

norhh commented 2 years ago

@Astraioss are you using the private or public key of infura-id? What was the error logged?

Astraioss commented 2 years ago

@Astraioss are you using the private or public key of infura-id? What was the error logged?

myth analyze -a 0xa4d165efe5321d82f1616b3efb0753f1 --infura-id 271726963cc8463752b0b25fcf8 -t 4 produces nothing in the terminal

└─# myth a moonie.sol -t 3
mythril.interfaces.cli [ERROR]: Compiler not found. Make sure that solc is installed and in PATH, or set the SOLC environment variable. but when I try to install solc using these methods : https://ethereum.stackexchange.com/questions/5798/installing-solidity-in-debian-linux

and I get these outputs: gpg: keybox '/tmp/tmprspvo6fl/pubring.gpg' created gpg: /tmp/tmprspvo6fl/trustdb.gpg: trustdb created gpg: key 1C52189C923F6CA9: public key "Launchpad PPA for Ethereum" imported gpg: Total number processed: 1 gpg: imported: 1 Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). gpg: no valid OpenPGP data found.

then for the next: Ign:1 http://ppa.launchpad.net/ethereum/ethereum/ubuntu jammy InRelease Ign:2 http://http.kali.org/kali kali-rolling InRelease Ign:2 http://http.kali.org/kali kali-rolling InRelease Ign:1 http://ppa.launchpad.net/ethereum/ethereum/ubuntu jammy InRelease Ign:1 http://ppa.launchpad.net/ethereum/ethereum/ubuntu jammy InRelease Ign:2 http://http.kali.org/kali kali-rolling InRelease Err:1 http://ppa.launchpad.net/ethereum/ethereum/ubuntu jammy InRelease Temporary failure resolving 'ppa.launchpad.net' Err:2 http://http.kali.org/kali kali-rolling InRelease Temporary failure resolving 'http.kali.org' Reading package lists... Done
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease Temporary failure resolving 'http.kali.org' W: Failed to fetch http://ppa.launchpad.net/ethereum/ethereum/ubuntu/dists/jammy/InRelease Temporary failure resolving 'ppa.launchpad.net' W: Some index files failed to download. They have been ignored, or old ones used instead.

then: ┌──(root💀kali)-[/home/kali/Desktop/mythril-develop] └─# sudo apt-get install solc 130 ⨯ Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package solc

so I am a bit lost

Yes public key

norhh commented 2 years ago

produces nothing in the terminal. Yes, that's how it should do. For more information you can try using -v4 argument, myth -v4 analyze -a 0xa4d165efe5321d82f1616b3efb0753f1 --infura-id 271726963cc8463752b0b25fcf8 -t 4 . The default execution timeout is 24 hours, you can change it using --execution-timeout <seconds>

Astraioss commented 2 years ago

produces nothing in the terminal. Yes, that's how it should do. For more information you can try using -v4 argument, myth -v4 analyze -a 0xa4d165efe5321d82f1616b3efb0753f1 --infura-id 271726963cc8463752b0b25fcf8 -t 4 . The default execution timeout is 24 hours, you can change it using --execution-timeout <seconds>

Okay with that I managed to get some sort of output, thanks. Is there a way to use this on bsc instead of eth

norhh commented 2 years ago

Okay with that I managed to get some sort of output, thanks. Is there a way to use this on bsc instead of eth. There isn't a clean infura equivalent on bsc. You can locally run a node and point the mythril's endpoint to the port using --rpc localhost:<port>

norhh commented 2 years ago
# myth a moonie.sol -t 3
mythril.interfaces.cli [ERROR]: Compiler not found. Make sure that solc is installed and in PATH, or set the SOLC environment variable.
but when I try to install solc using these methods : https://ethereum.stackexchange.com/questions/5798/installing-solidity-in-debian-linux

You can try using --solv <solc_version> to avoid this issue on current develop version. Something like --solv v0.7.0, if the version of the program is v0.7.0.

norhh commented 2 years ago

Since this issue is resolved I am closing it. If the issues persist feel free to reopen this issue.