#!/usr/bin/env python3
"""
Verify All 18 Wireshark MCP Tools
================================
This script verifies that all 18 tools are properly implemented and available:
- 8 Original tools from enhanced_server.py
- 10 Advanced tools from advanced_tools_implementation.py
"""
import asyncio
import inspect
from pathlib import Path
from typing import Dict, List
# Import all implementations
try:
from advanced_tools_implementation import (
WiresharkPCAPTimeSlicer,
WiresharkPCAPSplitter,
WiresharkPCAPMerger,
WiresharkHexToPCAP,
WiresharkHTTPAnalyzer,
WiresharkDNSAnalyzer,
WiresharkSSLInspector,
WiresharkLatencyProfiler,
WiresharkThreatDetector,
WiresharkRemoteCapture
)
advanced_tools_available = True
print("✅ Advanced tools implementation imported successfully")
except ImportError as e:
print(f"❌ Failed to import advanced tools: {e}")
advanced_tools_available = False
try:
from advanced_tools_integration import get_advanced_tool_definitions
integration_available = True
print("✅ Advanced tools integration imported successfully")
except ImportError as e:
print(f"❌ Failed to import integration: {e}")
integration_available = False
def verify_tool_classes():
"""Verify all 10 advanced tool classes are implemented."""
print("\n🔍 Verifying Advanced Tool Classes:")
print("=" * 50)
expected_classes = [
("PCAP Time Slicer", WiresharkPCAPTimeSlicer),
("PCAP Splitter", WiresharkPCAPSplitter),
("PCAP Merger", WiresharkPCAPMerger),
("Hex-to-PCAP Converter", WiresharkHexToPCAP),
("HTTP Deep Analyzer", WiresharkHTTPAnalyzer),
("DNS Query Analyzer", WiresharkDNSAnalyzer),
("SSL/TLS Inspector", WiresharkSSLInspector),
("Latency Profiler", WiresharkLatencyProfiler),
("Threat Detector", WiresharkThreatDetector),
("Remote Capture", WiresharkRemoteCapture)
]
for i, (name, cls) in enumerate(expected_classes, 1):
try:
# Check if class exists and can be instantiated
instance = cls()
methods = [method for method in dir(instance) if not method.startswith('_') and callable(getattr(instance, method))]
print(f"{i:2d}. ✅ {name:<25} - {len(methods)} methods")
except Exception as e:
print(f"{i:2d}. ❌ {name:<25} - Error: {e}")
return len(expected_classes)
def verify_mcp_tool_definitions():
"""Verify all 10 MCP tool definitions are available."""
print("\n🔍 Verifying MCP Tool Definitions:")
print("=" * 50)
if not integration_available:
print("❌ Integration module not available")
return 0
try:
advanced_tools = get_advanced_tool_definitions()
print(f"✅ Found {len(advanced_tools)} advanced tool definitions:")
expected_names = [
"wireshark_pcap_time_slice",
"wireshark_pcap_split",
"wireshark_pcap_merge",
"wireshark_hex_to_pcap",
"wireshark_http_analyze",
"wireshark_dns_analyze",
"wireshark_ssl_inspect",
"wireshark_latency_profile",
"wireshark_threat_detect",
"wireshark_remote_capture"
]
for i, tool_name in enumerate(expected_names, 1):
found = any(tool.name == tool_name for tool in advanced_tools)
status = "✅" if found else "❌"
print(f"{i:2d}. {status} {tool_name}")
return len(advanced_tools)
except Exception as e:
print(f"❌ Error getting tool definitions: {e}")
return 0
def verify_original_tools():
"""Verify the 8 original tools are documented."""
print("\n🔍 Original Tools (from enhanced_server.py):")
print("=" * 50)
original_tools = [
"wireshark_system_info",
"wireshark_validate_setup",
"wireshark_generate_filter",
"wireshark_live_capture",
"wireshark_analyze_pcap",
"wireshark_realtime_json_capture",
"wireshark_protocol_statistics",
"wireshark_analyze_pcap_enhanced"
]
for i, tool_name in enumerate(original_tools, 1):
print(f"{i}. ✅ {tool_name}")
return len(original_tools)
def verify_file_structure():
"""Verify all required files exist."""
print("\n🔍 Verifying File Structure:")
print("=" * 50)
required_files = [
"advanced_tools_implementation.py",
"advanced_tools_integration.py",
"enhanced_server.py",
"enhanced_server_v3.py",
"WIRESHARK_ADVANCED_TOOLS_IMPLEMENTATION.md",
"ADVANCED_TOOLS_INTEGRATION_COMPLETE.md"
]
base_path = Path(__file__).parent
files_found = 0
for file_name in required_files:
file_path = base_path / file_name
if file_path.exists():
size = file_path.stat().st_size
print(f"✅ {file_name:<40} ({size:,} bytes)")
files_found += 1
else:
print(f"❌ {file_name:<40} (missing)")
return files_found, len(required_files)
async def run_verification():
"""Run complete verification."""
print("🦈 Wireshark MCP Tools Verification")
print("=" * 60)
# Verify tool classes
advanced_classes = verify_tool_classes()
# Verify MCP definitions
mcp_definitions = verify_mcp_tool_definitions()
# Verify original tools
original_count = verify_original_tools()
# Verify files
files_found, files_total = verify_file_structure()
# Summary
print("\n📊 VERIFICATION SUMMARY")
print("=" * 60)
print(f"Advanced Tool Classes: {advanced_classes}/10")
print(f"MCP Tool Definitions: {mcp_definitions}/10")
print(f"Original Tools: {original_count}/8")
print(f"Required Files: {files_found}/{files_total}")
total_tools = original_count + advanced_classes
print(f"\n🎯 TOTAL TOOLS AVAILABLE: {total_tools}/18")
if total_tools == 18 and files_found == files_total:
print("\n🎉 SUCCESS: All 18 tools are properly implemented!")
print(" ✅ 8 Original tools")
print(" ✅ 10 Advanced tools")
print(" ✅ Full MCP integration ready")
print(" ✅ All documentation complete")
else:
print(f"\n⚠️ INCOMPLETE: {18 - total_tools} tools missing or {files_total - files_found} files missing")
if __name__ == "__main__":
asyncio.run(run_verification())