You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you cannot use the command solc-select, see Set PATH.
Install Slither
Slither is a Solidity static analysis framework written in Python3.
Naga does contract analysis based on Slither.
pip3 install slither-analyzer
Usages
Naga loads a slither object to detect overpowered owner in contracts.
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 contractentry_c=naga.entry_contract# Get the entry contract objectentry_c.output(output_file="output.json") # Output the result to output.jsonsummary=entry_c.output() # Or just get the summary# You may want know the details of the result. you can print the state variables pool.forsk,svinnaga.entry_contract.svarn_pool.items():
print(sv.canonical_name,sv)
naga/detectors/ defines the detectors.
You can register your own detectors by adding them to naga/detectors/.
slither=Slither(sol_file)
naga=Naga(slither)
entry_c=naga.entry_contractnaga.detect(entry_c,erc_force=None,detectors=[]) # Specify the detectors you want to useentry_c.output(output_file="output.json")
Appendix
Dataset
Here is a dataset with more than 100,000 contracts.
Set PATH
Please make sure
/home/your_username/.local/bin
is in $PATH
You can check and update $PATH using the following commands