Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

The Traffic page ping functionality was failing because the frontend sends multi-protocol requests (ICMP/TCP/UDP/HTTP/DNS) but the backend only accepted a simple hostname parameter. Additionally, users reported SYN packets to 8.8.8.8 not receiving responses, which is expected behavior for filtered ports.

Changes

Backend API (traffic.py)

  • Expanded PingRequest model to accept protocol-specific parameters: target, protocol, port, count, timeout, packet_size, use_https
  • Implemented protocol handlers:
    • ICMP: Standard ping with RTT statistics and packet loss calculation
    • TCP: hping3 SYN probes with response parsing
    • UDP: hping3 UDP probes with ICMP unreachable detection
    • HTTP/HTTPS: Request-based connectivity with status code tracking
    • DNS: dig queries to root domain for maximum compatibility
  • Added input validators (port 1-65535, count 1-100, timeout 1-30s, etc.)

Packet Crafting (SnifferService.py)

  • Added explanatory notes when packets receive no response
  • Extracted informational text to class constants for maintainability

Example

# Before: Only basic ping
PingRequest(host="8.8.8.8")

# After: Multi-protocol with full control
PingRequest(
    target="8.8.8.8",
    protocol="tcp",      # or icmp, udp, http, dns
    port=53,
    count=4,
    timeout=5
)

Response now includes detailed statistics:

{
  "protocol": "tcp",
  "target": "8.8.8.8",
  "port": 53,
  "successful": 4,
  "packet_loss": 0,
  "min_ms": 12.3,
  "avg_ms": 15.7,
  "max_ms": 18.2,
  "results": [...]
}

Notes

SYN packets to public DNS servers (8.8.8.8) not responding to non-DNS ports is correct firewall behavior. The UI now displays explanatory notes to avoid confusion.

Original prompt

Ping is throwing error in gui in traffic page also packet craft seems to be sending but i tried creating oacket syn to 8.8.8.8 didnt get any response

Custom agent used: _DevTeam
Orchestrates development by delegating to specialist agents. Defines WHO and WHEN to delegate. Specialists define HOW to execute.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 31, 2025 04:09
Co-authored-by: goranjovic55 <83976007+goranjovic55@users.noreply.github.com>
Co-authored-by: goranjovic55 <83976007+goranjovic55@users.noreply.github.com>
Co-authored-by: goranjovic55 <83976007+goranjovic55@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error in GUI on traffic page Fix advanced ping endpoint and clarify packet crafting behavior Dec 31, 2025
Copilot AI requested a review from goranjovic55 December 31, 2025 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants