Merge branch 'dev' into dev-refactor-output

pull/72/head
Josselin 6 years ago
commit f529252f84
  1. 1
      README.md
  2. 9
      examples/scripts/convert_to_ir.py
  3. 2
      examples/scripts/export_to_dot.py
  4. 2
      examples/scripts/functions_called.py
  5. 2
      examples/scripts/functions_writing.py
  6. 2
      examples/scripts/slithIR.py
  7. 2
      examples/scripts/taint_mapping.py
  8. 2
      examples/scripts/variable_in_condition.py
  9. 2
      scripts/travis_test.sh
  10. 2
      setup.py
  11. 2
      slither/__main__.py
  12. 4
      slither/analyses/taint/specific_variable.py
  13. 2
      slither/printers/functions/authorization.py
  14. 7
      slither/solc_parsing/declarations/contract.py

@ -62,7 +62,6 @@ Num | Detector | What it Detects | Impact | Confidence
13 | `pragma` | If different pragma directives are used | Informational | High 13 | `pragma` | If different pragma directives are used | Informational | High
14 | `solc-version` | Old versions of Solidity (< 0.4.23) | Informational | High 14 | `solc-version` | Old versions of Solidity (< 0.4.23) | Informational | High
15 | `unused-state` | Unused state variables | Informational | High 15 | `unused-state` | Unused state variables | Informational | High
16 | `complex-function` | Complex functions | Informational | Medium
[Contact us](https://www.trailofbits.com/contact/) to get access to additional detectors. [Contact us](https://www.trailofbits.com/contact/) to get access to additional detectors.

@ -3,19 +3,18 @@ from slither.slither import Slither
from slither.slithir.convert import convert_expression from slither.slithir.convert import convert_expression
if len(sys.argv) != 4: if len(sys.argv) != 2:
print('python.py function_called.py functions_called.sol Contract function()') print('python function_called.py functions_called.sol')
exit(-1) exit(-1)
# Init slither # Init slither
slither = Slither(sys.argv[1]) slither = Slither(sys.argv[1])
# Get the contract # Get the contract
contract = slither.get_contract_from_name(sys.argv[2]) contract = slither.get_contract_from_name('Test')
# Get the variable # Get the variable
test = contract.get_function_from_signature(sys.argv[3]) test = contract.get_function_from_signature('one()')
#test = contract.get_function_from_signature('two()')
nodes = test.nodes nodes = test.nodes

@ -3,7 +3,7 @@ from slither.slither import Slither
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('python.py function_called.py') print('python function_called.py contract.sol')
exit(-1) exit(-1)
# Init slither # Init slither

@ -2,7 +2,7 @@ import sys
from slither.slither import Slither from slither.slither import Slither
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('python.py function_called.py functions_called.sol') print('python functions_called.py functions_called.sol')
exit(-1) exit(-1)
# Init slither # Init slither

@ -2,7 +2,7 @@ import sys
from slither.slither import Slither from slither.slither import Slither
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('python.py function_writing.py functions_writing.sol') print('python function_writing.py functions_writing.sol')
exit(-1) exit(-1)
# Init slither # Init slither

@ -2,7 +2,7 @@ import sys
from slither import Slither from slither import Slither
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('python.py slithIR.py contract.sol') print('python slithIR.py contract.sol')
exit(-1) exit(-1)
# Init slither # Init slither

@ -56,7 +56,7 @@ def check_call(func, taints):
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('python.py taint.py taint.sol') print('python taint_mapping.py taint.sol')
exit(-1) exit(-1)
# Init slither # Init slither

@ -2,7 +2,7 @@ import sys
from slither.slither import Slither from slither.slither import Slither
if len(sys.argv) != 2: if len(sys.argv) != 2:
print('python.py variable_in_condition.py variable_in_condition.sol') print('python variable_in_condition.py variable_in_condition.sol')
exit(-1) exit(-1)
# Init slither # Init slither

@ -26,7 +26,7 @@ test_slither tests/tx_origin.sol "tx-origin" 2
test_slither tests/unused_state.sol "unused-state" 1 test_slither tests/unused_state.sol "unused-state" 1
test_slither tests/locked_ether.sol "locked-ether" 1 test_slither tests/locked_ether.sol "locked-ether" 1
test_slither tests/arbitrary_send.sol "arbitrary-send" 2 test_slither tests/arbitrary_send.sol "arbitrary-send" 2
test_slither tests/complex_func.sol "complex-function" 3 #test_slither tests/complex_func.sol "complex-function" 3
test_slither tests/inline_assembly_contract.sol "assembly" 1 test_slither tests/inline_assembly_contract.sol "assembly" 1
test_slither tests/inline_assembly_library.sol "assembly" 2 test_slither tests/inline_assembly_library.sol "assembly" 2
test_slither tests/low_level_calls.sol "low-level-calls" 1 test_slither tests/low_level_calls.sol "low-level-calls" 1

@ -5,7 +5,7 @@ setup(
description='Slither is a Solidity static analysis framework written in Python 3.', description='Slither is a Solidity static analysis framework written in Python 3.',
url='https://github.com/trailofbits/slither', url='https://github.com/trailofbits/slither',
author='Trail of Bits', author='Trail of Bits',
version='0.1.0', version='0.2.0',
packages=find_packages(), packages=find_packages(),
python_requires='>=3.6', python_requires='>=3.6',
install_requires=['prettytable>=0.7.2'], install_requires=['prettytable>=0.7.2'],

@ -130,7 +130,7 @@ def get_detectors_and_printers():
LowLevelCalls, LowLevelCalls,
NamingConvention, NamingConvention,
ConstCandidateStateVars, ConstCandidateStateVars,
ComplexFunction, #ComplexFunction,
ExternalFunction] ExternalFunction]
from slither.printers.summary.function import FunctionSummary from slither.printers.summary.function import FunctionSummary

@ -15,9 +15,7 @@ from .common import iterate_over_irs
def make_key(variable): def make_key(variable):
if isinstance(variable, Variable): if isinstance(variable, Variable):
key = 'TAINT_{}{}{}'.format(variable.contract.name, key = 'TAINT_{}'.format(id(variable))
variable.name,
str(type(variable)))
else: else:
assert isinstance(variable, SolidityVariable) assert isinstance(variable, SolidityVariable)
key = 'TAINT_{}{}'.format(variable.name, key = 'TAINT_{}{}'.format(variable.name,

@ -39,4 +39,4 @@ class PrinterWrittenVariablesAndAuthorization(AbstractPrinter):
state_variables_written = [v.name for v in function.all_state_variables_written()] state_variables_written = [v.name for v in function.all_state_variables_written()]
msg_sender_condition = self.get_msg_sender_checks(function) msg_sender_condition = self.get_msg_sender_checks(function)
table.add_row([function.name, str(state_variables_written), str(msg_sender_condition)]) table.add_row([function.name, str(state_variables_written), str(msg_sender_condition)])
self.info(txt + str(table)) self.info(txt + str(table))

@ -235,9 +235,14 @@ class ContractSolc04(Contract):
self._variables[var.name] = var self._variables[var.name] = var
def analyze_constant_state_variables(self): def analyze_constant_state_variables(self):
from slither.solc_parsing.expressions.expression_parsing import VariableNotFound
for var in self.variables: for var in self.variables:
if var.is_constant: if var.is_constant:
var.analyze(self) # cant parse constant expression based on function calls
try:
var.analyze(self)
except VariableNotFound:
pass
return return
def analyze_state_variables(self): def analyze_state_variables(self):

Loading…
Cancel
Save