forked from Mehdi256/Rotor-Cuda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheth_addresses_to_bin.py
33 lines (27 loc) · 909 Bytes
/
eth_addresses_to_bin.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
import sys
def eth_addresses_to_bin(filein, fileout):
with open(filein) as inf, open(fileout, 'wb') as outf:
count = 0
skip = 0
for x in inf.readlines():
x = x.strip()
if len(x) == 42:
x = x[2:]
else:
skip += 1
print("skipped address:", x)
continue
try:
outf.write(bytes.fromhex(x))
count += 1
except:
skip += 1
print("skipped address:", x)
print('processed :', count, 'addresses', '\nskipped :', skip, 'addresses', )
argc = len(sys.argv)
argv = sys.argv
if argc == 1 or argc != 3:
print('Usage:')
print('\tpython3 ' + argv[0].replace('\\', '/').split('/')[-1] + ' eth_addresses_in.txt eth_addresses_out.bin')
elif argc == 3:
eth_addresses_to_bin(argv[1], argv[2])