Skip to content
Feist Josselin edited this page Feb 14, 2019 · 34 revisions

Usage

How to run Slither

Truffle

To run Slither on a Truffle directory:

slither .

To specify a version of Truffle, use --truffle-version [email protected]. For example:

slither . --truffle-version [email protected]

Will run Slither with the latest 0.4 Truffle (through npx).

solc

To run Slither from a Solidity file:

slither file.sol

By default solc is used. To use another version, use:

slither file.sol --solc /path/to/solc

AST file

To run Slither on a AST file generated by solc, run:

slither file.ast.json

Options

  • To disable the solc warnings: --disable-solc-warnings
  • To disable the output colorization: --disable-color
  • To export the result to a json file: --json file.json

Detectors selection

By default, slither run all the detectors.

To run only selected detectors, use --detect detector1,detector2. For example:

slither file.sol --detect arbitrary-send,pragma

To exclude detectors, use --exclude detector1,detector2. For example:

slither file.sol --exclude naming-convention,unused-state,suicidal

To exclude detectors with a informational or low severity, use --exclude-informational or --exclude-low.

--list-detectors lists available detectors.

Configuration File

Some options can be set through a json configuration file. By default, slither.conf.json is used if present (it can be changed through --config-file file.conf.json).

If an option is set by the configuration file and the command line, the command line option is selected;

The following flags are supported:

{
    "detectors_to_run": "detector1,detector2",
    "printers_to_run": "printer1,printer2",
    "detectors_to_exclude": "detector1,detector2",
    "exclude_informational": false,
    "exclude_low": false,
    "exclude_medium": false,
    "exclude_high": false,
    "solc": "solc",
    "solc_args": "",
    "disable_solc_warnings": false,
    "json": "",
    "truffle_version": "[email protected]",
    "disable_color": false,
    "filter_paths": "file1.sol,file2.sol",
    "ignore_truffle_compile": false,
    "legacy_ast": false
}

Printers selection

By default, no printer are run.

To run selected pritners, use --print printer1,printer2. For example:

slither file.sol --print inheritance-graph

--list-printers lists available printers.

IDE integrations