|
|
@ -11,6 +11,7 @@ from mythril.analysis.swc_data import SWC_TO_TITLE |
|
|
|
from mythril.support.source_support import Source |
|
|
|
from mythril.support.source_support import Source |
|
|
|
from mythril.support.start_time import StartTime |
|
|
|
from mythril.support.start_time import StartTime |
|
|
|
from mythril.support.support_utils import get_code_hash |
|
|
|
from mythril.support.support_utils import get_code_hash |
|
|
|
|
|
|
|
from mythril.support.signatures import SignatureDB |
|
|
|
from time import time |
|
|
|
from time import time |
|
|
|
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__) |
|
|
|
log = logging.getLogger(__name__) |
|
|
@ -151,6 +152,30 @@ class Issue: |
|
|
|
else: |
|
|
|
else: |
|
|
|
self.source_mapping = self.address |
|
|
|
self.source_mapping = self.address |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def resolve_function_names(self): |
|
|
|
|
|
|
|
""" Resolves function names for each step """ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
self.transaction_sequence is None |
|
|
|
|
|
|
|
or "steps" not in self.transaction_sequence |
|
|
|
|
|
|
|
): |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signatures = SignatureDB() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for step in self.transaction_sequence["steps"]: |
|
|
|
|
|
|
|
_hash = step["input"][:10] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
sig = signatures.get(_hash) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(sig) > 0: |
|
|
|
|
|
|
|
step["name"] = sig[0] |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
step["name"] = "unknown" |
|
|
|
|
|
|
|
except ValueError: |
|
|
|
|
|
|
|
step["name"] = "unknown" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Report: |
|
|
|
class Report: |
|
|
|
"""A report containing the content of multiple issues.""" |
|
|
|
"""A report containing the content of multiple issues.""" |
|
|
@ -187,6 +212,7 @@ class Report: |
|
|
|
""" |
|
|
|
""" |
|
|
|
m = hashlib.md5() |
|
|
|
m = hashlib.md5() |
|
|
|
m.update((issue.contract + str(issue.address) + issue.title).encode("utf-8")) |
|
|
|
m.update((issue.contract + str(issue.address) + issue.title).encode("utf-8")) |
|
|
|
|
|
|
|
issue.resolve_function_names() |
|
|
|
self.issues[m.digest()] = issue |
|
|
|
self.issues[m.digest()] = issue |
|
|
|
|
|
|
|
|
|
|
|
def as_text(self): |
|
|
|
def as_text(self): |
|
|
|