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-select install allコマンドsolc-selectを使用できない場合は、Set Pathを参照してください。
Slitherは、Python3で記述されたSolidity Static Analysis Frameworkです。 NagaはSlitherに基づいて契約分析を行います。
pip3 install slither-analyzerナガは、契約で圧倒された所有者を検出するためにスリザーオブジェクトをロードします。
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