@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"}