mirror of https://github.com/crytic/slither
parent
14643f5eca
commit
5930e4ca6b
@ -0,0 +1,19 @@ |
||||
# Slither, Plugin Example |
||||
|
||||
This repo contains an example of plugin for Slither. |
||||
|
||||
See the [detector documentation](https://github.com/trailofbits/slither/wiki/Adding-a-new-detector). |
||||
|
||||
## Architecture |
||||
|
||||
- `setup.py`: Contain the plugin information |
||||
- `slither_my_plugin/__init__.py`: Contain `make_plugin()`. The function must return the list of new detectors and printers |
||||
- `slither_my_plugin/detectors/example.py`: Detector plugin skeleton. |
||||
|
||||
Once these files are updated with your plugin, you can install it: |
||||
``` |
||||
python setup.py develop |
||||
``` |
||||
|
||||
We recommend to use a Python virtual environment (for example: [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/)). |
||||
|
@ -0,0 +1,17 @@ |
||||
from setuptools import setup, find_packages |
||||
|
||||
setup( |
||||
name='slither-my-plugins', |
||||
description='This is an example of detectors and printers to Slither.', |
||||
url='https://github.com/trailofbits/slither-plugins', |
||||
author='Trail of Bits', |
||||
version='0.0', |
||||
packages=find_packages(), |
||||
python_requires='>=3.6', |
||||
install_requires=[ |
||||
'slither-analyzer==0.1' |
||||
], |
||||
entry_points={ |
||||
'slither_analyzer.plugin': 'slither my-plugin=slither_my_plugin:make_plugin', |
||||
} |
||||
) |
@ -0,0 +1,8 @@ |
||||
from slither_my_plugin.detectors.example import Example |
||||
|
||||
|
||||
def make_plugin(): |
||||
plugin_detectors = [Example] |
||||
plugin_printers = [] |
||||
|
||||
return plugin_detectors, plugin_printers |
@ -0,0 +1,18 @@ |
||||
|
||||
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification |
||||
|
||||
|
||||
class Example(AbstractDetector): |
||||
""" |
||||
Documentation |
||||
""" |
||||
|
||||
ARGUMENT = 'mydetector' # slither will launch the detector with slither.py --mydetector |
||||
HELP = 'Help printed by slither' |
||||
CLASSIFICATION = DetectorClassification.HIGH |
||||
|
||||
def detect(self): |
||||
|
||||
self.logger('Nothing to detect!') |
||||
|
||||
return [] |
Loading…
Reference in new issue