developer coding user risk: medium
C Libpcap CLI Network Packet Analyzer
Create a command-line network packet analyzer in C using libpcap with packet capture, filtering, protocol analysis for TCP/UDP/HTTP/DNS, traffic statistics, packet decoding, PCAP/C…
- Policy sensitive
- Human review
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.
EXPECTED OUTPUT
- Format
- code
SUCCESS CRITERIA
- Create command-line network packet analyzer in C using libpcap
- Implement packet capture from network interfaces with filtering
- Add protocol analysis for TCP UDP HTTP DNS etc
- Include traffic statistics with bandwidth and connections
- Implement packet decoding with header details
- Add export to PCAP and CSV
- Include alert system for suspicious traffic
- Implement connection tracking with state
- Add geolocation lookup for IPs
- Include CLI arguments with defaults
- Implement color-coded output
FAILURE MODES
- Scope too broad leading to incomplete or partial implementation
- Vague definitions for alerts and suspicious patterns
- Geolocation may require external data not specified
- Complex multi-protocol support may be inaccurate or simplified
- Platform-specific libpcap issues not addressed
- Lack of error handling or robustness specifications
CAVEATS
- Missing context
-
- Platform/target OS for libpcap compatibility.
- Geolocation database or service to use.
- Detailed command-line argument structure or examples.
- CSV export schema/format.
- C standard or libpcap version.
- Ambiguities
-
- 'Common protocols (TCP, UDP, HTTP, DNS, etc.)' - unclear what 'etc.' includes.
- 'Suspicious traffic patterns' - undefined criteria.
QUALITY
- OVERALL
- 0.70
- CLARITY
- 0.90
- SPECIFICITY
- 0.80
- REUSABILITY
- 0.30
- COMPLETENESS
- 0.70
IMPROVEMENT SUGGESTIONS
- List exact protocols instead of 'etc.'.
- Define specific examples of 'suspicious traffic patterns' (e.g., port scans, high packet rates).
- Specify geolocation method (e.g., MaxMind GeoLite2 database).
- Provide example CLI usage and argument list.
- Add performance constraints or scope limits (e.g., max capture size).
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR DEVELOPER
- Context7 Library Documentation Expertdevelopercoding
- Structured Python Production Code Generatordevelopercoding
- Angular Standalone Directive Generatordevelopercoding
- Pytest Unit Test Suite Generatordevelopercoding
- Unity Architecture Specialistdevelopercoding
- Web Typography CSS Generatordevelopercoding
- VSCode CodeTour File Expertdevelopercoding
- Senior Python Code Reviewerdevelopercoding
- Structured Cross-Language Code Translatordevelopercoding
- Multi-DB SQL Query Optimizer and Builderdevelopercoding