# app.py import gradio as gr import string def caesar_brute_force(ciphertext: str): ciphertext = ciphertext.strip() if not ciphertext: return "Please enter some ciphertext." alphabet = string.ascii_lowercase results = [] for shift in range(1, 26): # 25 possible Caesar shifts decrypted = '' for char in ciphertext: if char.lower() in alphabet: idx = (alphabet.index(char.lower()) - shift) % 26 new_char = alphabet[idx] decrypted += new_char.upper() if char.isupper() else new_char else: decrypted += char results.append(f"Shift {shift}: {decrypted}") return "\n\n".join(results) iface = gr.Interface( fn=caesar_brute_force, inputs=gr.Textbox(lines=4, label="Enter Caesar Cipher Text"), outputs="text", title="🔓 Caesar Cipher Brute-Force Analyzer", description="Try all 25 Caesar cipher shifts to decrypt a message. Look for the correct one based on the result." ) iface.launch()