Fix issue reporting for trial analysis

analyze-with-mythx
Nathan 5 years ago
parent 00179d22c3
commit 74cabd3d3c
  1. 6
      mythril/mythx/__init__.py
  2. 6
      mythril/solidity/soliditycontract.py

@ -79,8 +79,10 @@ def analyze(contracts: List[SolidityContract], analysis_mode: str = "quick") ->
issue = Issue( issue = Issue(
contract=contract.name, contract=contract.name,
function_name=None, function_name=None,
address=issue.locations[0].source_map.components[0].offset, address=issue.locations[0].source_map.components[0].offset
swc_id=issue.swc_id[4:], # remove 'SWC-' prefix if issue.locations
else -1,
swc_id=issue.swc_id[4:] or "None", # remove 'SWC-' prefix
title=issue.swc_title, title=issue.swc_title,
bytecode=contract.creation_code, bytecode=contract.creation_code,
severity=issue.severity.capitalize(), severity=issue.severity.capitalize(),

@ -56,15 +56,15 @@ def get_contracts_from_file(input_file, solc_settings_json=None, solc_binary="so
) )
try: try:
for contractName in data["contracts"][input_file].keys(): for contract_name in data["contracts"][input_file].keys():
if len( if len(
data["contracts"][input_file][contractName]["evm"]["deployedBytecode"][ data["contracts"][input_file][contract_name]["evm"]["deployedBytecode"][
"object" "object"
] ]
): ):
yield SolidityContract( yield SolidityContract(
input_file=input_file, input_file=input_file,
name=contractName, name=contract_name,
solc_settings_json=solc_settings_json, solc_settings_json=solc_settings_json,
solc_binary=solc_binary, solc_binary=solc_binary,
) )

Loading…
Cancel
Save