diff --git a/app/timenet_manager.py b/app/timenet_manager.py index ac5e079..dacabe1 100644 --- a/app/timenet_manager.py +++ b/app/timenet_manager.py @@ -10,6 +10,9 @@ args = arg_parser.ArgParser().parse() config = config_parser.ConfigParser().loadConfig() +tnv_string = "Tn-V" +tnd_string = "Tn-D" + class timenetManager: telegram = None message_acumulator = "" @@ -24,8 +27,13 @@ class timenetManager: self.headers = { "Content-type": "application/x-www-form-urlencoded; charset=UTF-8", - "Tn-V": "wcp_8.0.0.2", - "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" + "Accept": "application/json, text/plain, */*", + "Referer": "https://timenet-wcp.gpisoftware.com/", + "Sec-Ch-Ua-Mobile": "?0", + "Sec-Ch-Ua-Platform": "\"Linux\"", + "Sec-Ch-Ua": "\"Chromium\";v=\"138\", \"Not=A?Brand\";v=\"8\", \"Google Chrome\";v=\"138\"", + tnv_string: "wcp_8.0.0.2", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36" } self.login() @@ -55,6 +63,7 @@ class timenetManager: if response.status_code != 200: print("Error al iniciar sesión: %s" % response.text) + exit(20) self.headers["Token"] = response.text @@ -67,10 +76,10 @@ class timenetManager: self.message_acumulator = "" def updateTime(self): - self.headers["Tn-D"] = "\"" + datetime.now().astimezone(pytz.UTC).strftime("%Y-%m-%dT%H:%M:%SZ") + "\"" + self.headers[tnd_string] = "\"" + datetime.now().astimezone(pytz.UTC).strftime("%Y-%m-%dT%H:%M:%SZ") + "\"" def updateVersion(self): - self.headers["Tn-V"] = self.getVersion() + self.headers[tnv_string] = self.getVersion() def getVersion(self): self.updateTime() @@ -120,17 +129,17 @@ class timenetManager: rand = utils.numero_aleatorio_con_probabilidad(230, 0.5) self.addMessage("Esperando %s segundos para %s en un minuto aleatorio" % (rand,conditional_response[int(typ)]["text2"])) self.sendReport() - sleep(rand) + #sleep(rand) self.updateTime() data = { "typ": typ, - "date": self.headers['tn-d'], + "date": self.headers[tnd_string], "geoLatitude": config['geo']['latitude'], "geoLongitude": config['geo']['longitude'], "geoError": "", "geoAccuracy": config['geo']['accuracy'] } - response = self.post("cp/checks", data, self.headers) + #response = self.post("cp/checks", data, self.headers) else: self.addMessage('Corriendo en modo debug. No se realizará ninguna acción') self.sendReport() diff --git a/main.py b/main.py index a93d2b9..308e910 100755 --- a/main.py +++ b/main.py @@ -17,7 +17,6 @@ from app import timenet_manager if __name__ == '__main__': af = timenet_manager.timenetManager() - #print(af.getVersion().text) af.sendUpdate()