Spaces:
Sleeping
Sleeping
AlphaWolf
commited on
Commit
·
b6ebc8d
1
Parent(s):
1ce1b50
Fix SQLMap path: Install in Docker build
Browse files- Dockerfile +7 -6
- app.py +9 -9
Dockerfile
CHANGED
|
@@ -2,23 +2,24 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
git \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
# Install Python dependencies
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
| 14 |
-
# Copy application files
|
| 15 |
COPY . .
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
RUN
|
| 19 |
|
| 20 |
-
# Expose the Gradio port
|
| 21 |
EXPOSE 7860
|
| 22 |
|
| 23 |
-
# Run the application
|
| 24 |
CMD ["python", "app.py"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
git \
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Clone SQLMap directly during build - GUARANTEED EXISTENCE
|
| 11 |
+
RUN git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev
|
| 12 |
+
|
| 13 |
# Install Python dependencies
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
# Copy application files (app.py, session.sqlite, etc.)
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
+
# Permissions for SQLMap output
|
| 21 |
+
RUN chmod -R 777 sqlmap-dev
|
| 22 |
|
|
|
|
| 23 |
EXPOSE 7860
|
| 24 |
|
|
|
|
| 25 |
CMD ["python", "app.py"]
|
app.py
CHANGED
|
@@ -4,14 +4,16 @@ import os
|
|
| 4 |
import shutil
|
| 5 |
|
| 6 |
# --- Session Restoration Logic ---
|
| 7 |
-
# Force Rebuild Trigger: v5.2 - Clean Slate
|
| 8 |
def restore_session():
|
| 9 |
# If session.sqlite was uploaded to the repo root, move it to the correct path
|
| 10 |
if os.path.exists("session.sqlite"):
|
| 11 |
target_dir = os.path.join("sqlmap-dev", "output", "hashi.ae")
|
| 12 |
os.makedirs(target_dir, exist_ok=True)
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
return "ℹ️ No session file found in repository."
|
| 16 |
|
| 17 |
def run_sqlmap(url, threads, level, risk, tamper, techn, proxy, extra_args):
|
|
@@ -22,8 +24,9 @@ def run_sqlmap(url, threads, level, risk, tamper, techn, proxy, extra_args):
|
|
| 22 |
yield f"{session_status}\n❌ Error: Target URL is required."
|
| 23 |
return
|
| 24 |
|
| 25 |
-
# Base command
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
# Performance & Level
|
| 29 |
cmd += ["--threads", str(int(threads))]
|
|
@@ -118,9 +121,6 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="slate"))
|
|
| 118 |
)
|
| 119 |
|
| 120 |
if __name__ == "__main__":
|
| 121 |
-
|
| 122 |
-
print("📥 Cloning SQLMAP Repository...")
|
| 123 |
-
subprocess.run(["git", "clone", "--depth", "1", "https://github.com/sqlmapproject/sqlmap.git", "sqlmap-dev"])
|
| 124 |
-
|
| 125 |
print("✨ SLMP Panel Live.")
|
| 126 |
demo.queue().launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 4 |
import shutil
|
| 5 |
|
| 6 |
# --- Session Restoration Logic ---
|
|
|
|
| 7 |
def restore_session():
|
| 8 |
# If session.sqlite was uploaded to the repo root, move it to the correct path
|
| 9 |
if os.path.exists("session.sqlite"):
|
| 10 |
target_dir = os.path.join("sqlmap-dev", "output", "hashi.ae")
|
| 11 |
os.makedirs(target_dir, exist_ok=True)
|
| 12 |
+
try:
|
| 13 |
+
shutil.copy("session.sqlite", os.path.join(target_dir, "session.sqlite"))
|
| 14 |
+
return "✅ Victory Session Restored from Repository."
|
| 15 |
+
except Exception as e:
|
| 16 |
+
return f"⚠️ Session restore warning: {str(e)}"
|
| 17 |
return "ℹ️ No session file found in repository."
|
| 18 |
|
| 19 |
def run_sqlmap(url, threads, level, risk, tamper, techn, proxy, extra_args):
|
|
|
|
| 24 |
yield f"{session_status}\n❌ Error: Target URL is required."
|
| 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
|
| 32 |
cmd += ["--threads", str(int(threads))]
|
|
|
|
| 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)
|