Add transaction trace to text output

pull/1108/head
Bernhard Mueller 5 years ago
parent fd5e1c59cf
commit aa3ce53cd8
  1. 18
      mythril/analysis/report.py
  2. 12
      mythril/analysis/templates/report_as_text.jinja2

@ -67,16 +67,12 @@ class Issue:
@property
def transaction_sequence_users(self):
""" Returns the transaction sequence in json without pre-generated block data"""
return (
json.dumps(self.transaction_sequence, indent=4)
if self.transaction_sequence
else None
)
""" Returns the transaction sequence without pre-generated block data"""
return self.transaction_sequence
@property
def transaction_sequence_jsonv2(self):
""" Returns the transaction sequence in json with pre-generated block data"""
""" Returns the transaction sequence as a json string with pre-generated block data"""
return (
json.dumps(self.add_block_data(self.transaction_sequence), indent=4)
if self.transaction_sequence
@ -102,6 +98,7 @@ class Issue:
:return:
"""
issue = {
"title": self.title,
"swc-id": self.swc_id,
@ -110,7 +107,7 @@ class Issue:
"function": self.function,
"severity": self.severity,
"address": self.address,
"tx_sequence": self.transaction_sequence_users,
"tx_sequence": self.transaction_sequence,
"min_gas_used": self.min_gas_used,
"max_gas_used": self.max_gas_used,
"sourceMap": self.source_mapping,
@ -165,8 +162,8 @@ class Report:
def __init__(self, contracts=None, exceptions=None):
"""
:param :contracts:
:param :exceptions:
:param contracts:
:param exceptions:
"""
self.issues = {}
self.solc_version = ""
@ -224,6 +221,7 @@ class Report:
:return:
"""
_issues = []
source_list = []
for key, issue in self.issues.items():

@ -18,13 +18,17 @@ In file: {{ issue.filename }}:{{ issue.lineno }}
--------------------
{% endif %}
{% if verbose and issue.tx_sequence %}
--------------------
{% if issue.tx_sequence %}
Transaction Sequence:
{{ issue.tx_sequence }}
{% for step in issue.tx_sequence.steps %}
{% if step == issue.tx_sequence.steps[0] and step.input != "0x" and step.origin == "0xaffeaffeaffeaffeaffeaffeaffeaffeaffeaffe" %}
Caller: {{ step.origin }}, data: [CONTRACT CREATION], value: {{ step.value }}
{% else %}
Caller: {{ step.origin }}, data: {{ step.input }}, value: {{ step.value }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% else %}
The analysis was completed successfully. No issues were detected.

Loading…
Cancel
Save