🤖 AI Agents & Workflows

Network Packet Analyzer CLI

📁 AI Agents & Workflows 👤 Contributed by @f 🗓️ Updated
The prompt
Create a command-line network packet analyzer in C using libpcap. Implement packet capture from network interfaces with filtering options. Add protocol analysis for common protocols (TCP, UDP, HTTP, DNS, etc.). Include traffic statistics with bandwidth usage and connection counts. Implement packet decoding with detailed header information. Add export functionality in PCAP and CSV formats. Include alert system for suspicious traffic patterns. Implement connection tracking with state information. Add geolocation lookup for IP addresses. Include command-line arguments for all options with sensible defaults. Implement color-coded output for better readability.

Example outputs

Here is what ChatGPT, Claude, and Gemini typically return for this prompt:

🚀 ChatGPT

I'll help you create a comprehensive network packet analyzer! The program will use libpcap for packet capture with BPF filters, parse Ethernet/IP/TCP/UDP headers, and decode application protocols like HTTP and DNS. For statistics, we'll track bandwidth using rolling windows and maintain connection state tables. The alert system can detect SYN floods, port scans, and unusual traffic volumes, while the GeoIP integration uses MaxMind databases for location data.

✨ Claude

I should note that building a full-featured packet analyzer requires careful consideration of privileges (libpcap needs root/CAP_NET_RAW) and potential legal/ethical implications of network monitoring. The implementation would involve pcap_open_live() for capture, manual packet parsing from the data link layer up, and likely integration with GeoIP libraries. I'd recommend starting with basic capture and incrementally adding protocol parsers, as HTTP/DNS analysis can be quite complex depending on depth needed.

💎 Gemini

This C program requires libpcap-dev and optionally libmaxminddb for GeoIP. Key functions include pcap_loop() for capture, manual struct parsing for protocol headers (struct iphdr, tcphdr, etc.), and pcap_dump() for PCAP export. Statistics can use hash tables for connection tracking, CSV export via fprintf(), and ANSI escape codes for colored output. Reference implementation patterns from tcpdump source code for robust protocol decoding.

How to use this prompt

Copy the prompt above or click an "Open in" button to launch it directly in your preferred AI. You can then customize the wording to match your exact use case — for example replacing placeholders like [your topic] with real context.

Which AI model works best

Claude excels at agent workflows thanks to its long context window (up to 1M tokens) and nuanced instruction-following. ChatGPT has native Actions (tool-calling) built in. Gemini integrates best with Google Workspace data. For autonomous workflows, Claude Sonnet 4.6 is the current sweet-spot for quality and cost.

How to customize this prompt

Adjust the agent's role and constraints to your environment. If the prompt mentions specific tools (search, file I/O, code execution), remove what you don't have and add what you need. Add guardrails: "Always ask for confirmation before writing files." Define success criteria explicitly.

Common use cases

  • Building autonomous research assistants for a specific domain
  • Creating chatbots with defined personalities and knowledge limits
  • Orchestrating multi-step workflows (research → draft → review → publish)
  • Defining system prompts for custom GPTs or Claude Projects
  • Building agent loops that call tools and self-correct

Variations

Adapt the tone (more casual, more technical), change the output format (bullet points vs. paragraphs), or add constraints (word limits, target audience).

Related prompts