-
基于oyente的环境
-
升级支持Python3
-
给
print
加()
-
删除
z3
文件夹(如果z3
已安装) -
安装
HTMLParser
pip install HTMLParser
-
安装HTMLParser
pip install HTMLParser
-
osiris.py
中from HTMLParser import HTMLParser
替换为from html.parser import HTMLParser
disasm_out = disasm_p.communicate()[0]
替换为disasm_out = disasm_p.communicate()[0].decode('utf-8', 'strict')
-
utils.py
中return solc_p.communicate()[0]
替换为return solc_p.communicate()[0].decode('utf-8', 'strict')
(int, long)
替换为six.integer_types
/int
import six
import logging
添加log = logging.getLogger(__name__)
-
source_map.py
中def __get_source(self): fname = self.__get_filename() if SourceMap.sources.has_key(fname): return SourceMap.sources[fname] else: SourceMap.sources[fname] = Source(fname) return SourceMap.sources[fname]
替换为
def __get_source(self): # 两个_ fname = self.__get_filename() if fname not in SourceMap.sources: SourceMap.sources[fname] = Source(fname) return SourceMap.sources[fname]
-
ast_helper.py
中def extract_state_definitions(self, c_name):
插入base_contracts = list(base_contracts)
-
symExec.py
中for (attr, default) in attr_defaults.iteritems():
替换为for (attr, default) in six.iteritems(attr_defaults):
,并且import six
,if visited_edges.has_key(current_edge):
替换为if current_edge in visited_edges:
temp = long(math.ceil((mem_location + no_bytes) / float(32)))
替换为if six.PY2: temp = long(math.ceil((mem_location + no_bytes) / float(32))) else: temp = int(math.ceil((mem_location + no_bytes) / float(32)))
temp = long(math.ceil((address + 32) / float(32)))
替换为if six.PY2: temp = long(math.ceil((address + 32) / float(32))) else: temp = int(math.ceil((address + 32) / float(32)))
temp = long(math.ceil((stored_address + 32) / float(32)))
替换为if six.PY2: temp = long(math.ceil((stored_address + 32) / float(32))) else: temp = int(math.ceil((stored_address + 32) / float(32)))
temp = long(math.ceil((stored_address + 1) / float(32)))
替换为if six.PY2: temp = long(math.ceil((stored_address + 1) / float(32))) else: temp = int(math.ceil((stored_address + 1) / float(32)))
input += binascii.unhexlify('%064x' % value)
替换为input += binascii.unhexlify('%064x' % value).decode('utf-8', 'strict')
address += 1 + (len(instruction.split(' ')[1].replace("0x", "")) / 2)
替换为address += 1 + (len(instruction.split(' ')[1].replace("0x", "")) // 2)
-
basicblock.py
中(int, long)
替换为six.integer_types
,import six
-
taintFlow.py
中的所有取整/
替换为//
-
apt install graphviz
pip install graphviz
根据生成的.dot
生成png
流程图
======
An analysis tool to detect integer bugs in Ethereum smart contracts. Osiris is based on Oyente.
A container with the dependencies set up can be found here.
To open the container, install docker and run:
docker pull christoftorres/osiris && docker run -i -t christoftorres/osiris
To evaluate the SimpleDAO contract inside the container, run:
python osiris/osiris.py -s datasets/SimpleDAO/SimpleDAO_0.4.19.sol
and you are done!
docker build -t osiris .
docker run -it osiris:latest
$ sudo add-apt-repository ppa:ethereum/ethereum
$ sudo apt-get update
$ sudo apt-get install solc
evm from go-ethereum
- https://geth.ethereum.org/downloads/ or
- By from PPA if your using Ubuntu
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository -y ppa:ethereum/ethereum
$ sudo apt-get update
$ sudo apt-get install ethereum
z3 Theorem Prover version 4.6.0.
Download the source code of version z3-4.6.0
Install z3 using Python bindings
$ python scripts/mk_make.py --python
$ cd build
$ make
$ sudo make install
Requests library
pip install requests
web3 library
pip install web3
pysha3 library
pip install pysha3
#evaluate a local solidity contract
python osiris.py -s <contract filename>
Run python osiris.py --help
for a complete list of options.