# π¦ Wireshark MCP Packet Capture Setup Guide
## π Quick Start - Enable Packet Capture
The Wireshark MCP now includes **automatic permissions handling** and **real packet capture capabilities**!
### **Step 1: Run the Setup Script**
```bash
cd /home/dell/coding/mcp/wireshark-mcp
./setup_permissions.sh
```
### **Step 2: Activate Group Membership**
```bash
# Either log out and back in, OR run:
newgrp wireshark
```
### **Step 3: Test Permissions**
```bash
./test_capture_permissions.py
```
### **Step 4: Restart Claude Desktop**
Close Claude Desktop completely and reopen it.
---
## π§ What the Setup Does
### **Secure Permissions Configuration**
- β
Creates `wireshark` group for secure access control
- β
Adds your user to the wireshark group
- β
Sets Linux capabilities on capture tools (dumpcap, tshark, tcpdump)
- β
Restricts access to group members only
- β
No need for sudo during operation
### **Security Features**
- π‘οΈ **Group-based access** - Only wireshark group members can capture
- π‘οΈ **Capability-based permissions** - No root privileges required
- π‘οΈ **Tool isolation** - Only capture tools have elevated capabilities
- π‘οΈ **Automatic cleanup** - Temporary files cleaned up after analysis
---
## π‘ Live Packet Capture Features
### **Automatic Permission Detection**
The Wireshark MCP now automatically detects if you have packet capture permissions:
- β
**With Permissions**: Real packet capture using dumpcap/tshark
- β οΈ **Without Permissions**: Provides setup instructions
### **Real Packet Capture**
```bash
# Through Claude Desktop MCP interface:
"Capture live packets on interface wlp2s0 for 30 seconds with HTTP filter"
```
**Capabilities:**
- π **Live capture** on any network interface
- π― **Smart filtering** using Wireshark display filters
- β±οΈ **Duration control** (default: 60 seconds)
- π¦ **Packet limits** (default: 1000 packets)
- π§Ή **Automatic cleanup** of temporary files
---
## π PCAP File Analysis Features
### **Comprehensive Analysis Types**
1. **Quick Analysis** - Basic packet counts and protocols
2. **Security Analysis** - Threat detection and suspicious patterns
3. **Performance Analysis** - Network health and TCP issues
4. **Comprehensive Analysis** - All of the above combined
### **Security Pattern Detection**
- π¨ TCP SYN flood detection
- π Port scan indicators
- π³οΈ DNS tunneling detection
- π Large HTTP request analysis
- β οΈ Non-standard port usage
### **Performance Metrics**
- π TCP retransmissions
- π Duplicate ACK analysis
- βΈοΈ Zero window conditions
- π Keep-alive patterns
- π₯ Overall network health assessment
---
## π§ͺ Testing Your Setup
### **Test Script Results**
After running `./test_capture_permissions.py`, you should see:
```
π§ͺ Testing packet capture capabilities...
========================================
β
dumpcap: Capture started successfully (timeout expected)
β
tshark: Capture started successfully (timeout expected)
β
tcpdump: Capture started successfully (timeout expected)
========================================
β
3/3 capture tools working without sudo
π Wireshark MCP packet capture is ready!
```
### **Troubleshooting**
If tests fail:
1. **Log out and back in** (group membership activation)
2. **Check group membership**: `groups $USER`
3. **Verify capabilities**: `getcap $(which dumpcap)`
4. **Re-run setup**: `./setup_permissions.sh`
---
## π― Usage Examples
### **Through Claude Desktop**
Once setup is complete, you can use natural language commands:
**System Information:**
```
"Get Wireshark MCP system information"
```
**Live Capture:**
```
"Capture HTTP traffic on ethernet interface for 30 seconds"
"Capture DNS queries on any interface with 100 packet limit"
```
**Filter Generation:**
```
"Generate a Wireshark filter for HTTPS traffic to Google"
"Create a filter for slow TCP connections"
```
**PCAP Analysis:**
```
"Analyze /path/to/capture.pcap for security threats"
"Perform quick analysis on /tmp/network.pcapng"
```
---
## π Security Considerations
### **What's Protected**
- β
Only wireshark group members can capture packets
- β
Capabilities limited to network capture only
- β
No system-wide root privileges granted
- β
Temporary files automatically cleaned up
### **What's Accessible**
- π‘ All network interfaces on the system
- π Raw packet data (same as tcpdump/wireshark)
- π Network traffic analysis capabilities
### **Best Practices**
- π― Use specific interfaces when possible (not "any")
- β±οΈ Limit capture duration for large networks
- π§Ή Captured files are automatically cleaned up after 5 minutes
- π Only add trusted users to wireshark group
---
## β
Success Indicators
After successful setup, your Wireshark MCP will provide:
1. **β
Real Packet Capture** - No more simulation mode
2. **π Intelligent Analysis** - Security, performance, and comprehensive insights
3. **π― Smart Filtering** - Natural language to Wireshark filters
4. **π‘οΈ Secure Operation** - No sudo required during operation
5. **π§Ή Automatic Cleanup** - Temporary files managed automatically
---
**π Your Wireshark MCP is now ready for professional network analysis!**