| CARVIEW |
Select Language
HTTP/2 200
date: Sat, 27 Dec 2025 07:50:07 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"8cb6d6e2500ea3c5b26839c5556b0637"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com github.githubassets.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com marketplace-screenshots.githubusercontent.com/ copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com github.githubassets.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=GNnPMbiD8nAhqh%2FqkoZOXDkqQQeIAXW85jAnrPNnhxXLDQqX1djgQeu2Ho5C5Az0R4b7880kEJoQdb7qADPSiyUTG5rltHheG9C7n4PVN3KGRINM%2FmEEK%2BpkMuMo9lOfCO6Lcu3rI3XQsAWX8CYhosvSCNlwp6XnQgqI7R3qYG01NRrpU0aaMNp9N1gTE%2FviD9o7CkKD7l4013KaNa%2F%2FljkfOfLU6q17BqvfjLndnik12iULc9SqAoyTSXl5Ol3E4YpIjh%2BaamI6VDgFntNnRw%3D%3D--9MQ7M%2FkR5OJ3JThG--BTrA%2B381lRdrRZN7oA9sPA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.821538742.1766821806; Path=/; Domain=github.com; Expires=Sun, 27 Dec 2026 07:50:06 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 27 Dec 2026 07:50:06 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: A980:21D903:40E7060:4E29663:694F8FAE
Python API · crytic/slither Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python API
Feist Josselin edited this page Feb 14, 2019
·
1 revision
Let's start with the smallest possible Slither script:
from slither.slither import Slither
slither = Slither('file.sol') A Slither object has:
-
contracts (list(Contract): list of contracts -
contracts_derived (list(Contract): list of contracts that are not inherited by another contract (subset of contracts) -
get_contract_from_name (str): Return a contract from its name
contracts_derived iterates over contracts that are not inherited. It is useful to prevent duplicate findings. If you find an issue in a derived contract, then one of its inherited contracts is likely to have the same issue.
A Contract object has:
-
name (str): Name of the contract -
functions (list(Function)): List of functions -
modifiers (list(Modifier)): List of functions -
all_functions_called (list(Function/Modifier)): List of all the internal functions reachable by the contract -
inheritance (list(Contract)): List of inherited contracts -
get_function_from_signature (str): Return aFunctionfrom its signature -
get_modifier_from_signature (str): Return aModifierfrom its signature -
get_state_variable_from_name (str): Return aStateVariablefrom its name
A Function or a Modifier object has:
-
name (str): Name of the function -
nodes (list(Node)): List of the nodes composing the CFG of the function/modifier -
entry_point (Node): Entry point of the CFG -
variables_read (list(Variable)): List of variables read -
variables_written (list(Variable)): List of variables written -
state_variables_read (list(StateVariable)): List of state variables read (subset of variables`read) -
state_variables_written (list(StateVariable)): List of state variables written (subset of variables`written)
Variables can be different types, such as StateVariable, or LocalVariable. All variables have:
-
name (str): Name of the variable -
initialized (boolean): True if the variable is initialized at declaration
A Node object has:
-
type (NodeType): The type of the node (ex: If a control flow node, RETURN is for the node containing the return statement). -
expression (Expression): Expression associated with the node (not all nodes contain an expression) -
variables_read (list(Variable)): List of variables read -
variables_written (list(Variable)): List of variables written -
state_variables_read (list(StateVariable)): List of state variables read (subset of variables_read) -
state_variables_written (list(StateVariable)): List of state variables written (subset of variables_written)
An Expression is an AST-based representation of the code executed.
For example, the following code explores all the functions of all the contracts and prints what state variables are read or written:
from slither.slither import Slither
slither = Slither('file.sol')
for contract in slither.contracts:
print 'Contract: '+ contract.name
for function in contract.functions:
print('Function: {}'.format(function.name))
print('\tRead: {}'.format([v.name for v in function.state_variables_read]))
print('\tWritten {}'.format([v.name for v in function.state_variables_written]))You will find more Slither API examples here. For example:
-
functions_writing.py: Where the state variable
ais written? -
variable_in_condition.py: Is the variable
aused in a condition? -
functions_called.py: What are all the functions reached by a call to
entry_point()? - slithIR.py: Print the SlithIR operations
You can’t perform that action at this time.