that_one_nigga_you_k

servidor que atualiza pra várias placas (sem fotos, com ID)

May 21st, 2025
69
0
Never
10
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.36 KB | None | 0 0
  1.  python
  2. from http.server import BaseHTTPRequestHandler, HTTPServer
  3. import urllib.parse
  4. import json
  5. import threading
  6.  
  7. # Configuração do servidor
  8. HOST = "localhost"  # Endereço IP do servidor
  9. PORT = 8000
  10.  
  11. # Estado global dos ESPs e lista de banidos
  12. esp_devices = {}  # {id: state}
  13. banned_ids = set()
  14.  
  15. # Função para validar o ID
  16. def decifrar(id):
  17.     if not id.isdigit():
  18.         return False
  19.     id = [int(x) for x in id]
  20.     tamanho = len(id) - 2
  21.     digitos = id[:tamanho]
  22.  
  23.     soma1 = sum(digitos[i] * (tamanho - 1 - i) for i in range(tamanho - 1))
  24.     digito1 = (soma1 * 10) % 11
  25.     if digito1 == 10:
  26.         digito1 = 0
  27.  
  28.     soma2 = sum(digitos[i] * (tamanho - i) for i in range(tamanho))
  29.     digito2 = (soma2 * 10) % 11
  30.     if digito2 == 10:
  31.         digito2 = 0
  32.  
  33.     return digito1 == id[tamanho] and digito2 == id[tamanho + 1]
  34.  
  35. # Página HTML principal
  36. with open("index.html", "r") as f:
  37.     HTML_PAGE = f.read()
  38.  
  39. class ControlHandler(BaseHTTPRequestHandler):
  40.     def do_GET(self):
  41.        
  42.         print(f"[DEBUG] Requisição POST recebida: {self.path}")
  43.  
  44.         parsed = urllib.parse.urlparse(self.path)
  45.         if parsed.path == "/":
  46.             self.send_response(200)
  47.             self.send_header('Content-type', 'text/html')
  48.             self.end_headers()
  49.             self.wfile.write(HTML_PAGE.encode())
  50.  
  51.         elif parsed.path == "/status":
  52.            
  53.             query = urllib.parse.parse_qs(parsed.query)
  54.             esp_id = query.get("id", [None])[0]
  55.             print(f"[STATUS] Consulta para ID: {esp_id}")
  56.             print(f"[STATUS] IDs registrados: {list(esp_devices.keys())}")
  57.  
  58.             query = urllib.parse.parse_qs(parsed.query)
  59.             esp_id = query.get("id", [None])[0]
  60.             if esp_id in esp_devices:
  61.                 state = esp_devices[esp_id]
  62.                 self.send_response(200)
  63.                 self.send_header('Content-type', 'text/plain')
  64.                 self.end_headers()
  65.                 self.wfile.write(str(state).encode())
  66.             else:
  67.                 self.send_error(404, "ESP ID não encontrado")
  68.  
  69.         elif parsed.path == "/esp_list":
  70.             self.send_response(200)
  71.             self.send_header('Content-type', 'application/json')
  72.             self.end_headers()
  73.             data = [{"id": k, "state": v} for k, v in esp_devices.items()]
  74.             self.wfile.write(json.dumps(data).encode())
  75.  
  76.         else:
  77.             self.send_error(404)
  78.  
  79.     def do_POST(self):
  80.         parsed = urllib.parse.urlparse(self.path)
  81.         length = int(self.headers.get('Content-Length', 0))
  82.         post_data = urllib.parse.parse_qs(self.rfile.read(length).decode())
  83.         print(f"[DEBUG] Requisição POST recebida: {self.path}")
  84.        
  85.  
  86.  
  87.         if parsed.path == "/poll":
  88.             esp_id = post_data.get("id", [""])[0]
  89.             print(f"[POLL] Requisição recebida com ID: {esp_id}")
  90.  
  91.             if esp_id in banned_ids:
  92.                 print(f"[POLL] ID {esp_id} já está banido.")
  93.             elif not decifrar(esp_id):
  94.                 print(f"[POLL] ID {esp_id} é inválido (não passou na validação).")
  95.  
  96.             if esp_id in banned_ids or not decifrar(esp_id):
  97.                 banned_ids.add(esp_id)
  98.                 print(f"[POLL] ESP ID {esp_id} inválido ou banido. Enviando 403.")
  99.                 self.send_response(403)
  100.                 self.send_header("Content-Type", "text/plain")
  101.                 self.send_header("Content-Length", "0")
  102.                 self.end_headers()
  103.                 return
  104.  
  105.             if esp_id not in esp_devices:
  106.                 print(f"[POLL] Novo ESP registrado com ID: {esp_id}")
  107.                 esp_devices[esp_id] = False
  108.             else:
  109.                 print(f"[POLL] ESP {esp_id} já registrado.")
  110.                 response = "ON" if esp_devices[esp_id] else "OFF"
  111.                 self.send_response(200)
  112.                 self.send_header("Content-type", "text/plain")
  113.                 self.end_headers()
  114.                 self.wfile.write(response.encode())
  115.  
  116.             print(f"[POLL] Estado atual dos dispositivos: {esp_devices}")
  117.  
  118.  
  119.             # Envia resposta válida
  120.             resposta = "OK"
  121.             resposta_bytes = resposta.encode()
  122.  
  123.             self.send_response(200)
  124.             self.send_header("Content-Type", "text/plain")
  125.             self.send_header("Content-Length", str(len(resposta_bytes)))
  126.             self.end_headers()
  127.             self.wfile.write(resposta_bytes)
  128.  
  129.         elif parsed.path == "/control":
  130.             esp_id = post_data.get("id", [""])[0]
  131.             if esp_id in esp_devices:
  132.                 esp_devices[esp_id] = not esp_devices[esp_id]
  133.                 print(f"[CONTROL] Estado do ESP {esp_id} agora é {'ON' if esp_devices[esp_id] else 'OFF'}")
  134.                 self.send_response(200)
  135.                 self.end_headers()
  136.             else:
  137.                 print(f"[CONTROL] ID {esp_id} não encontrado.")
  138.                 self.send_error(404, "ESP ID não encontrado")
  139.  
  140.         else:
  141.             self.send_error(404, "Endpoint não encontrado")
  142.  
  143.  
  144.  
  145. def run_server():
  146.     server = HTTPServer((HOST, PORT), ControlHandler)
  147.     print(f"Servidor rodando em http://{HOST}:{PORT}")
  148.     try:
  149.         server.serve_forever()
  150.     except KeyboardInterrupt:
  151.         pass
  152.     server.server_close()
  153.     print("Servidor parado.")
  154.  
  155. if __name__ == "__main__":
  156.     run_server()
  157.  
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Lynyikje
    33 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
  • Quowimba
    17 days
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=svaghwilvw
    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