เครื่องมือที่ตรวจพบเจ้าของที่เอาชนะในสัญญาอัจฉริยะ
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
SLETHER เป็นกรอบการวิเคราะห์แบบคงที่ที่เขียนขึ้นใน Python3 นาคทำการวิเคราะห์สัญญาตาม SLETHER
pip3 install slither-analyzerNaga โหลดวัตถุ Slither เพื่อตรวจจับเจ้าของที่มีอำนาจเหนือกว่าในสัญญา
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