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 명령을 사용할 수없는 경우 세트 경로를 참조하십시오.
슬라이더는 Python3에서 작성된 견고성 정적 분석 프레임 워크입니다. Naga는 슬라이더를 기반으로 계약 분석을 수행합니다.
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/ Defence 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