CTBot
CTBot copied to clipboard
fingerprint for telegram
Hello. These last years, every 11 months, the fingerprint has been suddenly changed leaving our ESPs disconnected. I am trying to implement a fingerprint server, but for that I need the ESP that acts as a server to read correctly the https://www.grc.com/fingerprints.htm?domain=api.telegram.org page for my ESPs to download it from the server, implemented in an ESP01s. My idea is to read every 24H the Telegram finger on grc.com for when the ESPs need to update the finger. But there is no way to read correctly the page from grc. https.GET() results in HTTP_CODE_OK, but reading the web gives an empty String.
Any idea? `/** BasicHTTPSClient.ino
Created on: 20.08.2018
*/ // search telegram finger
//https://www.grc.com/fingerprints.htm?domain=api.telegram.org // data: 27/03/23 to .... 27/02/24???? //const char* finger="8A:10:B5:B9:B1:57:AB:DA:19:74:5B:AB:62:1F:38:03:72:FE:8E:47"; //telegram
//#include <Arduino.h>
#include <ESP8266WiFi.h> #include <ESP8266WiFiMulti.h> #include <ESP8266HTTPClient.h> #include <WiFiClientSecureBearSSL.h>
//data https://www.grc.com const char* GRC_host = "https://www.grc.com/fingerprints.htm?domain=api.telegram.org"; const char fingerprint_GRC_com [] PROGMEM = "A6:8F:8C:47:6B:D0:DE:9E:1D:18:4A:0A:51:4D:90:11:31:93:40:6D";
#ifndef STASSID #define STASSID "your ssid" #define STAPSK "your pass" #endif
ESP8266WiFiMulti WiFiMulti;
void setup() {
Serial.begin(115200); // Serial.setDebugOutput(true);
Serial.println(); Serial.println(); Serial.println();
WiFi.mode(WIFI_STA); WiFiMulti.addAP(STASSID, STAPSK); Serial.println("setup() done connecting to ssid '" STASSID "'"); }
void loop() { // wait for WiFi connection if ((WiFiMulti.run() == WL_CONNECTED)) {
std::unique_ptr<BearSSL::WiFiClientSecure> client(new BearSSL::WiFiClientSecure);
//client->setFingerprint(fingerprint_GRC_com);
// Or, if you happy to ignore the SSL certificate, then use the following line instead:
client->setInsecure();
HTTPClient https;
Serial.print("[HTTPS] begin...\n");
if (https.begin(*client, GRC_host)) { // HTTPS
Serial.print("[HTTPS] GET...\n");
// start connection and send HTTP header
int httpCode = https.GET();
// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTPS] GET... code: %d\n", httpCode);
// file found at server
if (httpCode == HTTP_CODE_OK) {
String payload = https.getString();
Serial.println("Init Ok");
Serial.println(payload); //<----- void string
Serial.println("End");
}
} else {
Serial.printf("[HTTPS] GET... failed, error %d: %s\n",httpCode, https.errorToString(httpCode).c_str());
}
https.end();
} else {
Serial.printf("[HTTPS] Unable to connect\n");
}
}
Serial.println("Wait 20s before next round..."); delay(20000); } ` Thank you