AlphaWolf commited on
Commit ·
a0dc135
1
Parent(s): b6ebc8d
Fix Session Path: Inject into /root/.local for true resume
Browse files
app.py
CHANGED
|
@@ -2,16 +2,33 @@ import gradio as gr
|
|
| 2 |
import subprocess
|
| 3 |
import os
|
| 4 |
import shutil
|
|
|
|
| 5 |
|
| 6 |
# --- Session Restoration Logic ---
|
| 7 |
def restore_session():
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
try:
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
except Exception as e:
|
| 16 |
return f"⚠️ Session restore warning: {str(e)}"
|
| 17 |
return "ℹ️ No session file found in repository."
|
|
@@ -25,7 +42,6 @@ def run_sqlmap(url, threads, level, risk, tamper, techn, proxy, extra_args):
|
|
| 25 |
return
|
| 26 |
|
| 27 |
# Base command - pointing to the pre-cloned directory
|
| 28 |
-
# Using absolute path to be safe, or relative if WORKDIR is /app
|
| 29 |
cmd = ["python3", "/app/sqlmap-dev/sqlmap.py", "-u", url, "--batch"]
|
| 30 |
|
| 31 |
# Performance & Level
|
|
@@ -121,6 +137,5 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="slate"))
|
|
| 121 |
)
|
| 122 |
|
| 123 |
if __name__ == "__main__":
|
| 124 |
-
# Removed runtime cloning logic as it's now handled by Dockerfile
|
| 125 |
print("✨ SLMP Panel Live.")
|
| 126 |
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 2 |
import subprocess
|
| 3 |
import os
|
| 4 |
import shutil
|
| 5 |
+
from pathlib import Path
|
| 6 |
|
| 7 |
# --- Session Restoration Logic ---
|
| 8 |
def restore_session():
|
| 9 |
+
# SQLMap in Docker uses /root/.local/share/sqlmap/output/
|
| 10 |
+
# We need to calculate the target directory based on the hostname (hashi.ae)
|
| 11 |
+
# or just copy to the most likely path.
|
| 12 |
+
|
| 13 |
+
session_source = "session.sqlite"
|
| 14 |
+
|
| 15 |
+
# Target directory used by SQLMap (detected from logs)
|
| 16 |
+
target_base = Path("/root/.local/share/sqlmap/output/hashi.ae")
|
| 17 |
+
|
| 18 |
+
if os.path.exists(session_source):
|
| 19 |
try:
|
| 20 |
+
# Create the directory if it doesn't exist
|
| 21 |
+
target_base.mkdir(parents=True, exist_ok=True)
|
| 22 |
+
|
| 23 |
+
# Copy the session file
|
| 24 |
+
shutil.copy(session_source, target_base / "session.sqlite")
|
| 25 |
+
|
| 26 |
+
# Also try the www. variant to be safe
|
| 27 |
+
target_www = Path("/root/.local/share/sqlmap/output/www.hashi.ae")
|
| 28 |
+
target_www.mkdir(parents=True, exist_ok=True)
|
| 29 |
+
shutil.copy(session_source, target_www / "session.sqlite")
|
| 30 |
+
|
| 31 |
+
return f"✅ Victory Session Injected into {target_base}"
|
| 32 |
except Exception as e:
|
| 33 |
return f"⚠️ Session restore warning: {str(e)}"
|
| 34 |
return "ℹ️ No session file found in repository."
|
|
|
|
| 42 |
return
|
| 43 |
|
| 44 |
# Base command - pointing to the pre-cloned directory
|
|
|
|
| 45 |
cmd = ["python3", "/app/sqlmap-dev/sqlmap.py", "-u", url, "--batch"]
|
| 46 |
|
| 47 |
# Performance & Level
|
|
|
|
| 137 |
)
|
| 138 |
|
| 139 |
if __name__ == "__main__":
|
|
|
|
| 140 |
print("✨ SLMP Panel Live.")
|
| 141 |
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
|