Naga
v1.0.0-beta.1
一种在智能合约中检测出越来越多的所有者的工具。
Naga需要Python 3.8.10,Solc-Select和Slither。
版本:3.8.10
我们使用Solc-Select来管理和切换Solc编译器。
pip3 install solc-select安装Solc所有版本
solc-select install all如果您无法使用命令solc-select ,请参见SET路径。
Slither是用Python3编写的坚固性静态分析框架。 Naga根据Slither进行合同分析。
pip3 install slither-analyzer纳迦(Naga)加载一个滑板对象,以检测合同中的倒载所有者。
sol_file = "your_contract.sol"
contract_name = None # You can specify the entry contract name, if None, Naga will automatically try to find the entry contract.
erc_force = None # erc20, erc721, erc777, None.
slither = Slither ( sol_file )
naga = Naga ( slither )
naga . detect_entry_contract ( er_force = erc_force ) # Detect the entry contract
entry_c = naga . entry_contract # Get the entry contract object
entry_c . output ( output_file = "output.json" ) # Output the result to output.json
summary = entry_c . output () # Or just get the summary
# You may want know the details of the result. you can print the state variables pool.
for sk , sv in naga . entry_contract . svarn_pool . items ():
print ( sv . canonical_name , sv ) naga/detectors/定义检测器。您可以通过将其添加到naga/detectors/来注册自己的探测器。
slither = Slither ( sol_file )
naga = Naga ( slither )
entry_c = naga . entry_contract
naga . detect ( entry_c , erc_force = None , detectors = []) # Specify the detectors you want to use
entry_c . output ( output_file = "output.json" )这是一个拥有超过100,000个合同的数据集。
请确保/home/your_username/.local/bin在$路径中
您可以使用以下命令检查和更新$路径
echo $PATH
sudo vim /etc/profile
export PATH="/home/your_username/.local/bin:$PATH"
source /etc/profile