mirror of https://github.com/crytic/slither
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
951 B
39 lines
951 B
6 years ago
|
import os
|
||
|
import argparse
|
||
|
import logging
|
||
|
from slither import Slither
|
||
|
from crytic_compile import cryticparser
|
||
|
|
||
|
logging.basicConfig()
|
||
|
logging.getLogger("Slither").setLevel(logging.INFO)
|
||
|
|
||
|
logger = logging.getLogger("Slither-demo")
|
||
|
|
||
|
def parse_args():
|
||
|
"""
|
||
|
Parse the underlying arguments for the program.
|
||
|
:return: Returns the arguments for the program.
|
||
|
"""
|
||
|
parser = argparse.ArgumentParser(description='Demo',
|
||
|
usage='slither-demo filename')
|
||
|
|
||
|
parser.add_argument('filename',
|
||
|
help='The filename of the contract or truffle directory to analyze.')
|
||
|
|
||
|
# Add default arguments from crytic-compile
|
||
|
cryticparser.init(parser)
|
||
|
|
||
|
return parser.parse_args()
|
||
|
|
||
|
|
||
|
def main():
|
||
|
args = parse_args()
|
||
|
|
||
|
# Perform slither analysis on the given filename
|
||
|
slither = Slither(args.filename, **vars(args))
|
||
|
|
||
|
logger.info('Analysis done!')
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|