From 75d50727a783c488b678a59fcf72854d5bcbfe2a Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Mon, 25 May 2020 19:35:24 -0300 Subject: [PATCH 01/12] rc1-v0.2.0 Added colors to the interface Added "show confirmations" for any tx Added feature sending messages to space with Satnode Added a permanent Logo Added System Information (CPU - Memory - Disk) --- PyBlock.py | 258 +++++++++++++++++++++++++++++++++------------------- apisnd.py | 97 ++++++++++++++++++++ clone.py | 9 +- donation.py | 13 ++- feed.py | 7 +- logos.py | 12 +-- pblogo.py | 9 ++ sysinf.py | 15 +++ 8 files changed, 312 insertions(+), 108 deletions(-) create mode 100644 apisnd.py create mode 100644 pblogo.py create mode 100644 sysinf.py diff --git a/PyBlock.py b/PyBlock.py index b149eee..5a811a8 100644 --- a/PyBlock.py +++ b/PyBlock.py @@ -1,18 +1,29 @@ #Developer: Curly60e -#PyBLØCK its a clock of the Bitcoin blockchain. -#Version: 0.1.0.1 +#PyBLOCK its a clock of the Bitcoin blockchain. +#Version: 0.2.0 import os import os.path import time as t import pickle +import psutil from clone import * from donation import * from feed import * from art import * from logos import * +from sysinf import * +from pblogo import * +from apisnd import * + +def sysinfo(): #Cpu and memory usage + print(" \033[0;37;40m----------------------") + print(" |\033[3;33;40mCPU Usage: \033[1;32;40m" + str(psutil.cpu_percent()) + "%\033[0;37;40m |") + print(" |\033[3;33;40mMemory Usage: \033[1;32;40m" "{}% \033[0;37;40m |".format(int(psutil.virtual_memory().percent))) + print(" \033[0;37;40m----------------------") + def getblock(): # get access to bitcoin-cli with the command getblockchaininfo bitcoincli = " getblockchaininfo" os.system(path + bitcoincli) @@ -24,14 +35,14 @@ def getblockcount(): # get access to bitcoin-cli with the command getblockcount def clear(): # clear the screen os.system('cls' if os.name=='nt' else 'clear') -def getgenesis(): # get and decode Genesis block +def getgenesis(): # get and decode Genesis block bitcoincli = " getblock 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f 0 | xxd -r -p | hexyl -n 256" os.system(path + bitcoincli) - + def console(): # get into the console from bitcoin-cli - print("\tThis is Bitcoin-cli's console. Type your respective commands you want to display.\n\n") + print("\t\033[0;37;40mThis is \033[1;33;40mBitcoin-cli's \033[0;37;40mconsole. Type your respective commands you want to display.\n\n") while True: - cle = input("console $>: ") + cle = input("\033[1;32;40mconsole $>: \033[0;37;40m") lsd = os.popen(str(path + " " + cle)).read() print(lsd) @@ -48,8 +59,8 @@ def connected(info): # here we complete the connection to the external node def nodeinfo(): - print("\nWARNING! This is not a safe method of connection. The best method is doing this locally.\n") - connected(input("WARNING! Are you sure you want to connect to a node? Y/n: ")) # call 'connected' function to make the connection with the node information + print("\n\033[1;31;40mWARNING! This is not a safe method of connection. The best method is doing this locally.\n") + connected(input("WARNING! Are you sure you want to connect to a node? Y/n: \033[0;37;40m")) # call 'connected' function to make the connection with the node information def artist(): # here we convert the result of the command 'getblockcount' on a random art design @@ -82,14 +93,15 @@ def design(): bitcoinclient = path + " getblockcount" block = os.popen(str(bitcoinclient)).read() # 'getblockcount' convert to string b = block + print("\033[1;32;40m") tprint(b, font="rnd-large") - + print("\033[0;37;40m") #------------------------------------------- SSH connection external node -------------------------------------------- def userconn(): # All the connection to a remote node - option = input("Select option: ") + option = input("\033[1;32;40mSelect option: \033[0;37;40m") if option == "A" or option == "a": # Execution of the secondary Menu menuUserConn - user = input("USER@NODE: ") + user = input("\033[1;36;40mUSER\033[0;37;40m@\033[1;33;40mNODE: \033[0;37;40m") s = input("Do you want to continue Y/n: ") if s == "Y" or s == "y": clear() @@ -102,7 +114,9 @@ def userconn(): # All the connection to a remote node sshb = "ssh " + user + " '" + "{}".format(path) + "'" + " getblockcount" sshc = os.popen(str(sshb)).read() sshd = sshc + print("\033[1;32;40m") tprint(sshd, font="rnd-large") + print("\033[0;37;40m") tmp() except (KeyboardInterrupt, SystemExit): menuUserConn() @@ -123,7 +137,7 @@ def userconn(): # All the connection to a remote node else: menu() elif option == "B" or option == "b": # Decode Block 0 on HEX for external node - user = input("USER@NODE: ") + user = input("\033[1;36;40mUSER\033[0;37;40m@\033[1;33;40mNODE: \033[0;37;40m") while True: clear() prt() @@ -170,7 +184,7 @@ def readHexBlock(): # Hex Decoder using Hexyl on local node os.system(decodeBlock) def readHexBlockSsh(): # Hex Decoder using Hexyl on an external node - user = input("USER@NODE: ") + user = input("\033[1;36;40mUSER\033[0;37;40m@\033[1;33;40mNODE: \033[0;37;40m") clear() prt() hexa = input("Add the Block Hash you want to decode: ") @@ -179,14 +193,14 @@ def readHexBlockSsh(): # Hex Decoder using Hexyl on an external node clear() prt() os.system(decodeBlock) - + def readHexTx(): # Hex Decoder using Hexyl on an external node hexa = input("Add the Transaction ID. you want to decode: ") decodeTX = path + " getrawtransaction {}".format(hexa) + " | xxd -r -p | hexyl -n 256" os.system(decodeTX) def readHexTXSsh(): # Hex Decoder using Hexyl on an external node - user = input("USER@NODE: ") + user = input("\033[1;36;40mUSER\033[0;37;40m@\033[1;33;40mNODE: \033[0;37;40m") clear() prt() hexa = input("Add the Transaction ID. you want to decode: ") @@ -194,7 +208,23 @@ def readHexTXSsh(): # Hex Decoder using Hexyl on an external node clear() prt() os.system(decodeTX) - + +def getrawtx(): # show confirmatins from transactions + tx = input("Insert your TxID: ") + while True: + try: + clear() + prt() + close() + bitcoincli = " getrawtransaction " + lsd = os.popen(str(path + bitcoincli + tx + " 1")).read() + lsda = lsd.split(',') + lsdb = lsda[-3] + lsdc = str(lsdb) + print("\033[0;37;40mTransaction " + "\033[1;31;40m{}\033[0;37;40m".format(tx) + " has:\n" + "\033[1;31;40m{}\033[0;37;40m".format(lsdc)) + tmp() + except (KeyboardInterrupt, SystemExit): + menu() #--------------------------------- End Hex Block Decoder Functions ------------------------------------- #--------------------------------- Menu section ----------------------------------- @@ -202,105 +232,115 @@ def readHexTXSsh(): # Hex Decoder using Hexyl on an external node def menu(): #Main Menu clear() prt() + sysinfo() print("""\t\t - PyBLØCK Menu - Version 0.1.0.1 + \033[1;31;40mPyBLOCK\033[0;37;40m Menu + Version 0.2.0 - A. Run PyBLØCK in your own node - B. Show Blockchain information in your own node - C. Show the Genesis Block - D. Decode in HEX any block - E. Decode in HEX any transaction - F. Connect to an external node through SSH - G. Advanced - X. Donate - Q. Exit + \033[1;32;40mA.\033[0;37;40m Run PyBLOCK in your own node + \033[1;32;40mB.\033[0;37;40m Show Blockchain information in your own node + \033[1;32;40mC.\033[0;37;40m Show the Genesis Block + \033[1;32;40mD.\033[0;37;40m Decode in HEX any block + \033[1;32;40mE.\033[0;37;40m Decode in HEX any transaction + \033[1;32;40mF.\033[0;37;40m Show confirmations from a transaction + \033[1;32;40mG.\033[0;37;40m Connect to an external node through SSH + \033[1;32;40mH.\033[0;37;40m Advanced + \033[1;34;40mS.\033[0;37;40m SatNode + \033[1;35;40mX.\033[0;37;40m Donate + \033[1;33;40mQ.\033[0;37;40m Exit \n\n""") - menuA(input("Select option: ")) + menuA(input("\033[1;32;40mSelect option: \033[0;37;40m")) def menuUserConn(): #Menu before connection over ssh clear() prt() + sysinfo() print("""\t\t - PyBLØCK External Node Menu - Version 0.1.0.1 + \033[1;31;40mPyBLOCK\033[0;37;40m Menu + Version 0.2.0 - A. Run PyBLØCK in this external node - B. Show the Genesis Block - C. Decode in HEX any block - D. Decode in HEX any transaction - R. Return Main Menu + \033[1;32;40mA.\033[0;37;40m Run PyBLOCK in this external node + \033[1;32;40mB.\033[0;37;40m Show the Genesis Block + \033[1;32;40mC.\033[0;37;40m Decode in HEX any block + \033[1;32;40mD.\033[0;37;40m Decode in HEX any transaction + \033[1;36;40mR.\033[0;37;40m Return Main Menu \n\n""") userconn() -def advanceMenu(): +def advanceMenu(): # Advanced Menu clear() prt() + sysinfo() print("""\t\t - PyBLØCK Advance Menu - Version 0.1.0.1 + \033[1;31;40mPyBLOCK\033[0;37;40m Menu + Version 0.2.0 - A. Bitconi-cli Console - B. FunB - C. Show QR from a Bitcoin Address - S. Satnode - R. Return Main Menu + \033[1;32;40mA.\033[0;37;40m Bitconi-cli Console + \033[1;32;40mB.\033[0;37;40m FunB + \033[1;32;40mC.\033[0;37;40m Show QR from a Bitcoin Address + \033[1;32;40mS.\033[0;37;40m Sysinfo + \033[1;36;40mR.\033[0;37;40m Return Main Menu \n\n""") - menuB(input("Select option: ")) + menuB(input("\033[1;32;40mSelect option: \033[0;37;40m")) -def dnt(): +def dnt(): # Donation selection menu clear() prt() + sysinfo() print("""\t\t - PyBLØCK Donation Menu - Version 0.1.0.1 + \033[1;31;40mPyBLOCK\033[0;37;40m Menu + Version 0.2.0 - A. Developers Donation - B. Testers Donation - D. Return Main Menu + \033[1;32;40mA.\033[0;37;40m Developers Donation + \033[1;32;40mB.\033[0;37;40m Testers Donation + \033[1;36;40mR.\033[0;37;40m Return Main Menu \n\n""") - menuC(input("Select option: ")) + menuC(input("\033[1;32;40mSelect option: \033[0;37;40m")) -def dntDev(): +def dntDev(): # Dev Donation Menu clear() prt() + sysinfo() print("""\t\t - PyBLØCK Developers Donation Menu - Version 0.1.0.1 + \033[1;31;40mPyBLOCK\033[0;37;40m Menu + Version 0.2.0 - A. PayNym - B. Bitcoin Address - C. Lightning Network - D. Return Main Menu + \033[1;32;40mA.\033[0;37;40m PayNym + \033[1;32;40mB.\033[0;37;40m Bitcoin Address + \033[1;32;40mC.\033[0;37;40m Lightning Network + \033[1;36;40mR.\033[0;37;40m Return Main Menu \n\n""") - menuE(input("Select option: ")) + menuE(input("\033[1;32;40mSelect option: \033[0;37;40m")) -def dntTst(): +def dntTst(): # Tester Donation Menu clear() prt() + sysinfo() print("""\t\t - PyBLØCK Testers Donation Menu - Version 0.1.0.1 + \033[1;31;40mPyBLOCK\033[0;37;40m Menu + Version 0.2.0 - A. Bitcoin Address - B. Lightning Network - D. Return Main Menu + \033[1;32;40mA.\033[0;37;40m Bitcoin Address + \033[1;32;40mB.\033[0;37;40m Lightning Network + \033[1;36;40mR.\033[0;37;40m Return Main Menu \n\n""") - menuF(input("Select option: ")) + menuF(input("\033[1;32;40mSelect option: \033[0;37;40m")) -def satnodeMenu(): +def satnodeMenu(): # Satnode Menu clear() prt() + sysinfo() print("""\t\t - PyBLØCK Satnode Menu - Version 0.1.0.1 + \033[1;31;40mPyBLOCK\033[0;37;40m Menu + Version 0.2.0 - A. Start SatNode - B. Feed - C. Setup - D. Return Main Menu + \033[1;32;40mA.\033[0;37;40m Start SatNode + \033[1;32;40mB.\033[0;37;40m Feed + \033[1;32;40mC.\033[0;37;40m Setup + \033[1;34;40mS.\033[0;37;40m Send a Message to Space + \033[1;36;40mD.\033[0;37;40m Return Main Menu \n\n""") - menuD(input("Select option: ")) + menuD(input("\033[1;32;40mSelect option: \033[0;37;40m")) #--------------------------------- End Menu section ----------------------------------- @@ -353,28 +393,35 @@ def menuA(menuS): #Execution of the Main Menu options if r == "Y" or r == "y": clear() prt() + sysinfo() readHexTx() else: menu() elif menuS == "F" or menuS == "f": - nodeinfo() + getrawtx() + elif menuS == "H" or menuS == "h": + advanceMenu() elif menuS == "Q" or menuS == "q": exit() + elif menuS == "S" or menuS == "s": + clear() + prt() + satnodeMenu() elif menuS == "G" or menuS == "g": - advanceMenu() + nodeinfo() elif menuS == "X" or menuS == "x": dnt() - elif menuS == "T" or menuS == "t": - gitclone() - elif menuS == "N" or menuS == "n": - satnode() + elif menuS == "T" or menuS == "t": #Test feature fast access + getrawtx() -def menuB(menuR): + +def menuB(menuR): # Advanced access Menu if menuR == "A" or menuR == "a": while True: try: clear() prt() + sysinfo() close() console() t.sleep(5) @@ -407,42 +454,60 @@ def menuB(menuR): try: clear() prt() + sysinfo() close() decodeQR() t.sleep(50) except (KeyboardInterrupt, SystemExit): advanceMenu() raise - elif menuR == "S" or menuR == "s": - clear() - prt() - satnodeMenu() + while True: + try: + clear() + prt() + close() + sysinfoDetail() + t.sleep(1) + except (KeyboardInterrupt, SystemExit): + advanceMenu() + raise elif menuR == "R" or menuR == "r": menu() -def menuC(menuO): +def menuC(menuO): # Donation access Menu if menuO == "A" or menuO == "a": dntDev() elif menuO == "B" or menuO == "b": dntTst() - elif menuO == "D" or menuO == "d": + elif menuO == "R" or menuO == "r": menu() -def menuD(menuN): +def menuD(menuN): # Satnode access Menu if menuN == "A" or menuN == "a": satnode() elif menuN == "B" or menuN == "b": readFile() + elif menuN == "S" or menuN == "s": + try: + clear() + prt() + close() + apisender() + t.sleep(50) + menu() + except (KeyboardInterrupt, SystemExit): + menu() + raise elif menuN == "C" or menuN == "c": print("\n\t This only will work on Linux or Unix systems.\n") a = input("Do we continue? Y/n: ") if a == "Y" or a == "y": gitclone() else: - advanceMenu() + menu() -def menuE(menuQ): +def menuE(menuQ): # Dev Donation access Menu if menuQ == "A" or menuQ == "a": try: clear() @@ -476,10 +541,10 @@ def menuE(menuQ): except (KeyboardInterrupt, SystemExit): menu() raise - elif menuQ == "D" or menuQ == "d": + elif menuQ == "R" or menuQ == "r": menu() -def menuF(menuV): +def menuF(menuV): # Tester Donation access Menu if menuV == "A" or menuV == "a": try: clear() @@ -502,13 +567,16 @@ def menuF(menuV): except (KeyboardInterrupt, SystemExit): menu() raise - elif menuV == "D" or menuV == "d": + elif menuV == "R" or menuV == "r": menu() #--------------------------------- End Main Menu execution -------------------------------- def prt(): - tprint("PyBLOCK", font="rnd-large") # random title design + print("\033[1;32;40m") + blogo() + #tprint("PyBLOCK", font="rnd-large") # random title design + print("\033[0;37;40m") def tmp(): t.sleep(15) @@ -524,7 +592,7 @@ while True: # Loop menu() else: prt() - print("Welcome to PyBLØCK\n\n") + print("Welcome to \033[1;31;40mPyBLOCK\033[0;37;40m\n\n") path = input("Insert the Path to Bitcoin-Cli: ") # path to the bitcoin-cli pickle.dump(path, open("bclock.conf", "wb")) # Save the file 'bclock.conf' clear() diff --git a/apisnd.py b/apisnd.py new file mode 100644 index 0000000..b42d632 --- /dev/null +++ b/apisnd.py @@ -0,0 +1,97 @@ +import os +import qrcode +import time as t + +def apisender(): + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=10, + border=4, + ) + url = 'https://api.blockstream.space/order' + message = input("\nInsert your Message: ") + + curl = 'curl -F "bid=10000" -F ' + ' "message=' + message + '" ' + url + sh = os.popen(str(curl)).read() + shh = sh.split(',') + invoice = str(shh[6]) + + #---------------Token----------- + authtoken = str(shh[0]) + authtoken1 = authtoken.split(':') + token = authtoken1[1] + #---------------End Token------- + + #---------------Order----------- + uuid = str(shh[1]) + uuid1 = uuid.split(':') + order = uuid1[1] + #---------------End Order------- + + #---------------Amount---------- + msat = str(shh[3]) + msat1 = msat.split(':') + amount = msat1[1] + #---------------End Amount------ + + orderid = str(shh[1]) + ln1 = invoice.split(':') + ln2 = str(ln1[1]) + cln = ln2.strip('"') + print("\n\033[0;37;40mYour Token Authorization: \033[1;31;40m" + token + "\033[0;37;40m") + print("\033[0;37;40mYour Order Number: \033[1;31;40m" + order + "\033[0;37;40m") + print("\033[0;37;40mAmount in MSats: \033[1;33;40m" + amount + "\033[0;37;40m") + print("\033[1;30;47m") + qr.add_data(cln) + qr.print_ascii() + print("\033[0;37;40m") + print("\nLND Invoice: " + cln) + print(cln) + +def apisenderFile(): + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=10, + border=4, + ) + url = 'https://api.blockstream.space/order' + message = input("\nInsert the path to the File: ") + + curl = 'curl -F "bid=10000" -F ' + ' "file=@' + message + '" ' + url + sh = os.popen(str(curl)).read() + shh = sh.split(',') + invoice = str(shh[6]) + + #---------------Token----------- + authtoken = str(shh[0]) + authtoken1 = authtoken.split(':') + token = authtoken1[1] + #---------------End Token------- + + #---------------Order----------- + uuid = str(shh[1]) + uuid1 = uuid.split(':') + order = uuid1[1] + #---------------End Order------- + + #---------------Amount---------- + msat = str(shh[3]) + msat1 = msat.split(':') + amount = msat1[1] + #---------------End Amount------ + + orderid = str(shh[1]) + ln1 = invoice.split(':') + ln2 = str(ln1[1]) + cln = ln2.strip('"') + print("\n\033[0;37;40mYour Token Authorization: \033[1;31;40m" + token + "\033[0;37;40m") + print("\033[0;37;40mYour Order Number: \033[1;31;40m" + order + "\033[0;37;40m") + print("\033[0;37;40mAmount in MSats: \033[1;33;40m" + amount + "\033[0;37;40m") + print("\033[1;30;47m") + qr.add_data(cln) + qr.print_ascii() + print("\033[0;37;40m") + print("\nLND Invoice: " + cln) + print(cln) \ No newline at end of file diff --git a/clone.py b/clone.py index e759db5..7c06fd1 100644 --- a/clone.py +++ b/clone.py @@ -15,8 +15,11 @@ def gitclone(): os.system("gpg --full-generate-key --homedir $HOME/pyblock/examples/.gnupg") def satnode(): - os.system("python3 $HOME/pyblock/examples/demo-rx.py &") - t.sleep(5) - os.system("python3 $HOME/pyblock/examples/api_data_reader.py --demo --plaintext ") + try: + os.system("python3 $HOME/pyblock/examples/demo-rx.py &") + t.sleep(5) + os.system("python3 $HOME/pyblock/examples/api_data_reader.py --demo --plaintext ") + except (KeyboardInterrupt, SystemExit): + os.system("ps -ef | grep demo-rx.py | grep -v grep | awk '{print $2}' | xargs kill -9") diff --git a/donation.py b/donation.py index f16f905..5571a81 100644 --- a/donation.py +++ b/donation.py @@ -10,8 +10,10 @@ def donationPN(): border=4, ) url = 'PM8TJbSH9iCPZ2bz9D7MTHpaCnT35Pm4kfJ6gRccoKmMjz5qsQ6rBWpBRCnJHMpTo8kc5K2SF4MADA9f4uKwc5iC8A3FtKJc7eb5wFDF3vcuSfneaC15' + print("\033[1;30;47m") qr.add_data(url) qr.print_ascii() + print("\033[0;37;40m") print("PayNym: " + url) def donationAddr(): @@ -22,8 +24,10 @@ def donationAddr(): border=4, ) url = 'bc1qf5c88chttajazrlwudt7x9xx5u0qf8y2lguj62' + print("\033[1;30;47m") qr.add_data(url) qr.print_ascii() + print("\033[0;37;40m") print("Bitcoin Address Bech32: " + url) def donationLN(): @@ -44,8 +48,10 @@ def donationLN(): lnbc1W = lnbc1R[1] ln = str(lnbc1W) ln1 = ln.strip('"') + print("\033[1;30;47m") qr.add_data(ln1) qr.print_ascii() + print("\033[0;37;40m") print("LND Invoice: " + ln1) @@ -57,8 +63,10 @@ def donationAddrTst(): border=4, ) url = 'bc1qwtzwu2evtchkvnf3ey6520yprsyv7vrjvhula5' + print("\033[1;30;47m") qr.add_data(url) qr.print_ascii() + print("\033[0;37;40m") print("Bitcoin Address Bech32: " + url) def donationLNTst(): @@ -79,8 +87,10 @@ def donationLNTst(): lnbc1W = lnbc1R[1] ln = str(lnbc1W) ln1 = ln.strip('"') + print("\033[1;30;47m") qr.add_data(ln1) qr.print_ascii() + print("\033[0;37;40m") print("LND Invoice: " + ln1) def decodeQR(): @@ -91,7 +101,8 @@ def decodeQR(): border=4, ) url = input("Insert your Bitcoin Address to show the QRCode: ") + print("\033[1;30;47m") qr.add_data(url) qr.print_ascii() + print("\033[0;37;40m") print("Bitcoin Address: " + url) - diff --git a/feed.py b/feed.py index 982e219..fa06bbc 100644 --- a/feed.py +++ b/feed.py @@ -8,14 +8,15 @@ def readFile(): while True: downloadsFolder = 'downloads/' if not os.listdir(downloadsFolder): - print ("\nWaiting for new data...\n") + print ("\n\033[1;34;40mWaiting for new data...\n") t.sleep(50) else: - print("\t\t\nNew message from Space just arrived...\n") + print("\t\t\n\033[1;33;40mNew message from Space just arrived...\033[0;37;40m\n") os.system("cat downloads/*") os.system("rm downloads/*") except (KeyboardInterrupt, SystemExit): - exit() + os.system("ps -ef | grep api_data_reader.py | grep -v grep | awk '{print $2}' | xargs kill -9") + diff --git a/logos.py b/logos.py index a96ea26..4447ba6 100644 --- a/logos.py +++ b/logos.py @@ -1,5 +1,5 @@ def logoA(): - print("""\n\n + print("""\n\n\033[1;33;40m @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*****@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@****************************#@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@***************************************@@@@@@@@@@@@@@@@@@@@ @@ -31,11 +31,11 @@ def logoA(): @@@@@@@@@@@@@@*****************************************************@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@***********************************************@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@***************************************@@@@@@@@@@@@@@@@@@@@ - @@@@@@@@@@@@@@@@@@@@@@@@@@#***************************@@@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@#***************************@@@@@@@@@@@@@@@@@@@@@@@@@@\033[0;37;40m """) def logoB(): - print("""\n\n + print("""\n\n\033[1;33;40m @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/////@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@////////////////////////////%@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@///////////////////////////////////////@@@@@@@@@@@@@@@@@@@@ @@ -67,11 +67,11 @@ def logoB(): @@@@@@@@@@@@@@/////////////////////////////////////////////////////@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@///////////////////////////////////////////////@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@///////////////////////////////////////@@@@@@@@@@@@@@@@@@@@ - @@@@@@@@@@@@@@@@@@@@@@@@@@%///////////////////////////@@@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@%///////////////////////////@@@@@@@@@@@@@@@@@@@@@@@@@@\033[0;37;40m """) def logoC(): - print("""\n\n + print("""\n\n\033[1;33;40m @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@ @@ -103,5 +103,5 @@ def logoC(): @@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@ - @@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@@@@@@@@@@@@\033[0;37;40m """) diff --git a/pblogo.py b/pblogo.py new file mode 100644 index 0000000..87a9b10 --- /dev/null +++ b/pblogo.py @@ -0,0 +1,9 @@ +def blogo(): + print(""" +██████╗ ██╗ ██╗██████╗ ██╗ ██████╗ ██████╗██╗ ██╗ +██╔══██╗╚██╗ ██╔╝██╔══██╗██║ ██╔═══██╗██╔════╝██║ ██╔╝ +██████╔╝ ╚████╔╝ ██████╔╝██║ ██║ ██║██║ █████╔╝ +██╔═══╝ ╚██╔╝ ██╔══██╗██║ ██║ ██║██║ ██╔═██╗ +██║ ██║ ██████╔╝███████╗╚██████╔╝╚██████╗██║ ██╗ +╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ +""") \ No newline at end of file diff --git a/sysinf.py b/sysinf.py new file mode 100644 index 0000000..11dbd81 --- /dev/null +++ b/sysinf.py @@ -0,0 +1,15 @@ +import psutil + + +def sysinfoDetail(): #Cpu and memory usage + try: + # gives a single float value + print(" \033[0;37;40m----------------------------") + print(" \033[3;33;40mCPU Usage: \033[1;32;40m" + str(psutil.cpu_percent()) + "\033[0;37;40m%") + print(" \033[3;33;40mMemory Usage: \033[1;32;40m" "{}\033[0;37;40m%".format(int(psutil.virtual_memory().percent))) + print(" \033[3;33;40mMemory Available: \033[1;32;40m" "{} \033[0;37;40mMB".format(int(psutil.virtual_memory().available / 1024 / 1024))) + print(" \033[3;33;40mDisk Usage: \033[1;32;40m" "{}%\033[0;37;40m%".format(psutil.disk_usage('/').percent)) + print(" \033[0;37;40m----------------------------") + except (KeyboardInterrupt, SystemExit): + exit() + raise From 75636f55280f40ce8a31bdec8a1030356092634a Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Mon, 25 May 2020 20:34:25 -0300 Subject: [PATCH 02/12] Patch - signature Added a signature "Message sent from PyBlock" --- apisnd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apisnd.py b/apisnd.py index b42d632..02e9d26 100644 --- a/apisnd.py +++ b/apisnd.py @@ -11,8 +11,9 @@ def apisender(): ) url = 'https://api.blockstream.space/order' message = input("\nInsert your Message: ") + sentby = ". Message sent from PyBlock." - curl = 'curl -F "bid=10000" -F ' + ' "message=' + message + '" ' + url + curl = 'curl -F "bid=10000" -F ' + ' "message=' + message + sentby + '" ' + url sh = os.popen(str(curl)).read() shh = sh.split(',') invoice = str(shh[6]) @@ -94,4 +95,4 @@ def apisenderFile(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln) - print(cln) \ No newline at end of file + print(cln) From 4d1ec11a475b53082c92bd79d79da1fad8f431ea Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 14:16:20 -0300 Subject: [PATCH 03/12] Update apisndpy Fix file sending --- apisnd.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apisnd.py b/apisnd.py index 02e9d26..095af3e 100644 --- a/apisnd.py +++ b/apisnd.py @@ -1,6 +1,5 @@ import os import qrcode -import time as t def apisender(): qr = qrcode.QRCode( @@ -11,7 +10,7 @@ def apisender(): ) url = 'https://api.blockstream.space/order' message = input("\nInsert your Message: ") - sentby = ". Message sent from PyBlock." + sentby = "... Message sent from PyBlock." curl = 'curl -F "bid=10000" -F ' + ' "message=' + message + sentby + '" ' + url sh = os.popen(str(curl)).read() @@ -42,12 +41,12 @@ def apisender(): cln = ln2.strip('"') print("\n\033[0;37;40mYour Token Authorization: \033[1;31;40m" + token + "\033[0;37;40m") print("\033[0;37;40mYour Order Number: \033[1;31;40m" + order + "\033[0;37;40m") - print("\033[0;37;40mAmount in MSats: \033[1;33;40m" + amount + "\033[0;37;40m") + print("\033[0;37;40mAmount in MSats: \033[1;33;40m" + amount + "\033[0;37;40m\n") print("\033[1;30;47m") qr.add_data(cln) qr.print_ascii() print("\033[0;37;40m") - print("\nLND Invoice: " + cln) + print("\nLND Invoice: " + cln + "\n") print(cln) def apisenderFile(): @@ -60,7 +59,7 @@ def apisenderFile(): url = 'https://api.blockstream.space/order' message = input("\nInsert the path to the File: ") - curl = 'curl -F "bid=10000" -F ' + ' "file=@' + message + '" ' + url + curl = 'curl -F "bid=50000" -F ' + ' "file=@' + message + '" ' + url sh = os.popen(str(curl)).read() shh = sh.split(',') invoice = str(shh[6]) @@ -95,4 +94,6 @@ def apisenderFile(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln) - print(cln) + print(cln) + + From bc3fd29e2c555fbd86ec164a62ccdac5d2fc02e1 Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 14:20:20 -0300 Subject: [PATCH 04/12] Satnode file or plain text sending Fix and added sending File with satnode --- PyBlock.py | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/PyBlock.py b/PyBlock.py index 5a811a8..bda14ed 100644 --- a/PyBlock.py +++ b/PyBlock.py @@ -45,7 +45,7 @@ def console(): # get into the console from bitcoin-cli cle = input("\033[1;32;40mconsole $>: \033[0;37;40m") lsd = os.popen(str(path + " " + cle)).read() print(lsd) - + #-------------------From this line the program starts---------------------- def connected(info): # here we complete the connection to the external node @@ -237,7 +237,7 @@ def menu(): #Main Menu \033[1;31;40mPyBLOCK\033[0;37;40m Menu Version 0.2.0 - \033[1;32;40mA.\033[0;37;40m Run PyBLOCK in your own node + \033[1;31;40mA.\033[0;37;40m Run PyBLOCK in your own node \033[1;32;40mB.\033[0;37;40m Show Blockchain information in your own node \033[1;32;40mC.\033[0;37;40m Show the Genesis Block \033[1;32;40mD.\033[0;37;40m Decode in HEX any block @@ -412,8 +412,7 @@ def menuA(menuS): #Execution of the Main Menu options elif menuS == "X" or menuS == "x": dnt() elif menuS == "T" or menuS == "t": #Test feature fast access - getrawtx() - + print("This is a test access. \n") def menuB(menuR): # Advanced access Menu if menuR == "A" or menuR == "a": @@ -490,15 +489,33 @@ def menuD(menuN): # Satnode access Menu readFile() elif menuN == "S" or menuN == "s": try: - clear() - prt() close() - apisender() - t.sleep(50) - menu() + message = input("\n\033[0;37;40mYour message it's a \033[1;34;40mF\033[0;37;40mile or a plain \033[1;32;40mT\033[0;37;40mext? \033[1;34;40mF\033[0;37;40m/\033[1;32;40mT\033[0;37;40m: ") + if message == "F" or message == "f": + try: + clear() + prt() + close() + apisenderFile() + t.sleep(50) + menu() + except (KeyboardInterrupt, SystemExit): + menu() + raise + elif message == "T" or message == "t": + try: + clear() + prt() + close() + apisender() + t.sleep(50) + menu() + except (KeyboardInterrupt, SystemExit): + menu() + raise except (KeyboardInterrupt, SystemExit): menu() - raise + raise elif menuN == "C" or menuN == "c": print("\n\t This only will work on Linux or Unix systems.\n") a = input("Do we continue? Y/n: ") @@ -597,3 +614,4 @@ while True: # Loop pickle.dump(path, open("bclock.conf", "wb")) # Save the file 'bclock.conf' clear() menu() + From b4557e75cee59933ddc4b99db9fad76644d01438 Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 16:03:55 -0300 Subject: [PATCH 05/12] Fixes and Donation QRCode Added input to insert amount when paying a broadcast Added Donation Def to get support --- apisnd.py | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/apisnd.py b/apisnd.py index 095af3e..683789c 100644 --- a/apisnd.py +++ b/apisnd.py @@ -1,5 +1,7 @@ import os import qrcode +import requests +import time as t def apisender(): qr = qrcode.QRCode( @@ -11,8 +13,10 @@ def apisender(): url = 'https://api.blockstream.space/order' message = input("\nInsert your Message: ") sentby = "... Message sent from PyBlock." + print("ATENTION: Minimum amount for sending a text is 5000 MSats") + amountmsat = input("\nInsert the amount in MSats: ") + curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "message=' + message + sentby + '" ' + url - curl = 'curl -F "bid=10000" -F ' + ' "message=' + message + sentby + '" ' + url sh = os.popen(str(curl)).read() shh = sh.split(',') invoice = str(shh[6]) @@ -47,7 +51,9 @@ def apisender(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln + "\n") - print(cln) + t.sleep(50) + devAddr() + def apisenderFile(): qr = qrcode.QRCode( @@ -58,8 +64,9 @@ def apisenderFile(): ) url = 'https://api.blockstream.space/order' message = input("\nInsert the path to the File: ") - - curl = 'curl -F "bid=50000" -F ' + ' "file=@' + message + '" ' + url + print("ATENTION: Minimum amount for sending a File is 50000 MSats") + amountmsat = input("\nInsert the amount in MSats: ") + curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "file=@' + message + '" ' + url sh = os.popen(str(curl)).read() shh = sh.split(',') invoice = str(shh[6]) @@ -94,6 +101,32 @@ def apisenderFile(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln) - print(cln) + t.sleep(50) + devAddr() +def devAddr(): + qr = qrcode.QRCode( + version=1, + error_correction=qrcode.constants.ERROR_CORRECT_L, + box_size=10, + border=4, + ) + print("\n\t\t\033[1;33;44mGive us some love and \033[1;31;44mDONATE\033[1;33;44m us! We will appreciate it. This will be a boost to continue this beautiful project! \033[0;37;40m") + url = 'https://api.tippin.me/v1/public/addinvoice/royalfield370' + response = requests.get(url) + responseB = str(response.text) + responseC = responseB + lnreq = responseC.split(',') + lnbc1 = lnreq[1] + lnbc1S = str(lnbc1) + lnbc1R = lnbc1S.split(':') + lnbc1W = lnbc1R[1] + ln = str(lnbc1W) + ln1 = ln.strip('"') + print("\033[1;30;47m") + qr.add_data(ln1) + qr.print_ascii() + print("\033[0;37;40m") + print("LND Invoice: " + ln1) + From 450a3fa8cc15b2254b30c70c3f6384a1261f2a29 Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 19:08:32 -0300 Subject: [PATCH 06/12] Message Signature change --- apisnd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apisnd.py b/apisnd.py index 683789c..4d2268e 100644 --- a/apisnd.py +++ b/apisnd.py @@ -12,7 +12,7 @@ def apisender(): ) url = 'https://api.blockstream.space/order' message = input("\nInsert your Message: ") - sentby = "... Message sent from PyBlock." + sentby = "...PyBLOCK." print("ATENTION: Minimum amount for sending a text is 5000 MSats") amountmsat = input("\nInsert the amount in MSats: ") curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "message=' + message + sentby + '" ' + url From dc6c632c62beaed949890284b0f1b98fdfd49adf Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 20:24:23 -0300 Subject: [PATCH 07/12] Update apisnd.py --- apisnd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apisnd.py b/apisnd.py index 4d2268e..f27615d 100644 --- a/apisnd.py +++ b/apisnd.py @@ -12,7 +12,7 @@ def apisender(): ) url = 'https://api.blockstream.space/order' message = input("\nInsert your Message: ") - sentby = "...PyBLOCK." + sentby = "- PyBLOCK." print("ATENTION: Minimum amount for sending a text is 5000 MSats") amountmsat = input("\nInsert the amount in MSats: ") curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "message=' + message + sentby + '" ' + url From 245871f55f96ee399fdbfec474b15288301bf03b Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 20:47:29 -0300 Subject: [PATCH 08/12] Update apisnd.py --- apisnd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apisnd.py b/apisnd.py index f27615d..e1485c1 100644 --- a/apisnd.py +++ b/apisnd.py @@ -51,7 +51,7 @@ def apisender(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln + "\n") - t.sleep(50) + t.sleep(30) devAddr() @@ -101,7 +101,7 @@ def apisenderFile(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln) - t.sleep(50) + t.sleep(30) devAddr() def devAddr(): From 2c64e76c26882f50adbed527d81053adb0d05489 Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Tue, 26 May 2020 20:48:23 -0300 Subject: [PATCH 09/12] Update PyBlock.py --- PyBlock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyBlock.py b/PyBlock.py index bda14ed..ca06984 100644 --- a/PyBlock.py +++ b/PyBlock.py @@ -497,7 +497,7 @@ def menuD(menuN): # Satnode access Menu prt() close() apisenderFile() - t.sleep(50) + t.sleep(30) menu() except (KeyboardInterrupt, SystemExit): menu() @@ -508,7 +508,7 @@ def menuD(menuN): # Satnode access Menu prt() close() apisender() - t.sleep(50) + t.sleep(30) menu() except (KeyboardInterrupt, SystemExit): menu() From a9d3b5f05e64c3f5b0b2ced6f416a851df521039 Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Wed, 27 May 2020 08:59:36 -0300 Subject: [PATCH 10/12] Bug fixes when exit the program This bug was generated after, opening several functions in different files, and was solved using the ".close()" append in every file name. Starting on line 420. --- PyBlock.py | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/PyBlock.py b/PyBlock.py index ca06984..63c7118 100644 --- a/PyBlock.py +++ b/PyBlock.py @@ -43,8 +43,11 @@ def console(): # get into the console from bitcoin-cli print("\t\033[0;37;40mThis is \033[1;33;40mBitcoin-cli's \033[0;37;40mconsole. Type your respective commands you want to display.\n\n") while True: cle = input("\033[1;32;40mconsole $>: \033[0;37;40m") - lsd = os.popen(str(path + " " + cle)).read() - print(lsd) + lsd = os.popen(path + " " + cle) + lsd0 = lsd.read() + lsd1 = str(lsd0) + print(lsd1) + lsd.close() #-------------------From this line the program starts---------------------- @@ -112,12 +115,15 @@ def userconn(): # All the connection to a remote node clear() close() sshb = "ssh " + user + " '" + "{}".format(path) + "'" + " getblockcount" - sshc = os.popen(str(sshb)).read() - sshd = sshc + sshc = os.popen(sshb) + lsd0 = sshc.read() + lsd1 = str(lsd0) + sshd = lsd1 print("\033[1;32;40m") tprint(sshd, font="rnd-large") print("\033[0;37;40m") tmp() + sshc.close() except (KeyboardInterrupt, SystemExit): menuUserConn() raise @@ -217,12 +223,15 @@ def getrawtx(): # show confirmatins from transactions prt() close() bitcoincli = " getrawtransaction " - lsd = os.popen(str(path + bitcoincli + tx + " 1")).read() - lsda = lsd.split(',') + lsd = os.popen(path + bitcoincli + tx + " 1") + lsd0 = lsd.read() + lsd1 = str(lsd0) + lsda = lsd1.split(',') lsdb = lsda[-3] lsdc = str(lsdb) - print("\033[0;37;40mTransaction " + "\033[1;31;40m{}\033[0;37;40m".format(tx) + " has:\n" + "\033[1;31;40m{}\033[0;37;40m".format(lsdc)) + print("\033[0;37;40mTransaction " + "\033[1;31;40m{}\033[0;37;40m".format(tx) + " has:\n" + "\033[1;31;40m{}\033[0;37;40m".format(lsdc)) tmp() + lsd.close() except (KeyboardInterrupt, SystemExit): menu() #--------------------------------- End Hex Block Decoder Functions ------------------------------------- @@ -369,6 +378,12 @@ def menuA(menuS): #Execution of the Main Menu options else: b = input("Do you want to exit? Y/n: ") if b == "Y" or b == "y": + os._exit(0) + apisnd.close() + donation.close() + clone.close() + logos.close() + feed.close() exit() else: menu() @@ -402,6 +417,12 @@ def menuA(menuS): #Execution of the Main Menu options elif menuS == "H" or menuS == "h": advanceMenu() elif menuS == "Q" or menuS == "q": + os._exit(0) + apisnd.close() + donation.close() + clone.close() + logos.close() + feed.close() exit() elif menuS == "S" or menuS == "s": clear() From 21762e8afb7948c28da3a809998610a4a67f1a4b Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Wed, 27 May 2020 10:49:24 -0300 Subject: [PATCH 11/12] Added Question Continue This change the timer and leave the user to decide when do the payment. --- apisnd.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/apisnd.py b/apisnd.py index e1485c1..5f80bf6 100644 --- a/apisnd.py +++ b/apisnd.py @@ -1,7 +1,6 @@ import os import qrcode import requests -import time as t def apisender(): qr = qrcode.QRCode( @@ -17,8 +16,10 @@ def apisender(): amountmsat = input("\nInsert the amount in MSats: ") curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "message=' + message + sentby + '" ' + url - sh = os.popen(str(curl)).read() - shh = sh.split(',') + sh = os.popen(curl) + sh0 = sh.read() + sh1 = str(sh0) + shh = sh1.split(',') invoice = str(shh[6]) #---------------Token----------- @@ -51,9 +52,10 @@ def apisender(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln + "\n") - t.sleep(30) - devAddr() - + sh.close() + continue1 = input("Continue? Y: ") + if continue1 == "Y" or continue1 == "y": + devAddr() def apisenderFile(): qr = qrcode.QRCode( @@ -67,8 +69,11 @@ def apisenderFile(): print("ATENTION: Minimum amount for sending a File is 50000 MSats") amountmsat = input("\nInsert the amount in MSats: ") curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "file=@' + message + '" ' + url - sh = os.popen(str(curl)).read() - shh = sh.split(',') + + sh = os.popen(curl) + sh0 = sh.read() + sh1 = str(sh0) + shh = sh1.split(',') invoice = str(shh[6]) #---------------Token----------- @@ -101,9 +106,11 @@ def apisenderFile(): qr.print_ascii() print("\033[0;37;40m") print("\nLND Invoice: " + cln) - t.sleep(30) - devAddr() - + sh.close() + continue1 = input("Continue? Y: ") + if continue1 == "Y" or continue1 == "y": + devAddr() + def devAddr(): qr = qrcode.QRCode( version=1, @@ -128,5 +135,4 @@ def devAddr(): qr.print_ascii() print("\033[0;37;40m") print("LND Invoice: " + ln1) - - + response.close() From 7ad922ec040d47308839c2045ff17c904a7fa831 Mon Sep 17 00:00:00 2001 From: curly60e <55191248+curly60e@users.noreply.github.com> Date: Wed, 27 May 2020 11:01:03 -0300 Subject: [PATCH 12/12] Added sysinf.close() when exit. --- PyBlock.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PyBlock.py b/PyBlock.py index 63c7118..cfcc5bb 100644 --- a/PyBlock.py +++ b/PyBlock.py @@ -384,6 +384,7 @@ def menuA(menuS): #Execution of the Main Menu options clone.close() logos.close() feed.close() + sysinf.close() exit() else: menu() @@ -423,6 +424,7 @@ def menuA(menuS): #Execution of the Main Menu options clone.close() logos.close() feed.close() + sysinf.close() exit() elif menuS == "S" or menuS == "s": clear()