GenCCPlus commited on
Commit
114aa0a
·
verified ·
1 Parent(s): 7af190c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +133 -0
app.py ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ import requests
4
+ import random
5
+ import re
6
+
7
+ def luhn_check(card_number):
8
+ digits = [int(d) for d in str(card_number) if d.isdigit()]
9
+ checksum = 0
10
+ parity = len(digits) % 2
11
+ for i, digit in enumerate(digits):
12
+ if i % 2 == parity:
13
+ digit *= 2
14
+ if digit > 9:
15
+ digit -= 9
16
+ checksum += digit
17
+ return checksum % 10 == 0
18
+
19
+ def verificar_luhn_lista(lista):
20
+ tarjetas_raw = [t.strip() for t in lista.replace('\n', ',').split(',') if t.strip()]
21
+ if len(tarjetas_raw) > 50:
22
+ return "❌ Máximo permitido: 50 tarjetas."
23
+ resultados = []
24
+ for entrada in tarjetas_raw:
25
+ match = re.search(r"\d{12,19}", entrada)
26
+ if match:
27
+ numero = match.group()
28
+ resultado = "✅ VÁLIDA" if luhn_check(numero) else "❌ INVÁLIDA"
29
+ resultados.append(f"{entrada} → {resultado}")
30
+ else:
31
+ resultados.append(f"{entrada} → ⚠️ No se encontró un número válido")
32
+ return "\n".join(resultados)
33
+
34
+ def buscar_bin(bin_input):
35
+ bin_input = re.sub(r"\D", "", bin_input)[:6]
36
+ if len(bin_input) < 6:
37
+ return "❌ Ingrese al menos los primeros 6 dígitos."
38
+ try:
39
+ response = requests.get(f"https://lookup.binlist.net/{bin_input}")
40
+ if response.status_code == 200:
41
+ data = response.json()
42
+ tipo = data.get("type", "Desconocido")
43
+ marca = data.get("scheme", "Desconocida")
44
+ nivel = data.get("brand", "Desconocido")
45
+ banco = data.get("bank", {}).get("name", "Desconocido")
46
+ pais = data.get("country", {}).get("name", "Desconocido")
47
+ return (
48
+ f"🔍 Información del BIN {bin_input}:\n"
49
+ f"- Banco: {banco}\n"
50
+ f"- Marca: {marca.capitalize()}\n"
51
+ f"- Tipo: {tipo.capitalize()} 💳\n"
52
+ f"- Nivel: {nivel}\n"
53
+ f"- País: {pais}"
54
+ )
55
+ else:
56
+ return "❌ No se encontró información para este BIN."
57
+ except:
58
+ return "❌ Error al conectar con el servicio BIN."
59
+
60
+ def generar_tarjetas(bin_input, cantidad, mes, anio):
61
+ bin_input = re.sub(r"\D", "", bin_input)
62
+ if len(bin_input) < 6 or len(bin_input) > 15:
63
+ return "❌ El BIN debe tener entre 6 y 15 dígitos."
64
+ fecha_final = f"{str(mes).zfill(2)}/{str(anio)[-2:]}"
65
+ generadas = []
66
+ while len(generadas) < cantidad:
67
+ base = bin_input
68
+ while len(base) < 15:
69
+ base += str(random.randint(0, 9))
70
+ for last_digit in range(10):
71
+ card_candidate = base + str(last_digit)
72
+ if luhn_check(card_candidate):
73
+ ccv = str(random.randint(100, 999))
74
+ generadas.append(f"{card_candidate}|{fecha_final}|{ccv}")
75
+ break
76
+ return "\n".join(generadas)
77
+
78
+ custom_css = '''
79
+ body {
80
+ background-color: #eafaf1;
81
+ font-family: Arial, sans-serif;
82
+ }
83
+ h1, h2, .gr-textbox label, .gr-dropdown label, .gr-slider label {
84
+ text-align: center !important;
85
+ font-weight: bold !important;
86
+ color: #14532d;
87
+ }
88
+ .gr-block, .gr-group {
89
+ margin: auto;
90
+ max-width: 600px;
91
+ padding: 10px;
92
+ }
93
+ .gr-button {
94
+ display: block;
95
+ margin: 10px auto 0 auto;
96
+ font-weight: bold;
97
+ background-color: #34d399;
98
+ color: #064e3b;
99
+ }
100
+ '''
101
+
102
+ with gr.Blocks(css=custom_css, title="Herramientas Educativas de Tarjetas") as demo:
103
+ gr.Markdown("# 🧠 Herramientas Educativas para Tarjetas")
104
+
105
+ with gr.Tab("💳 Generador de CC"):
106
+ gr.Markdown("Genera tarjetas válidas con BIN, fecha seleccionada y CCV aleatorio.")
107
+ bin_para_generar = gr.Textbox(label="BIN o primeros dígitos")
108
+ cantidad = gr.Slider(minimum=1, maximum=50, step=1, value=10, label="Cantidad de tarjetas")
109
+ mes_dropdown = gr.Dropdown(choices=[str(m).zfill(2) for m in range(1, 13)], label="Mes (MM)", value="12")
110
+ anio_dropdown = gr.Dropdown(choices=[str(y) for y in range(2025, 2033)], label="Año (YYYY)", value="2026")
111
+ boton_generar = gr.Button("Generar tarjetas")
112
+ salida_generadas = gr.Textbox(label="Tarjetas generadas", lines=10)
113
+ boton_generar.click(
114
+ generar_tarjetas,
115
+ inputs=[bin_para_generar, cantidad, mes_dropdown, anio_dropdown],
116
+ outputs=salida_generadas
117
+ )
118
+
119
+ with gr.Tab("📘 Bin List"):
120
+ gr.Markdown("Consulta información educativa de un BIN específico.")
121
+ bin_input = gr.Textbox(label="Número de tarjeta o BIN")
122
+ boton_bin = gr.Button("Buscar BIN")
123
+ bin_info = gr.Textbox(label="Resultado del análisis", lines=7, interactive=False)
124
+ boton_bin.click(buscar_bin, inputs=bin_input, outputs=bin_info)
125
+
126
+ with gr.Tab("✅ Verificador Luhn"):
127
+ gr.Markdown("Verifica si un número de tarjeta cumple con el algoritmo Luhn.")
128
+ entrada_luhn = gr.Textbox(label="Pega tarjetas (con o sin fecha/ccv)", lines=8)
129
+ boton_verificar = gr.Button("Verificar")
130
+ salida_luhn = gr.Textbox(label="Resultado", lines=10, interactive=False)
131
+ boton_verificar.click(verificar_luhn_lista, inputs=entrada_luhn, outputs=salida_luhn)
132
+
133
+ demo.launch()