that_one_nigga_you_k

codigo do esp que manda a foto (uma versão com geração de ID)

May 21st, 2025 (edited)
56
0
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.99 KB | None | 0 0
  1. #include <WiFi.h>
  2. #include <HTTPClient.h>
  3. #include <cstdlib>  // For rand() and srand()
  4. #include <ctime>  
  5. #include <time.h>
  6.  
  7. // WiFi Configuration
  8. //#define WIFI_NETWORK "A15 de Narciso"
  9. //#define WIFI_PASSWORD "oigalado"
  10.  
  11. #define WIFI_NETWORK  "Batcaverna2.4"
  12. #define WIFI_PASSWORD  "Linda@102030"
  13.  
  14. #define WIFI_TIMEOUT_MS 15000
  15.  
  16. // LED Pins
  17. #define STATUS_LED 32  // WiFi status indicator
  18. #define CONTROL_LED 4 // The LED we're controlling
  19. #define TAMANHO_CODIGO 13
  20.  
  21. RTC_DATA_ATTR int digitos[TAMANHO_CODIGO];
  22. RTC_DATA_ATTR bool id_gerada = false;
  23.  
  24. // Server Configuration
  25. const char* SERVER_URL = "https://content-normally-caiman.ngrok-free.app";// Use ngrok URL if needed
  26. const unsigned long POLL_INTERVAL = 2000; // Check every 2 seconds
  27.  
  28. RTC_DATA_ATTR bool currentLedState = false;
  29. RTC_DATA_ATTR bool lastLedState = false;
  30. unsigned long lastPollTime = 0;
  31.  
  32. String id_str = "";  // ID convertido para string (variável global)
  33.  
  34.  
  35.  
  36.  
  37. void geradorcripto(int tamanho, int* digitos) {
  38.     for (int i = 0; i < tamanho; i++) {
  39.         digitos[i] = rand() % 10;
  40.     }
  41.  
  42.     // Primeiro dígito verificador
  43.     int soma1 = 0;
  44.     for (int i = 0; i < tamanho - 1; i++) {
  45.         soma1 += digitos[i] * (tamanho - 1 - i);
  46.     }
  47.     int digito1 = (soma1 * 10) % 11;
  48.     if (digito1 == 10) digito1 = 0;
  49.     digitos[tamanho] = digito1;
  50.  
  51.     // Segundo dígito verificador
  52.     int soma2 = 0;
  53.     for (int i = 0; i < tamanho; i++) {
  54.         soma2 += digitos[i] * (tamanho - i);
  55.     }
  56.     int digito2 = (soma2 * 10) % 11;
  57.     if (digito2 == 10) digito2 = 0;
  58.     digitos[tamanho + 1] = digito2;
  59. }
  60.  
  61.  
  62. void connectToWiFi() {
  63.   Serial.println("Conectando ao WiFi...");
  64.   WiFi.begin(WIFI_NETWORK, WIFI_PASSWORD);
  65.  
  66.   unsigned long startTime = millis();
  67.  
  68.   while (WiFi.status() != WL_CONNECTED && millis() - startTime < WIFI_TIMEOUT_MS) {
  69.     delay(500);
  70.     Serial.println(".");
  71.   }
  72.  
  73.   WiFi.begin(WIFI_NETWORK, WIFI_PASSWORD);
  74.  
  75.   delay(5000);
  76.  
  77.  
  78.   if (WiFi.status() == WL_CONNECTED) {
  79.     Serial.println("\nConectado com sucesso! IP: " + WiFi.localIP().toString());
  80.     digitalWrite(STATUS_LED, HIGH);
  81.   } else {
  82.     Serial.println("\nFalha na conexão WiFi");
  83.     WiFi.disconnect(); // Garante que não vai ficar em estado bugado
  84.     digitalWrite(STATUS_LED, LOW);
  85.   }
  86. }
  87.  
  88. void checkWiFiConnection() {
  89.   if (WiFi.status() != WL_CONNECTED) {
  90.     Serial.println("WiFi disconnected!");
  91.     digitalWrite(STATUS_LED, LOW);
  92.     WiFi.disconnect();
  93.     delay(100);
  94.     connectToWiFi();
  95.   }
  96. }
  97.  
  98. void registerESP() {
  99.   if (WiFi.status() == WL_CONNECTED) {
  100.     HTTPClient http;
  101.     http.begin(String(SERVER_URL) + "/poll");
  102.     http.addHeader("Content-Type", "application/x-www-form-urlencoded");
  103.  
  104.     String body = "id=" + id_str;
  105.     int httpCode = http.POST(body);
  106.  
  107.     // Lê o conteúdo da resposta
  108.     String response = http.getString();
  109.  
  110.     // Log detalhado
  111.     Serial.println("[DEBUG] Requisição POST para /poll");
  112.     Serial.println("[DEBUG] ID enviado: " + id_str);
  113.     Serial.println("[DEBUG] HTTP Code: " + String(httpCode));
  114.     Serial.println("[DEBUG] Resposta do servidor: " + response);
  115.  
  116.     if (httpCode == HTTP_CODE_OK) {
  117.       Serial.println("ESP registrado com sucesso no servidor.");
  118.     } else {
  119.       Serial.println("Erro ao registrar ESP. Código: " + String(httpCode));
  120.     }
  121.  
  122.     http.end();
  123.   }
  124. }
  125.  
  126. // Função para pegar a seed pela internet e setar no srand
  127. void configurarSeedAleatoria() {
  128.   configTime(0, 0, "pool.ntp.org");
  129.  
  130.   struct tm timeinfo;
  131.   while (!getLocalTime(&timeinfo)) {
  132.     Serial.println("Aguardando sincronização NTP...");
  133.     delay(1000);
  134.   }
  135.  
  136.   time_t agora = time(NULL);
  137.   Serial.print("Timestamp atual para seed: ");
  138.   Serial.println(agora);
  139.  
  140.   srand(agora);
  141. }
  142.  
  143.  
  144. void pollServerForState() {
  145.   if (WiFi.status() == WL_CONNECTED) {
  146.     HTTPClient http;
  147.     String fullUrl = String(SERVER_URL) + "/status?id=" + id_str;
  148.     http.begin(fullUrl);
  149.    
  150.     int httpCode = http.GET();
  151.     if (httpCode == HTTP_CODE_OK) {
  152.       String response = http.getString();
  153.       response.trim();
  154.      
  155.       // Convert response to boolean
  156.       bool newState = (response == "True");
  157.      
  158.       if (newState != currentLedState) {
  159.         currentLedState = newState;
  160.         digitalWrite(CONTROL_LED, currentLedState);
  161.         Serial.println("LED state changed to: " + String(currentLedState));
  162.       }
  163.     }
  164.    
  165.     // if (httpCode > 0) {
  166.     // Serial.printf("[HTTP] Code: %d\n", httpCode);
  167.     // }
  168.    
  169.     else {
  170.     Serial.printf("[HTTP] Falha na conexão, erro: %s\n", http.errorToString(httpCode).c_str());
  171.     }
  172.  
  173.  
  174.     http.end();
  175.   }
  176. }
  177.  
  178.  
  179. void setup() {
  180.   Serial.begin(115200);
  181.   pinMode(STATUS_LED, OUTPUT);
  182.   pinMode(CONTROL_LED, OUTPUT);
  183.   digitalWrite(STATUS_LED, LOW);
  184.   digitalWrite(CONTROL_LED, currentLedState);
  185.  
  186.   connectToWiFi();  // Vai tentar uma vez por 20s
  187.  
  188.  
  189.   configurarSeedAleatoria();  // Seed for random numbers
  190.  
  191.   if (!id_gerada) {
  192.         Serial.println("Nenhuma ID salva, gerando nova...");
  193.         geradorcripto(11, digitos);
  194.         id_gerada = true;
  195.  
  196.         Serial.println("ID gerada e salva:");
  197.         for (int i = 0; i < TAMANHO_CODIGO; i++) {
  198.             Serial.print(digitos[i]);
  199.         }
  200.         Serial.println();
  201.     }
  202.    
  203.   else {
  204.         Serial.println("ID já salva na RTC:");
  205.         for (int i = 0; i < TAMANHO_CODIGO; i++) {
  206.             Serial.print(digitos[i]);
  207.         }
  208.         Serial.println();
  209.   }
  210.  
  211.  
  212.  
  213.   // Converte os dígitos para uma string
  214.   for (int i = 0; i < TAMANHO_CODIGO; i++) {
  215.       id_str += String(digitos[i]);
  216.   }
  217.  
  218.   Serial.println("Meu ID: " + id_str);  // Só pra debug
  219.  
  220.   registerESP();
  221.   //Serial.println("tentei o registro!");
  222.   pollServerForState();
  223.  
  224.   // Habilita wake-up por tempo (30 segundos)
  225.   uint64_t tempo_sleep_us = 30 * 1000000;
  226.   esp_sleep_enable_timer_wakeup(tempo_sleep_us);
  227.  
  228.   Serial.println("Entrando em deep sleep por 30 segundos...");
  229.   delay(5000);
  230.   esp_deep_sleep_start();
  231.  
  232. }
  233.  
  234. void loop(){
  235. }
  236.  
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Oncaluq
    38 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
  • Qadnegpa
    9 days
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=qmgckeokat
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment