-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspam_script.py
More file actions
128 lines (112 loc) · 3.79 KB
/
spam_script.py
File metadata and controls
128 lines (112 loc) · 3.79 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import json
import time
import requests
from requests.auth import HTTPDigestAuth
from random import randrange
url = "http://127.0.0.1:18083/json_rpc"
spent_keys = []
# THRESHOLD amount for the "sweep dust"
# can be adjusted but be careful if set too low you will split your inputs infinitely
min_for_tx = 5 * (10 ** 12)
address = 'empty'
list_known_mined = []
def get_address():
try:
headers = {'content-type': 'application/json'}
payload = {
"jsonrpc": "2.0",
"id": "0",
"method": "get_address",
"params": {
"account_index": 0,
}
}
response = requests.post(url, data=json.dumps(payload), headers=headers,
auth=HTTPDigestAuth('test', '123456')).json()
return response["result"]["address"]
except:
print("Error address")
print("Maybe you forgot to start the \"monero-wallet-rpc\" first!")
exit(0)
def sweep_dust(priority=4):
try:
headers = {'content-type': 'application/json'}
payload = {
"jsonrpc": "2.0",
"id": "0",
"method": "sweep_all",
"params": {
"address": address,
"priority": priority,
"unlock_time": 0,
"below_amount": min_for_tx,
}
}
response = requests.post(url, data=json.dumps(payload), headers=headers,
auth=HTTPDigestAuth('test', '123456')).json()
print("Dust: " + str(response))
except IOError:
print("Error sweep_dust")
def sweep_single(key_image):
outputs_number = int(randrange(3, 16))
try:
headers = {'content-type': 'application/json'}
payload = {
"jsonrpc": "2.0",
"id": "0",
"method": "sweep_single",
"params":
{
"address": address,
"key_image": key_image,
"priority": 4,
"unlock_time": 0,
"outputs": outputs_number,
}
}
response = requests.post(url, data=json.dumps(payload), headers=headers,
auth=HTTPDigestAuth('test', '123456')).json()
result = response["result"]
print(result)
spent_keys.append(key_image)
except:
print("Error sweep single: " + str(response))
def get_unspent_key_images():
unspent_key_images = []
try:
headers = {'content-type': 'application/json'}
payload = {
"jsonrpc": "2.0",
"id": "0",
"method": "incoming_transfers",
"params": {
"transfer_type": "available",
"verbose": True,
},
}
response = requests.post(url, data=json.dumps(payload), headers=headers,
auth=HTTPDigestAuth('test', '123456')).json()
transfers = response["result"]["transfers"]
for transfer in transfers:
if not transfer["spent"] and transfer["key_image"] not in spent_keys:
unspent_key_images.append(transfer["key_image"])
return unspent_key_images
except (IOError, KeyError) as exception:
print("Error largest unspent")
return unspent_key_images
def spam():
# just to clean up the wallet if to many inputs were generated
sweep_dust(1)
while True:
sweep_dust()
key_images = get_unspent_key_images()
for key_image in key_images:
print("Swept Single: " + str(key_image))
sweep_single(key_image)
print("Sleeping")
time.sleep(60)
print("Waky Waky")
if __name__ == '__main__':
address = get_address()
print("address: " + address)
spam()