-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclocksLOCAL.py
More file actions
147 lines (129 loc) · 4.97 KB
/
clocksLOCAL.py
File metadata and controls
147 lines (129 loc) · 4.97 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import base64, codecs, json, requests
import pickle
import os
import sys
import simplejson as json
from pycoingecko import CoinGeckoAPI
from cfonts import render, say
import time as t
import requests
import subprocess
import random
import pickle
ndconnectload = {"ip_port":"", "tls":"", "macaroon":"", "ln":""}
ver = "PyBLOCK Micro v0.0.2"
faceshappy = {
"SLEEP" : '(⇀‿‿↼)',
"SLEEP2" : '(≖‿‿≖)',
"AWAKE" : '(◕‿‿◕)',
"INTENSE" : '(°▃▃°)',
"COOL" : '(⌐■_■)',
"HAPPY" : '(•‿‿•)',
"GRATEFUL" : '(^‿‿^)',
"EXCITED" : '(ᵔ◡◡ᵔ)',
"MOTIVATED" : '(☼‿‿☼)',
"SMART" : '(✜‿‿✜)',
"FRIEND" : '(♥‿‿♥)'
}
faceslookaround = {
"LOOK_R" : '( ⚆_⚆)',
"LOOK_L" : '(☉_☉ )',
"LOOK_R_HAPPY" : '( ◕‿◕)',
"LOOK_L_HAPPY" : '(◕‿◕ )'
}
facessad = {
"BORED" : '(-__-)',
"DEMOTIVATED" : '(≖__≖)',
"LONELY" : '(ب__ب)',
"SAD" : '(╥☁╥ )',
"ANGRY" : '(-_-)',
"BROKEN" : '(☓‿‿☓)'
}
def clear(): # clear the screen
os.system('cls' if os.name=='nt' else 'clear')
#-----------------------------COINGECKO--------------------------------
def CoingeckoPP():
btcInfo = CoinGeckoAPI()
n = btcInfo.get_price(ids='bitcoin', vs_currencies='usd')
q = n['bitcoin']
usd = q['usd']
output = render(str(usd), colors=['white', 'black'], align='center', font='simple')
print("\a\x1b[?25l" + output)
#-----------------------------END COINGECKO--------------------------------
def rpc(method, params=[]):
payload = json.dumps({
"jsonrpc": "2.0",
"id": "minebet",
"method": method,
"params": params
})
path = {"ip_port":"", "rpcuser":"", "rpcpass":"", "bitcoincli":""}
if os.path.isfile('bclock.conf'): # Check if the file 'bclock.conf' is in the same folder
pathv = pickle.load(open("bclock.conf", "rb")) # Load the file 'bclock.conf'
path = pathv # Copy the variable pathv to 'path'
return requests.post(path['ip_port'], auth=(path['rpcuser'], path['rpcpass']), data=payload).json()['result']
def remotegetblock():
try:
b = rpc('getblockcount')
c = str(b)
a = c
clear()
pp = random.choice(list(faceslookaround.values())).encode('utf-8').decode('latin-1')
output5 = subprocess.check_output(['sudo', 'iwgetid'])
z = str(output5)
print(ver + " ---> Connected to SSID: " + z.split('"')[1] + " & Tor")
print("BLOCK " + str(pp))
output = render(str(c), colors=['white', 'black'], align='center', font='simple')
print(output)
print("PRICE")
CoingeckoPP()
while True:
x = a
b = rpc('getblockcount')
c = str(b)
if c > a:
clear()
output5 = subprocess.check_output(['sudo', 'iwgetid'])
z = str(output5)
pp = random.choice(list(faceshappy.values())).encode('utf-8').decode('latin-1')
print(ver + " ---> Connected to SSID: " + z.split('"')[1] + " & Tor")
print("BLOCK " + str(pp))
output = render(str(c), colors=['white', 'black'], align='center', font='simple')
print(output)
print("PRICE")
CoingeckoPP()
t.sleep(15)
a = c
pp = random.choice(list(faceslookaround.values())).encode('utf-8').decode('latin-1')
clear()
print(ver + " ---> Connected to SSID: " + z.split('"')[1] + " & Tor")
print("BLOCK " + str(pp))
output = render(str(a), colors=['white', 'black'], align='center', font='simple')
print(output)
print("PRICE")
CoingeckoPP()
except:
pp = random.choice(list(facessad.values())).encode('utf-8').decode('latin-1')
os.system("python3 clocks.py")
print("Bad Connection... Restarting... " + str(pp))
pp = random.choice(list(faceslookaround.values())).encode('utf-8').decode('latin-1')
print(pp)
t.sleep(5)
while True:
try:
clear()
path = {"ip_port":"", "rpcuser":"", "rpcpass":""}
if os.path.isfile('bclock.conf') or os.path.isfile('blnclock.conf'): # Check if the file 'bclock.conf' is in the same folder
pathv = pickle.load(open("bclock.conf", "rb")) # Load the file 'bclock.conf'
path = pathv # Copy the variable pathv to 'path'
else:
print("Welcome to PyBLOCK Micro\n\n")
print("\n\tIf you are going to use your local node leave IP:PORT/USER/PASSWORD in blank.\n")
path['ip_port'] = "http://{}".format(input("Insert IP:PORT to access your remote Bitcoin-Cli node: "))
path['rpcuser'] = input("RPC User: ")
path['rpcpass'] = input("RPC Password: ")
pickle.dump(path, open("bclock.conf", "wb"))
remotegetblock()
except:
print("\n")
sys.exit(101)