working to analyze timing issues
This commit is contained in:
45
analyzer/models/analysis_results.py
Normal file
45
analyzer/models/analysis_results.py
Normal file
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
Analysis result containers and summary structures
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, Any, List, Set
|
||||
from .flow_stats import FlowStats
|
||||
|
||||
|
||||
@dataclass
|
||||
class AnalysisResult:
|
||||
"""Container for complete analysis results"""
|
||||
total_packets: int
|
||||
unique_flows: int
|
||||
unique_ips: int
|
||||
flows: Dict[tuple, FlowStats]
|
||||
|
||||
def get_summary(self) -> Dict[str, Any]:
|
||||
"""Get analysis summary dictionary"""
|
||||
unique_ips = set()
|
||||
for flow in self.flows.values():
|
||||
unique_ips.add(flow.src_ip)
|
||||
unique_ips.add(flow.dst_ip)
|
||||
|
||||
return {
|
||||
'total_packets': self.total_packets,
|
||||
'unique_flows': len(self.flows),
|
||||
'unique_ips': len(unique_ips),
|
||||
'flows': self.flows
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class DissectionResult:
|
||||
"""Container for packet dissection results"""
|
||||
frame_number: int
|
||||
timestamp: float
|
||||
size: int
|
||||
layers: Dict[str, Any]
|
||||
protocols: List[str]
|
||||
errors: List[str] = None
|
||||
|
||||
def __post_init__(self):
|
||||
if self.errors is None:
|
||||
self.errors = []
|
||||
Reference in New Issue
Block a user