| import os |
| import gradio as gr |
| from pathlib import Path |
| from patcher import PhantomPatcher |
|
|
| |
| |
|
|
| CUSTOM_CSS = """ |
| body { background-color: #0d0d0d !important; color: #e0e0e0 !important; } |
| .gradio-container { border: 2px solid #ff0000; border-radius: 15px; padding: 20px; box-shadow: 0 0 20px rgba(255,0,0,0.2); } |
| #title { text-align: center; font-size: 2.5em; font-weight: bold; color: #ff0000; text-transform: uppercase; margin-bottom: 30px; } |
| .gr-button { background: linear-gradient(90deg, #800000 0%, #ff0000 100%) !important; color: #fff !important; font-weight: bold !important; border: none !important; } |
| .gr-button:hover { background: linear-gradient(90deg, #ff0000 0%, #800000 100%) !important; transform: scale(1.02); transition: 0.2s; } |
| .gr-input, .gr-file { background-color: #1a1a1a !important; border: 1px solid #333 !important; border-radius: 8px !important; } |
| """ |
|
|
| def phantom_process(apk_file, regex_input, replace_input): |
| """ |
| Função principal de processamento chamada pela UI. |
| """ |
| if not apk_file: |
| return "Nenhum arquivo enviado.", None |
| |
| |
| patcher = PhantomPatcher(work_dir="phantom_workspace") |
| patcher.clean() |
| |
| try: |
| |
| |
| |
| regex_pairs = [(regex_input, replace_input)] |
| |
| |
| input_path = Path(apk_file.name) |
| ready_apk = patcher.prepare_file(input_path) |
| |
| |
| decompiled_dir = patcher.decompile(ready_apk) |
| |
| |
| patcher.apply_patches(decompiled_dir, regex_pairs) |
| |
| |
| output_name = f"MOD_{ready_apk.name}" |
| final_apk = patcher.rebuildand_sign(decompiled_dir, output_name) |
| |
| return f"Sucesso Industrial! APK Modificado: {output_name}", str(final_apk) |
| |
| except Exception as e: |
| return f"FALHA CRÍTICA NA OPERAÇÃO: {str(e)}", None |
|
|
| |
| with gr.Blocks(css=CUSTOM_CSS, theme=gr.themes.Soft(primary_hue="red", neutral_hue="slate")) as demo: |
| gr.HTML("<div id='title'>⬛🔴 PROJETO FANTASMA — APK AUTOMATOR ⬛🔴</div>") |
| |
| with gr.Row(): |
| file_input = gr.File(label="📦 Enviar APK, XAPK ou ZIP", file_types=[".apk", ".xapk", ".zip"]) |
| |
| with gr.Row(): |
| with gr.Column(): |
| regex_box = gr.Textbox(label="🔍 Regex Pattern (Smali)", placeholder="Ex: const/4 v0, 0x0", value="const/4 v0, 0x0") |
| with gr.Column(): |
| replace_box = gr.Textbox(label="✍️ Replacement", placeholder="Ex: const/4 v0, 0x1", value="const/4 v0, 0x1") |
| |
| btn = gr.Button("🚀 EXECUTAR MOD BRUTAL") |
| |
| output_text = gr.Text(label="Status de Operação") |
| output_file = gr.File(label="📥 Baixar APK Modificado") |
|
|
| btn.click(fn=phantom_process, inputs=[file_input, regex_box, replace_box], outputs=[output_text, output_file]) |
|
|
| if __name__ == "__main__": |
| |
| demo.launch(server_name="0.0.0.0", server_port=7860) |
|
|