Note
Slither requires Python 3.8+. If you're not going to use one of the supported compilation frameworks, you need solc, the Solidity compiler; we recommend using solc-select to conveniently switch between solc versions.
python3 -m pip install slither-analyzer
git clone https://github.com/crytic/slither.git && cd slither
python3 -m pip install .
We recommend using a Python virtual environment, as detailed in the Developer Installation Instructions, if you prefer to install Slither via git.
Use the eth-security-toolbox
docker image. It includes all of our security tools and every major version of Solidity in a single image. /home/share
will be mounted to /share
in the container.
docker pull trailofbits/eth-security-toolbox
To share a directory in the container:
docker run -it -v /home/share:/share trailofbits/eth-security-toolbox
- Link
slither-testsuite-measurement/our_detectors
to theslither/detectors
folder. Inslither/detectors
:
ln -s ../../slither-testsuite-measurement/our_detectors our_detectors
-
Add new detectors in
slither/detectors/all_detector.py
file. -
Run slither:
python3 -m slither $PATH_TO_PROJECT
- With dependencies example:
python3 -m slither $PATH_TO_PROJECT --solc-remaps "@openzeppelin=node_modules/@openzeppelin @dlsl=node_modules/@dlsl" --exclude-dependencies
- To run only one file:
python3 -m slither $PATH_TO_PROJECT --include-paths $PATH_TO_FILE
- Create a new detector in
/our_detectors
folder and import it inrunner.py
- Add it to
all_detector_classes
dictionary