that_one_nigga_you_k

codigo do servidor (várias placas, com ID)

Jun 26th, 2025
61
0
Never
9
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.59 KB | None | 0 0
  1. import http.server
  2. import socketserver
  3. import os
  4. import json
  5. from urllib.parse import parse_qs
  6.  
  7. # --- LÓGICA DE VALIDAÇÃO DE ID ---
  8. def decifrar(id_str):
  9.     """Valida um ID de 13 dígitos com base nos dígitos verificadores."""
  10.     if not id_str.isdigit() or len(id_str) != 13:
  11.         return False
  12.    
  13.     id_digits = [int(x) for x in id_str]
  14.     tamanho = 11
  15.     digitos_base = id_digits[:tamanho]
  16.  
  17.     soma1 = sum(digitos_base[i] * (tamanho - 1 - i) for i in range(tamanho - 1))
  18.     digito1 = (soma1 * 10) % 11
  19.     if digito1 == 10: digito1 = 0
  20.  
  21.     soma2 = sum(digitos_base[i] * (tamanho - i) for i in range(tamanho))
  22.     digito2 = (soma2 * 10) % 11
  23.     if digito2 == 10: digito2 = 0
  24.  
  25.     return digito1 == id_digits[tamanho] and digito2 == id_digits[tamanho + 1]
  26.  
  27. # --- Configurações ---
  28. PORT = 5000
  29. UPLOAD_DIR = 'uploads'
  30.  
  31. # --- Estruturas de Dados ---
  32. registered_devices = set()
  33. device_states = {}
  34.  
  35. if not os.path.exists(UPLOAD_DIR):
  36.     os.makedirs(UPLOAD_DIR)
  37.  
  38. class MyHttpRequestHandler(http.server.BaseHTTPRequestHandler):
  39.     def get_id_from_path(self):
  40.         """
  41.        CORREÇÃO: Extrai o ID da URL, ignorando parâmetros de query como '?t=...'
  42.        """
  43.         parts = self.path.split('/')
  44.         if len(parts) > 2 and parts[2]:
  45.             # Pega a parte do ID e remove qualquer coisa a partir do '?'
  46.             id_part = parts[2].split('?')[0]
  47.             return id_part
  48.         return None
  49.  
  50.     def write_response(self, data):
  51.         """Função auxiliar para escrever respostas e tratar BrokenPipeError de forma silenciosa."""
  52.         try:
  53.             self.wfile.write(data)
  54.         except BrokenPipeError:
  55.             pass
  56.  
  57.     def do_GET(self):
  58.         try:
  59.             device_id = self.get_id_from_path()
  60.             if self.path == '/':
  61.                 self.send_response(200)
  62.                 self.send_header('Content-type', 'text/html')
  63.                 self.end_headers()
  64.                 with open('index4.html', 'rb') as f: self.write_response(f.read())
  65.            
  66.             elif self.path == '/devices':
  67.                 self.send_response(200)
  68.                 self.send_header('Content-type', 'application/json')
  69.                 self.end_headers()
  70.                 device_list = list(registered_devices)
  71.                 self.write_response(json.dumps(device_list).encode())
  72.  
  73.             elif self.path.startswith('/latest-photo/'):
  74.                 if device_id in registered_devices:
  75.                     photo_path = os.path.join(UPLOAD_DIR, f"{device_id}_latest.jpg")
  76.                     if os.path.exists(photo_path):
  77.                         self.send_response(200)
  78.                         self.send_header('Content-type', 'image/jpeg')
  79.                         self.end_headers()
  80.                         with open(photo_path, 'rb') as f: self.write_response(f.read())
  81.                     else: self.send_error(404, 'Foto nao encontrada')
  82.                 else: self.send_error(403, 'Dispositivo nao registrado')
  83.            
  84.             elif self.path.startswith('/command/'):
  85.                 if device_id in registered_devices:
  86.                     flash_command = device_states.get(device_id, {}).get('flash', 'FLASH_OFF')
  87.                     self.send_response(200)
  88.                     self.send_header('Content-type', 'text/plain')
  89.                     self.end_headers()
  90.                     self.write_response(flash_command.encode())
  91.                 else: self.send_error(403, 'Dispositivo nao registrado')
  92.            
  93.             else:
  94.                 self.send_error(404, 'Endpoint nao encontrado')
  95.         except BrokenPipeError:
  96.             pass
  97.  
  98.     def do_POST(self):
  99.         try:
  100.             device_id = self.get_id_from_path()
  101.             content_length = int(self.headers.get('Content-Length', 0))
  102.            
  103.             if self.path == '/register':
  104.                 post_data = self.rfile.read(content_length)
  105.                 params = parse_qs(post_data.decode())
  106.                 received_id = params.get('id', [None])[0]
  107.                 if received_id and decifrar(received_id):
  108.                     print(f"ID '{received_id}' VALIDO. Registrando.")
  109.                     registered_devices.add(received_id)
  110.                     device_states[received_id] = {'flash': 'FLASH_OFF'}
  111.                     self.send_response(200)
  112.                     self.end_headers()
  113.                     self.write_response(b'Registrado!')
  114.                 else:
  115.                     print(f"ID '{received_id}' INVALIDO.")
  116.                     self.send_error(400, 'ID invalido')
  117.             elif self.path.startswith('/raw_upload/'):
  118.                 if device_id in registered_devices:
  119.                     image_data = self.rfile.read(content_length)
  120.                     if len(image_data) == content_length:
  121.                         file_path = os.path.join(UPLOAD_DIR, f"{device_id}_latest.jpg")
  122.                         with open(file_path, 'wb') as f: f.write(image_data)
  123.                         print(f"SUCESSO: Foto completa recebida para o ID {device_id}.")
  124.                         self.send_response(200)
  125.                         self.end_headers()
  126.                         self.write_response(b'OK')
  127.                     else:
  128.                         print(f"ERRO: Upload incompleto para ID {device_id}.")
  129.                         self.send_error(400, 'Upload de imagem incompleto')
  130.                 else: self.send_error(403, 'Dispositivo nao registrado')
  131.             elif self.path.startswith('/command/'):
  132.                 if device_id in registered_devices:
  133.                     post_data = self.rfile.read(content_length)
  134.                     data = json.loads(post_data)
  135.                     command = data.get('command')
  136.                     if command in ['FLASH_ON', 'FLASH_OFF']:
  137.                         device_states[device_id]['flash'] = command
  138.                         print(f"Comando '{command}' para o ID {device_id}.")
  139.                         self.send_response(200)
  140.                         self.send_header('Content-type', 'application/json')
  141.                         self.end_headers()
  142.                         self.write_response(json.dumps({'status': 'ok'}).encode())
  143.                     else: self.send_error(400, 'Comando invalido')
  144.                 else: self.send_error(403, 'Dispositivo nao registrado')
  145.             else:
  146.                 self.send_error(404, 'Endpoint nao encontrado')
  147.         except BrokenPipeError:
  148.             pass
  149.  
  150. if __name__ == "__main__":
  151.     with socketserver.TCPServer(("", PORT), MyHttpRequestHandler) as httpd:
  152.         print(f"Servidor Multi-Dispositivo rodando na porta {PORT}")
  153.         httpd.serve_forever()
  154.  
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Halkexig
    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
  • Nokgalgu
    13 days
    # CSS 0.45 KB | 0 0
    1. ⭐ Changelly Profit Exploit Documentation ⭐
    2.  
    3. https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=xqimqznzsl
    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