أداة تكتشف المالك الذي تغلب عليه في العقود الذكية.
يتطلب 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. Naga يقوم بتحليل العقود على أساس انزلاق.
pip3 install slither-analyzerتقوم Naga بتحميل كائن انزلاق للكشف عن المالك الذي تم تغلبه في العقود.
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" )فيما يلي مجموعة بيانات تضم أكثر من 100000 عقد.
يرجى التأكد من /home/your_username/.local/bin your_username/.local/bin في مسار $
يمكنك التحقق من مسار $ وتحديثه باستخدام الأوامر التالية
echo $PATH
sudo vim /etc/profile
export PATH="/home/your_username/.local/bin:$PATH"
source /etc/profile