티스토리 뷰
1. docker 설치
> apt-get install curl
> curl -s https://get.docker.com | sudo su
2. mythril 설치
# apt install docker.io
# sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
# docker pull mythril/myth
Using default tag: latest
latest: Pulling from mythril/myth
898c46f3b1a1: Pull complete
63366dfa0a50: Pull complete
041d4cd74a92: Pull complete
6e1bee0f8701: Pull complete
7865a5a11f85: Pull complete
6eb116689acf: Pull complete
338967522d63: Pull complete
652ead806104: Pull complete
c044b175784b: Pull complete
36e0754df894: Pull complete
3a79a2421d00: Pull complete
Digest: sha256:b84f08bbbc068dc5bf86accd0c59b5031612e8ec3a8a08fe405a7d5ec5e22114
Status: Downloaded newer image for mythril/myth:latest
3. 샘플 소스코드
# git clone https://github.com/ConsenSys/mythril.git
# https://github.com/miguelmota/solidity-idiosyncrasies.git (오픈소스)
4. docker 실행
# docker run -v $(pwd):/tmp -it --entrypoint bash mythril/myth
5. 샘플 소스코드 분석 실행
# cd /tmp/mythril/solidity_examples
# myth analyze weak_random.sol
버전문제 빢치네...
소스코드 상위에 버전 정의시 ^을 붙일 경우 상위 버전의 컴파일러 사용을 허용하겠다는 의미
Safe: pragma solidity 0.5.0;
Weak: pragma solidity ^0.5.0;
-----------------------------------------------------------------------------------------------------------------------------------
1. python3.6 설치
> sudo apt install python3.6
2. pip3 설치
> sudo apt install python3-pip
3. mythril 설치
> pip3 install mythril
아래와 같은 설치에러 발생 시 libssl-dev를 추가 설치하여 해결
scrypt-1.2.1/libcperciva/crypto/crypto_aes.c:6:10: fatal error: openssl/aes.h: No such file or directory
#include <openssl/aes.h>
^~~~~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mw4hitmd/scrypt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-y8t2w_ir-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-mw4hitmd/scrypt/
> apt-get install libssl-dev
4. solidity complier 설치
> add-apt-repository ppa:ethereum/ethereum
> apt-get update
> apt-get install solc
5. mythril 실행 확인 (Samsung CTF 2018 Quals - BankRobber)
참고
https://github.com/ConsenSys/mythril/wiki/With-Docker
https://github.com/ConsenSys/mythril-classic/wiki/Security-Analysis
https://github.com/ConsenSys/mythril-classic/wiki/Install-from-Pypi-on-Ubuntu
https://github.com/AGWA/git-crypt/issues/122
https://solidity.readthedocs.io/en/v0.4.21/installing-solidity.html
SmartContract 항목
- Total
- Today
- Yesterday