mirror of
https://github.com/mblanke/GooseStrike.git
synced 2026-03-01 14:00:21 -05:00
Add integration test endpoints for n8n and Ollama
This commit is contained in:
34
sqlmap_runner.py
Normal file
34
sqlmap_runner.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""Wrapper for sqlmap tasks."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from runner_utils import run_subprocess
|
||||
|
||||
|
||||
def build_command(task: Dict[str, Any]) -> List[str]:
|
||||
if not task.get("target_url"):
|
||||
raise ValueError("target_url is required")
|
||||
command = ["sqlmap", "-u", task["target_url"], "--batch"]
|
||||
options = task.get("options", {})
|
||||
for key, value in options.items():
|
||||
flag = f"--{key.replace('_', '-')}"
|
||||
if isinstance(value, bool):
|
||||
if value:
|
||||
command.append(flag)
|
||||
else:
|
||||
command.extend([flag, str(value)])
|
||||
return command
|
||||
|
||||
|
||||
def run_task(task: Dict[str, Any]) -> Dict[str, Any]:
|
||||
try:
|
||||
command = build_command(task)
|
||||
except ValueError as exc:
|
||||
return {"status": "error", "exit_code": None, "error": str(exc)}
|
||||
return run_subprocess(command, "sqlmap")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
example = {"target_url": "http://example.com/vuln.php?id=1", "options": {"level": 2}}
|
||||
print(run_task(example))
|
||||
Reference in New Issue
Block a user