-
Notifications
You must be signed in to change notification settings - Fork 5
/
flood3.py
62 lines (48 loc) · 1.7 KB
/
flood3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import psutil
import threading
import time
import json
import random
from grapheneapi.grapheneapi import GrapheneAPI
import subprocess
def wallet(port):
print("Starting new wallet on port %d" % port)
proc = subprocess.Popen([
"/home/xeroc/BitShares/testnet/testnet/programs/cli_wallet/cli_wallet",
"--server-rpc-endpoint=ws://this.uptick.rocks:18090",
"--rpc-http-endpoint=127.0.0.1:%d" % port,
"--wallet-file=/home/xeroc/BitShares/testnet/testnet/wallet.json",
"--daemon"
])
return proc
def kill(proc):
proc.terminate()
def run(port, n=0):
client = GrapheneAPI("localhost", port)
client.unlock("password")
transfer = client.get_prototype_operation("transfer_operation")
from_account = client.get_account("faucet")
to_account = client.get_account("xeroc")
transfer[1]["to"] = to_account["id"]
transfer[1]["from"] = from_account["id"]
transfer[1]["amount"]["amount"] = 1 + n
while True:
#builder = client.begin_builder_transaction()
for i in range(0, 200 + random.randint(0, 1000)):
print(n, end="", flush=True)
#client.add_operation_to_builder_transaction(builder, transfer)
client.transfer("faucet", "init0", 100 + n, "TEST", "", True)
#client.set_fees_on_builder_transaction(builder, "1.3.0")
#print("\nTransfer!")
#client.sign_builder_transaction(builder, True)
#time.sleep(random.randint(0, 3))
def flooder(n=0):
port = 9900 + n
p = wallet(port)
time.sleep(15 + random.randint(0, 5))
run(port, n)
print("sleep 10")
time.sleep(10)
kill(p)
for i in range(0, 10):
threading.Thread(target=flooder, args=(i,)).start()