mcpcap 0.4.7__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcpcap/_version.py +2 -2
- mcpcap/cli.py +3 -16
- mcpcap/core/config.py +2 -203
- mcpcap/core/server.py +11 -12
- mcpcap/modules/base.py +106 -9
- mcpcap/modules/dhcp.py +6 -117
- mcpcap/modules/dns.py +6 -116
- mcpcap/modules/icmp.py +327 -0
- mcpcap-0.5.2.dist-info/METADATA +371 -0
- mcpcap-0.5.2.dist-info/RECORD +17 -0
- mcpcap-0.4.7.dist-info/METADATA +0 -345
- mcpcap-0.4.7.dist-info/RECORD +0 -16
- {mcpcap-0.4.7.dist-info → mcpcap-0.5.2.dist-info}/WHEEL +0 -0
- {mcpcap-0.4.7.dist-info → mcpcap-0.5.2.dist-info}/entry_points.txt +0 -0
- {mcpcap-0.4.7.dist-info → mcpcap-0.5.2.dist-info}/licenses/LICENSE +0 -0
- {mcpcap-0.4.7.dist-info → mcpcap-0.5.2.dist-info}/top_level.txt +0 -0
mcpcap-0.4.7.dist-info/METADATA
DELETED
@@ -1,345 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: mcpcap
|
3
|
-
Version: 0.4.7
|
4
|
-
Summary: A modular Python MCP Server for analyzing PCAP files
|
5
|
-
Author: mcpcap contributors
|
6
|
-
License: MIT License
|
7
|
-
|
8
|
-
Copyright (c) 2025 danohn
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
|
28
|
-
Project-URL: Homepage, https://mcpcap.ai
|
29
|
-
Project-URL: Repository, https://github.com/mcpcap/mcpcap
|
30
|
-
Project-URL: Issues, https://github.com/mcpcap/mcpcap/issues
|
31
|
-
Keywords: pcap,network,analysis,mcp,dns
|
32
|
-
Classifier: Development Status :: 3 - Alpha
|
33
|
-
Classifier: Intended Audience :: Developers
|
34
|
-
Classifier: Intended Audience :: System Administrators
|
35
|
-
Classifier: License :: OSI Approved :: MIT License
|
36
|
-
Classifier: Programming Language :: Python :: 3
|
37
|
-
Classifier: Programming Language :: Python :: 3.10
|
38
|
-
Classifier: Programming Language :: Python :: 3.11
|
39
|
-
Classifier: Programming Language :: Python :: 3.12
|
40
|
-
Classifier: Topic :: System :: Networking :: Monitoring
|
41
|
-
Classifier: Topic :: Security
|
42
|
-
Requires-Python: >=3.10
|
43
|
-
Description-Content-Type: text/markdown
|
44
|
-
License-File: LICENSE
|
45
|
-
Requires-Dist: fastmcp~=2.12.2
|
46
|
-
Requires-Dist: scapy~=2.6.1
|
47
|
-
Requires-Dist: requests~=2.32.5
|
48
|
-
Provides-Extra: test
|
49
|
-
Requires-Dist: pytest; extra == "test"
|
50
|
-
Requires-Dist: pytest-cov; extra == "test"
|
51
|
-
Requires-Dist: setuptools-scm[toml]; extra == "test"
|
52
|
-
Provides-Extra: dev
|
53
|
-
Requires-Dist: setuptools-scm[toml]; extra == "dev"
|
54
|
-
Requires-Dist: build; extra == "dev"
|
55
|
-
Requires-Dist: twine; extra == "dev"
|
56
|
-
Requires-Dist: ruff; extra == "dev"
|
57
|
-
Provides-Extra: docs
|
58
|
-
Requires-Dist: sphinx>=7.0; extra == "docs"
|
59
|
-
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
60
|
-
Requires-Dist: myst-parser; extra == "docs"
|
61
|
-
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
62
|
-
Requires-Dist: sphinx-copybutton; extra == "docs"
|
63
|
-
Requires-Dist: linkify-it-py; extra == "docs"
|
64
|
-
Dynamic: license-file
|
65
|
-
|
66
|
-
# mcpcap
|
67
|
-
|
68
|
-
<!-- mcp-name: ai.mcpcap/mcpcap -->
|
69
|
-
|
70
|
-

|
71
|
-
|
72
|
-
A modular Python MCP (Model Context Protocol) Server for analyzing PCAP files. mcpcap enables LLMs to read and analyze network packet captures from local or remote sources, providing structured JSON responses about network traffic.
|
73
|
-
|
74
|
-
## Overview
|
75
|
-
|
76
|
-
mcpcap uses a modular architecture to analyze different network protocols found in PCAP files. Each module focuses on a specific protocol, allowing for targeted analysis and easy extensibility. The server leverages the powerful scapy library for packet parsing and analysis.
|
77
|
-
|
78
|
-
### Key Features
|
79
|
-
|
80
|
-
- **Modular Architecture**: Easily extensible to support new protocols
|
81
|
-
- **Local & Remote PCAP Support**: Read files from local directories or HTTP servers
|
82
|
-
- **Scapy Integration**: Leverages scapy's comprehensive packet parsing capabilities
|
83
|
-
- **MCP Server**: Integrates seamlessly with LLM clients via Model Context Protocol
|
84
|
-
- **JSON Responses**: Structured data format for easy LLM consumption
|
85
|
-
|
86
|
-
## Installation
|
87
|
-
|
88
|
-
mcpcap requires Python 3.10 or greater.
|
89
|
-
|
90
|
-
### Using pip
|
91
|
-
|
92
|
-
```bash
|
93
|
-
pip install mcpcap
|
94
|
-
```
|
95
|
-
|
96
|
-
### Using uv
|
97
|
-
|
98
|
-
```bash
|
99
|
-
uv add mcpcap
|
100
|
-
```
|
101
|
-
|
102
|
-
### Using uvx (for one-time usage)
|
103
|
-
|
104
|
-
```bash
|
105
|
-
uvx mcpcap
|
106
|
-
```
|
107
|
-
|
108
|
-
## Quick Start
|
109
|
-
|
110
|
-
1. **Start the MCP Server**:
|
111
|
-
|
112
|
-
**Local PCAP file:**
|
113
|
-
```bash
|
114
|
-
mcpcap --pcap-path /path/to/specific/file.pcap
|
115
|
-
```
|
116
|
-
|
117
|
-
**Local PCAP directory:**
|
118
|
-
```bash
|
119
|
-
mcpcap --pcap-path /path/to/pcap/files
|
120
|
-
```
|
121
|
-
|
122
|
-
**Remote PCAP file:**
|
123
|
-
```bash
|
124
|
-
mcpcap --pcap-url https://example.com/sample.pcap
|
125
|
-
```
|
126
|
-
|
127
|
-
**With advanced options:**
|
128
|
-
```bash
|
129
|
-
mcpcap --pcap-path /path/to/pcaps --max-packets 100 --protocols dns
|
130
|
-
```
|
131
|
-
|
132
|
-
2. **Connect your LLM client** to the MCP server
|
133
|
-
|
134
|
-
3. **Ask questions** about your network traffic:
|
135
|
-
- "What domain was queried the most in the DNS traffic?"
|
136
|
-
- "Show me all DNS queries for example.com"
|
137
|
-
- "What are the top 5 queried domains?"
|
138
|
-
|
139
|
-
## Modules
|
140
|
-
|
141
|
-
mcpcap supports multiple protocol analysis modules:
|
142
|
-
|
143
|
-
### DNS Module
|
144
|
-
|
145
|
-
The DNS module analyzes Domain Name System packets in PCAP files.
|
146
|
-
|
147
|
-
**Capabilities**:
|
148
|
-
|
149
|
-
- Extract DNS queries and responses
|
150
|
-
- Identify queried domains and subdomains
|
151
|
-
- Analyze query types (A, AAAA, MX, etc.)
|
152
|
-
- Track query frequency and patterns
|
153
|
-
- Identify DNS servers used
|
154
|
-
|
155
|
-
### DHCP Module
|
156
|
-
|
157
|
-
The DHCP module analyzes Dynamic Host Configuration Protocol packets in PCAP files.
|
158
|
-
|
159
|
-
**Capabilities**:
|
160
|
-
|
161
|
-
- Track DHCP transactions (DISCOVER, OFFER, REQUEST, ACK)
|
162
|
-
- Identify DHCP clients and servers
|
163
|
-
- Monitor IP address assignments and lease information
|
164
|
-
- Analyze DHCP options and configurations
|
165
|
-
- Detect DHCP anomalies and security issues
|
166
|
-
|
167
|
-
**Example Usage**:
|
168
|
-
|
169
|
-
```bash
|
170
|
-
# Analyze DHCP traffic only
|
171
|
-
mcpcap --pcap-path /path/to/dhcp.pcap --modules dhcp
|
172
|
-
|
173
|
-
# Analyze both DNS and DHCP
|
174
|
-
mcpcap --pcap-path /path/to/mixed.pcap --modules dns,dhcp
|
175
|
-
```
|
176
|
-
|
177
|
-
## Configuration
|
178
|
-
|
179
|
-
### PCAP Sources
|
180
|
-
|
181
|
-
mcpcap supports multiple ways to specify PCAP data sources:
|
182
|
-
|
183
|
-
**Local PCAP File**:
|
184
|
-
```bash
|
185
|
-
mcpcap --pcap-path /local/path/to/specific.pcap
|
186
|
-
```
|
187
|
-
|
188
|
-
**Local Directory**:
|
189
|
-
```bash
|
190
|
-
mcpcap --pcap-path /local/path/to/pcaps
|
191
|
-
```
|
192
|
-
|
193
|
-
**Remote PCAP File (Direct Link)**:
|
194
|
-
```bash
|
195
|
-
mcpcap --pcap-url https://wiki.wireshark.org/uploads/dns.cap
|
196
|
-
```
|
197
|
-
|
198
|
-
**Remote Directory Listing**:
|
199
|
-
```bash
|
200
|
-
mcpcap --pcap-url http://example.com/pcaps/
|
201
|
-
```
|
202
|
-
|
203
|
-
### Analysis Options
|
204
|
-
|
205
|
-
**Module Selection**:
|
206
|
-
```bash
|
207
|
-
# Single module
|
208
|
-
mcpcap --modules dns --pcap-path /path/to/files
|
209
|
-
|
210
|
-
# Multiple modules
|
211
|
-
mcpcap --modules dns,dhcp --pcap-path /path/to/files
|
212
|
-
```
|
213
|
-
|
214
|
-
**Protocol Selection** (automatically matches loaded modules):
|
215
|
-
```bash
|
216
|
-
# DNS analysis only
|
217
|
-
mcpcap --modules dns --pcap-path /path/to/files
|
218
|
-
|
219
|
-
# DHCP analysis only
|
220
|
-
mcpcap --modules dhcp --pcap-path /path/to/files
|
221
|
-
|
222
|
-
# Both DNS and DHCP analysis
|
223
|
-
mcpcap --modules dns,dhcp --pcap-path /path/to/files
|
224
|
-
```
|
225
|
-
|
226
|
-
**Packet Limiting** (for large files):
|
227
|
-
```bash
|
228
|
-
mcpcap --max-packets 1000 --pcap-path /path/to/files
|
229
|
-
```
|
230
|
-
|
231
|
-
**Combined Options**:
|
232
|
-
```bash
|
233
|
-
mcpcap --pcap-path /data/capture.pcap --max-packets 500 --modules dns,dhcp
|
234
|
-
```
|
235
|
-
|
236
|
-
## CLI Reference
|
237
|
-
|
238
|
-
```bash
|
239
|
-
mcpcap [--pcap-path PATH | --pcap-url URL] [OPTIONS]
|
240
|
-
```
|
241
|
-
|
242
|
-
**Source Options** (choose one):
|
243
|
-
- `--pcap-path PATH`: Local PCAP file or directory
|
244
|
-
- `--pcap-url URL`: Remote PCAP file URL or directory listing
|
245
|
-
|
246
|
-
**Analysis Options**:
|
247
|
-
- `--modules MODULES`: Comma-separated modules to load (default: dns)
|
248
|
-
- Available modules: `dns`, `dhcp`
|
249
|
-
- Protocols are automatically set to match loaded modules
|
250
|
-
- `--max-packets N`: Maximum packets to analyze per file (default: unlimited)
|
251
|
-
|
252
|
-
**Examples**:
|
253
|
-
```bash
|
254
|
-
# Analyze specific file
|
255
|
-
mcpcap --pcap-path ./capture.pcap
|
256
|
-
|
257
|
-
# Remote file with packet limit
|
258
|
-
mcpcap --pcap-url https://example.com/dns.cap --max-packets 100
|
259
|
-
|
260
|
-
# Directory with DHCP analysis
|
261
|
-
mcpcap --pcap-path /captures --modules dhcp
|
262
|
-
```
|
263
|
-
|
264
|
-
## Example
|
265
|
-
|
266
|
-
An example PCAP file (`dns.pcap`) containing DNS traffic is included in the `examples/` directory to help you get started.
|
267
|
-
|
268
|
-
## Architecture
|
269
|
-
|
270
|
-
mcpcap's modular design makes it easy to extend support for new protocols:
|
271
|
-
|
272
|
-
1. **Core Engine**: Handles PCAP file loading and basic packet processing
|
273
|
-
2. **Protocol Modules**: Individual modules for specific protocols (DNS, etc.)
|
274
|
-
3. **MCP Interface**: Translates between LLM queries and packet analysis results
|
275
|
-
4. **Output Formatter**: Converts analysis results to structured JSON
|
276
|
-
|
277
|
-
### Adding New Modules
|
278
|
-
|
279
|
-
New protocol modules can be added by:
|
280
|
-
|
281
|
-
1. Implementing the module interface
|
282
|
-
2. Defining scapy display filters for the protocol
|
283
|
-
3. Creating analysis functions specific to the protocol
|
284
|
-
4. Registering the module with the core engine
|
285
|
-
|
286
|
-
Future modules might include:
|
287
|
-
|
288
|
-
- BGP (Border Gateway Protocol)
|
289
|
-
- HTTP/HTTPS traffic analysis
|
290
|
-
- TCP connection tracking
|
291
|
-
- And more!
|
292
|
-
|
293
|
-
## Remote Access
|
294
|
-
|
295
|
-
mcpcap supports reading PCAP files from remote HTTP servers in two modes:
|
296
|
-
|
297
|
-
**Direct File Access**: Point directly to a PCAP file URL
|
298
|
-
```bash
|
299
|
-
mcpcap --pcap-url https://wiki.wireshark.org/uploads/__moin_import__/attachments/SampleCaptures/dns.cap
|
300
|
-
```
|
301
|
-
|
302
|
-
**Directory Listing**: Parse HTML directory listings to find PCAP files
|
303
|
-
```bash
|
304
|
-
mcpcap --pcap-url http://server.com/pcap-files/
|
305
|
-
```
|
306
|
-
|
307
|
-
**Supported File Types**: `.pcap`, `.pcapng`, `.cap`
|
308
|
-
|
309
|
-
**Current Limitations**:
|
310
|
-
- HTTP/HTTPS only (no authentication)
|
311
|
-
- Directory listings require standard HTML format
|
312
|
-
- Files are downloaded temporarily for analysis
|
313
|
-
|
314
|
-
Future versions may include support for Basic Authentication and other security mechanisms.
|
315
|
-
|
316
|
-
## Contributing
|
317
|
-
|
318
|
-
Contributions are welcome! Whether you want to:
|
319
|
-
|
320
|
-
- Add support for new protocols
|
321
|
-
- Improve existing modules
|
322
|
-
- Enhance the MCP interface
|
323
|
-
- Add new features
|
324
|
-
|
325
|
-
Please feel free to open issues and submit pull requests.
|
326
|
-
|
327
|
-
## License
|
328
|
-
|
329
|
-
MIT
|
330
|
-
|
331
|
-
## Requirements
|
332
|
-
|
333
|
-
- Python 3.10+
|
334
|
-
- scapy (packet parsing and analysis)
|
335
|
-
- requests (HTTP remote file access)
|
336
|
-
- fastmcp (MCP server framework)
|
337
|
-
- All dependencies are automatically installed via pip
|
338
|
-
|
339
|
-
## Documentation
|
340
|
-
|
341
|
-
Full documentation is available at [docs.mcpcap.ai](https://docs.mcpcap.ai)
|
342
|
-
|
343
|
-
## Support
|
344
|
-
|
345
|
-
For questions, issues, or feature requests, please open an issue on GitHub.
|
mcpcap-0.4.7.dist-info/RECORD
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
mcpcap/__init__.py,sha256=rJwCpBXkhIvmsqHFpeR33Vg8kuipNPJ2JdlAjsTk7I4,1408
|
2
|
-
mcpcap/_version.py,sha256=bMw6uwglOqmkUFrvfdK-z5tHdThMGDieeMecvwwhJXo,704
|
3
|
-
mcpcap/cli.py,sha256=nsHg-c72BrJaIUiVPoj-JWahQu8k0ldxYmWzbnljEBk,2448
|
4
|
-
mcpcap/core/__init__.py,sha256=WM5GTl06ZwwqHTPiKaYB-9hwOOXe3hyHG16FshwSsjE,127
|
5
|
-
mcpcap/core/config.py,sha256=WdHYu14Cvn9C3xs3KsQ-SVRru00IH86nQfnDL57V9zE,8190
|
6
|
-
mcpcap/core/server.py,sha256=H2ttfokMzW3vICxjCOFCoQTe78HHs-bGUxMd6i7rE1k,2011
|
7
|
-
mcpcap/modules/__init__.py,sha256=kA91h_-f7RE7pvEgcsQTZigDptK5v17-mbqTXZTRTK8,183
|
8
|
-
mcpcap/modules/base.py,sha256=3h8lGt6d6ob4SbgP6THC5PnTeMRcKfTGoJ9ZlZsQje0,826
|
9
|
-
mcpcap/modules/dhcp.py,sha256=3t9_2Tci5ZKhJlSMfgFbgCg44l5-0FKefAWoDZ_sY-Y,17251
|
10
|
-
mcpcap/modules/dns.py,sha256=cc77RxJOf-JxTLTCY8kfc_64uMawWKB3rjme9Q5H1pI,16632
|
11
|
-
mcpcap-0.4.7.dist-info/licenses/LICENSE,sha256=Ltj0zxftQyBYQMNva935v0i5QXQQOF8ygE8dQxGEtjk,1063
|
12
|
-
mcpcap-0.4.7.dist-info/METADATA,sha256=J4DGaVLyv5tgyBJ6OKpLYohYpNZoWgIZVkgrJuPxt4o,9982
|
13
|
-
mcpcap-0.4.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
14
|
-
mcpcap-0.4.7.dist-info/entry_points.txt,sha256=ck69gPBEopmU6mzQy9P6o6ssMr89bQbrvv51IaJ50Gc,39
|
15
|
-
mcpcap-0.4.7.dist-info/top_level.txt,sha256=YkRkVGjuM3nI7cVB1l8zIAeqiS_5_vrzbUcHNkH3OXE,7
|
16
|
-
mcpcap-0.4.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|