File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import requests
44from dotenv import load_dotenv
5- from fastapi import APIRouter , HTTPException , Body
5+ from fastapi import APIRouter , HTTPException , Body , Request
66
77import app .core .sqlmap_core as sqlmap_task
88import app .schema .sqlmap as sqlmapschema
@@ -102,3 +102,23 @@ async def delete_task(task_id: str):
102102 requests .get (f"{ SQLMAP_API } /task/{ task_id } /delete" , auth = AUTH )
103103
104104 return {"success" : True }
105+
106+
107+ @router .post ("/tasks/webhook/log" )
108+ async def receive_sqlmap_log (request : Request ):
109+ try :
110+ # 获取原始请求体
111+ body = await request .body ()
112+ # 解析JSON数据
113+ log_data = await request .json ()
114+
115+ # 打印接收到的数据用于调试
116+ print (log_data )
117+
118+ # TODO: 在这里处理日志数据,例如保存到数据库
119+ # 您可以根据log_data的结构进行相应的处理
120+
121+ return {"success" : True , "message" : "Log received successfully" }
122+ except Exception as e :
123+ print (f"Error processing log: { e } " )
124+ raise HTTPException (status_code = 400 , detail = f"Invalid log data: { str (e )} " )
You can’t perform that action at this time.
0 commit comments