Add trial mode messaging

analyze-with-mythx
Nathan 5 years ago
parent 74cabd3d3c
commit 389a2cc810
  1. 29
      mythril/mythx/__init__.py

@ -1,6 +1,9 @@
import sys
import os import os
import time import time
from mythx_models.exceptions import MythXAPIError
from typing import List, Dict, Any from typing import List, Dict, Any
from mythril.analysis.report import Issue, Report from mythril.analysis.report import Issue, Report
@ -30,6 +33,11 @@ def analyze(contracts: List[SolidityContract], analysis_mode: str = "quick") ->
password=os.environ.get("MYTHX_PASSWORD", "trial"), password=os.environ.get("MYTHX_PASSWORD", "trial"),
) )
if c.eth_address == "0x0000000000000000000000000000000000000000":
print(
"You are currently running MythX in Trial mode. This mode reports only a partial analysis of your smart contracts, limited to three vulnerabilities. To get a more complete analysis, sign up for a free account at https://mythx.io."
)
issues = [] # type: List[Issue] issues = [] # type: List[Issue]
# TODO: Analyze multiple contracts asynchronously. # TODO: Analyze multiple contracts asynchronously.
@ -61,15 +69,18 @@ def analyze(contracts: List[SolidityContract], analysis_mode: str = "quick") ->
pass pass
assert contract.creation_code, "Creation bytecode must exist." assert contract.creation_code, "Creation bytecode must exist."
resp = c.analyze( try:
contract_name=contract.name, resp = c.analyze(
analysis_mode=analysis_mode, contract_name=contract.name,
bytecode=contract.creation_code or None, analysis_mode=analysis_mode,
deployed_bytecode=contract.code or None, bytecode=contract.creation_code or None,
sources=sources or None, deployed_bytecode=contract.code or None,
main_source=main_source, sources=sources or None,
source_list=source_list or None, main_source=main_source,
) source_list=source_list or None,
)
except MythXAPIError as e:
log.critical(e)
while not c.analysis_ready(resp.uuid): while not c.analysis_ready(resp.uuid):
log.info(c.status(resp.uuid).analysis) log.info(c.status(resp.uuid).analysis)

Loading…
Cancel
Save