refactor: simplify API routes and add sniffer status functionality
Some checks failed
Build and Deploy MITM Webserver / build (push) Failing after 5s
Some checks failed
Build and Deploy MITM Webserver / build (push) Failing after 5s
- Updated API routes to remove redundant prefixes. - Introduced sniffer status fetching in the backend API. - Added Sniffing page and integrated it into the routing. - Created a new hook for backend API interactions. - Implemented sniffer status type definitions.
This commit is contained in:
@@ -58,7 +58,7 @@ class SnifferStatusResponse(BaseModel):
|
||||
# Endpoints
|
||||
# ------------------------------
|
||||
|
||||
@router.post("/sniffer/start", response_model=SnifferStartResponse)
|
||||
@router.post("/start", response_model=SnifferStartResponse)
|
||||
def sniffer_start(req: SnifferStartRequest):
|
||||
"""
|
||||
Start the AF_PACKET sniffer for the given bridge.
|
||||
@@ -70,7 +70,7 @@ def sniffer_start(req: SnifferStartRequest):
|
||||
raise HTTPException(status_code=500, detail=f"Failed to start sniffer: {exc}")
|
||||
|
||||
|
||||
@router.post("/sniffer/stop", response_model=SnifferStopResponse)
|
||||
@router.post("/stop", response_model=SnifferStopResponse)
|
||||
def sniffer_stop():
|
||||
"""
|
||||
Stop the AF_PACKET sniffer (if running).
|
||||
@@ -82,7 +82,7 @@ def sniffer_stop():
|
||||
raise HTTPException(status_code=500, detail=f"Failed to stop sniffer: {exc}")
|
||||
|
||||
|
||||
@router.get("/sniffer/status", response_model=SnifferStatusResponse)
|
||||
@router.get("/status", response_model=SnifferStatusResponse)
|
||||
def sniffer_status():
|
||||
"""
|
||||
Return the sniffer status information.
|
||||
|
||||
Reference in New Issue
Block a user