📡 GoSniffer A lightweight, standalone packet sniffer written in Go that captures and logs TCP, UDP, and DNS traffic to a file. Ideal for network diagnostics, monitoring, or automated environments — especially on Windows systems.
🔧 Features Lists available network interfaces for manual selection
Captures:
TCP and UDP source/destination IPs and ports
DNS queries
Logs packet data with timestamps
Output format is tab-delimited and saved to a file
📂 Sample Output (Saved to E:\Tshark\logdate.txt)
2025-06-16 12:45:03 192.168.1.10 8.8.8.8 52344 53 www.google.com 2025-06-16 12:45:04 192.168.1.10 1.1.1.1 52346 443 ...
✅ Requirements Go 1.17 or newer
Npcap or WinPcap installed (required by pcap)
Administrator privileges (to capture packets)
🚀 Getting Started Clone the repo:
git clone https://github.com/yourname/GoSniffer.git cd GoSniffer Install dependencies:
go get github.com/google/gopacket Build or run:
go run main.go Select a network interface from the list shown in the terminal.
Captured traffic will be written to:
E:\Tshark\logdate.txt 🔍 Example Interface Selection Prompt
Available interfaces: 0. \Device\NPF_{123...} (Ethernet Adapter)
- \Device\NPF_{456...} (Wi-Fi Adapter)
Enter the index number of the interface to capture from:
📦 To Build an Executable
go build -o gosniffer.exe main.go
✨ Planned Features
Filter by protocol (e.g., DNS only)
Auto-select interface by friendly name
Output to CSV or JSON
Run as a background service
Cross-platform support
📄 License MIT License © Hamed Adeli