Инструмент, который обнаруживает одолерого владельца в интеллектуальных контрактах.
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 PATH.
Slither - это структура статического анализа солидности, написанная на Python3. Нага делает анализ контракта на основе Slither.
pip3 install slither-analyzerNAGA загружает скользкий объект, чтобы обнаружить одалующего владельца в контрактах.
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 находится в пути $
Вы можете проверить и обновить $ path, используя следующие команды
echo $PATH
sudo vim /etc/profile
export PATH="/home/your_username/.local/bin:$PATH"
source /etc/profile