Improve callgraph readability

pull/12/head
Bernhard Mueller 7 years ago
parent 96c2f52dd8
commit fc871b2ea2
  1. 5
      mythril/disassembler/callgraph.py
  2. BIN
      static/callgraph4.png
  3. BIN
      static/callgraph5.png
  4. 6
      static/mythril.html

@ -121,9 +121,8 @@ def serialize(_svm):
except Z3Exception:
label = str(edge.condition)
label = re.sub("[0]{8}[0]+", "0000(...)", label)
label = re.sub("[f]{8}[f]+", "ffff(...)", label)
label = re.sub("([0-9a-f]{8})(\d+)", lambda m: m.group(1) + "(...)", label)
label = re.sub("([[\d]{2}\d+)", lambda m: hex(int(m.group(1))), label)
code = re.sub("([0-9a-f]{8})(\d+)", lambda m: m.group(1) + "(...)", code)
edges.append("{from: " + str(edge.as_dict()['from']) + ', to: ' + str(edge.as_dict()['to']) + ", 'arrows': 'to', 'label': '" + label + "', 'smooth': {'type': 'cubicBezier'}}")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

@ -97,14 +97,14 @@ var edges = [
{from: 200, to: 277, 'arrows': 'to', 'label': 'Not(storage_sha_hash == 0)', 'smooth': {'type': 'cubicBezier'}},
{from: 103, to: 200, 'arrows': 'to', 'label': '', 'smooth': {'type': 'cubicBezier'}},
{from: 92, to: 103, 'arrows': 'to', 'label': 'callvalue == 0', 'smooth': {'type': 'cubicBezier'}},
{from: 0, to: 92, 'arrows': 'to', 'label': 'Extract(255, 224, calldata_0) == 10202537(...)', 'smooth': {'type': 'cubicBezier'}},
{from: 0, to: 92, 'arrows': 'to', 'label': 'Extract(0xff, 0xe0, calldata_0) == 0x3ccfd60b', 'smooth': {'type': 'cubicBezier'}},
{from: 468, to: 168, 'arrows': 'to', 'label': '', 'smooth': {'type': 'cubicBezier'}},
{from: 124, to: 468, 'arrows': 'to', 'label': '', 'smooth': {'type': 'cubicBezier'}},
{from: 113, to: 124, 'arrows': 'to', 'label': 'callvalue == 0', 'smooth': {'type': 'cubicBezier'}},
{from: 0, to: 113, 'arrows': 'to', 'label': 'Extract(255, 224, calldata_0) == 41724670(...)', 'smooth': {'type': 'cubicBezier'}},
{from: 0, to: 113, 'arrows': 'to', 'label': 'Extract(0xff, 0xe0, calldata_0) == 0xf8b2cb4f', 'smooth': {'type': 'cubicBezier'}},
{from: 540, to: 198, 'arrows': 'to', 'label': '', 'smooth': {'type': 'cubicBezier'}},
{from: 190, to: 540, 'arrows': 'to', 'label': '', 'smooth': {'type': 'cubicBezier'}},
{from: 0, to: 190, 'arrows': 'to', 'label': 'Extract(255, 224, calldata_0) == 42423952(...)', 'smooth': {'type': 'cubicBezier'}}
{from: 0, to: 190, 'arrows': 'to', 'label': 'Extract(0xff, 0xe0, calldata_0) == 0xfcddd056', 'smooth': {'type': 'cubicBezier'}}
];
</script>

Loading…
Cancel
Save