Skip to content

Commit

Permalink
Add dump_to_file() functionality for exploit.
Browse files Browse the repository at this point in the history
  • Loading branch information
cleanunicorn committed Jul 23, 2019
1 parent 62ab9cb commit 94679a0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
6 changes: 3 additions & 3 deletions test/input-tx.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[
[
{
"input": "0x4e71e0c8",
"data": "0x4e71e0c8",
"value": 100000000000000000
},
{
"input": "0x2e64cec1",
"data": "0x2e64cec1",
"value": "0x0"
}
],
[
{
"input": "0xdeadbeef"
"data": "0xdeadbeef"
}
]
]
9 changes: 9 additions & 0 deletions theo/exploit/exploit.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,12 @@ def wait_for(self, contract, tx, flush=False):
)
)
return pending_tx

def dump_to_file(self, file=None):
from theo import dump

exploit_object = []
for tx in self.txs:
exploit_object.append(tx.__dict__)

dump(ob=[exploit_object], filename=file)
2 changes: 1 addition & 1 deletion theo/file/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def exploits_from_file(
for exploit in exploit_list:
txs = []
for tx in exploit:
txs.append(Tx(data=tx.get("input", "0x"), value=tx.get("value", 0)))
txs.append(Tx(data=tx.get("data", "0x"), value=tx.get("value", 0)))

exploits.append(
Exploit(
Expand Down
2 changes: 1 addition & 1 deletion theo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v0.5.6"
__version__ = "v0.6.0"

0 comments on commit 94679a0

Please sign in to comment.