From 134627e37e1582e2fb2f7fec30870ef7af7df5b4 Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 30 Aug 2019 11:33:02 -0400 Subject: [PATCH] Fix up some missed bugs --- mythril/interfaces/cli.py | 10 ++++++++-- mythril/laser/ethereum/util.py | 4 ++-- mythril/mythx/__init__.py | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mythril/interfaces/cli.py b/mythril/interfaces/cli.py index 6743e008..1501120f 100644 --- a/mythril/interfaces/cli.py +++ b/mythril/interfaces/cli.py @@ -218,8 +218,9 @@ def main() -> None: pro_parser = subparsers.add_parser( PRO_LIST[0], help="Analyzes input with the MythX API (https://mythx.io)", - aliases=PRO_LIST[1], + aliases=PRO_LIST[1:], parents=[utilities_parser, creation_input_parser, output_parser], + formatter_class=RawTextHelpFormatter, ) create_pro_parser(pro_parser) @@ -276,12 +277,17 @@ def create_pro_parser(parser: ArgumentParser): :param parser: :return: """ + parser.add_argument( + "solidity_files", + nargs="*", + help="Inputs file name and contract name. \n" + "usage: file1.sol:OptionalContractName file2.sol file3.sol:OptionalContractName", + ) parser.add_argument( "--full", help="Run a full analysis. Default: quick analysis", action="store_true", ) - parser.add_argument("solidity_file", nargs="*") def create_read_storage_parser(read_storage_parser: ArgumentParser): diff --git a/mythril/laser/ethereum/util.py b/mythril/laser/ethereum/util.py index 52b8cf94..ff544559 100644 --- a/mythril/laser/ethereum/util.py +++ b/mythril/laser/ethereum/util.py @@ -45,8 +45,8 @@ def get_instruction_index( """ index = 0 for instr in instruction_list: - if instr["address"] > address: - return index - 1 + if instr["address"] >= address: + return index index += 1 return None diff --git a/mythril/mythx/__init__.py b/mythril/mythx/__init__.py index c5602459..ae105470 100644 --- a/mythril/mythx/__init__.py +++ b/mythril/mythx/__init__.py @@ -8,6 +8,10 @@ from mythril.solidity.soliditycontract import SolidityContract from pythx import Client +import logging + +log = logging.getLogger(__name__) + def analyze(contracts: List[SolidityContract], analysis_mode: str = "quick") -> Report: """ @@ -68,7 +72,7 @@ def analyze(contracts: List[SolidityContract], analysis_mode: str = "quick") -> ) while not c.analysis_ready(resp.uuid): - print(c.status(resp.uuid).analysis) + log.info(c.status(resp.uuid).analysis) time.sleep(5) for issue in c.report(resp.uuid):