Spaces:
Runtime error
Runtime error
File size: 523 Bytes
ef4248d |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
@app.post("/execute-exploit/{exploit_name}")
async def execute_exploit(exploit_name: str):
if not exploit_name.endswith(".py"):
return {"error": "Invalid exploit file type"}
sanitized_name = exploit_name.replace("../", "").replace("..\", "")
try:
with open(sanitized_name, "r") as file:
# Simulated execution for safety
return {"status": "success", "content": file.read()}
except FileNotFoundError:
return {"status": "failure", "error": "Exploit not found"}
|