1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 18:28:11 +00:00

Fix packet capture

This commit is contained in:
grossmj 2021-12-02 18:07:09 +10:30
parent 928966ea5f
commit 8bae921587
3 changed files with 11 additions and 4 deletions

View File

@ -198,7 +198,14 @@ async def stream_pcap(request: Request, link: Link = Depends(dep_link)) -> Strea
async def compute_pcap_stream():
try:
async with HTTPClient.request(request.method, pcap_streaming_url, timeout=None, data=body) as response:
async with HTTPClient.request(
request.method,
pcap_streaming_url,
user=compute.user,
password=compute.password,
timeout=None,
data=body
) as response:
async for data in response.content.iter_any():
if not data:
break

View File

@ -183,7 +183,7 @@ class UDPLink(Link):
self._capture_node = self._choose_capture_side()
data = {"capture_file_name": capture_file_name, "data_link_type": data_link_type}
await self._capture_node["node"].post(
"/adapters/{adapter_number}/ports/{port_number}/start_capture".format(
"/adapters/{adapter_number}/ports/{port_number}/capture/start".format(
adapter_number=self._capture_node["adapter_number"], port_number=self._capture_node["port_number"]
),
data=data,
@ -196,7 +196,7 @@ class UDPLink(Link):
"""
if self._capture_node:
await self._capture_node["node"].post(
"/adapters/{adapter_number}/ports/{port_number}/stop_capture".format(
"/adapters/{adapter_number}/ports/{port_number}/capture/stop".format(
adapter_number=self._capture_node["adapter_number"], port_number=self._capture_node["port_number"]
)
)

View File

@ -52,7 +52,7 @@ class HTTPClient:
if not password:
password = ""
try:
basic_auth = aiohttp.BasicAuth(user, password, "utf-8")
basic_auth = aiohttp.BasicAuth(user, password.get_secret_value(), "utf-8")
except ValueError as e:
log.error(f"Basic authentication set-up error: {e}")