From 2ab3f1fe9e761b9630c4840d6aadadd6aecf8c3c Mon Sep 17 00:00:00 2001 From: noisedestroyers Date: Mon, 28 Jul 2025 11:06:10 -0400 Subject: [PATCH] good layout --- analyzer/tui/textual/app_v2.py | 32 ++- .../tui/textual/styles/streamlens_v2.tcss | 12 +- analyzer/tui/textual/widgets/debug_panel.py | 69 +++++ analyzer/tui/textual/widgets/flow_table_v2.py | 14 +- .../tui/textual/widgets/split_flow_details.py | 77 +++++- debug.log | 237 ++++++++++++++++++ debug_flow.py | 61 +++++ 7 files changed, 482 insertions(+), 20 deletions(-) create mode 100644 analyzer/tui/textual/widgets/debug_panel.py create mode 100644 debug.log create mode 100644 debug_flow.py diff --git a/analyzer/tui/textual/app_v2.py b/analyzer/tui/textual/app_v2.py index e85eae5..46c52eb 100644 --- a/analyzer/tui/textual/app_v2.py +++ b/analyzer/tui/textual/app_v2.py @@ -20,6 +20,7 @@ from .widgets.sparkline import SparklineWidget from .widgets.metric_card import MetricCard from .widgets.flow_table_v2 import EnhancedFlowTable from .widgets.split_flow_details import FlowMainDetailsPanel, SubFlowDetailsPanel +from .widgets.debug_panel import DebugPanel if TYPE_CHECKING: from ...analysis.core import EthernetAnalyzer @@ -59,6 +60,7 @@ class StreamLensAppV2(App): bytes_per_sec = reactive(0.0) enhanced_flows = reactive(0) outlier_count = reactive(0) + debug_visible = reactive(False) # Hide debug panel for now # Update timers metric_timer: Timer = None @@ -90,7 +92,7 @@ class StreamLensAppV2(App): yield MetricCard("Enhanced", f"{self.enhanced_flows}", color="success", id="enhanced-metric") yield MetricCard("Outliers", f"{self.outlier_count}", color="warning" if self.outlier_count > 0 else "normal", id="outliers-metric") - # Main content area with 3 clean panels + # Main content area with conditional debug panel with Horizontal(id="content-area"): # Left - Enhanced flow table yield EnhancedFlowTable( @@ -99,15 +101,32 @@ class StreamLensAppV2(App): classes="panel-wide" ) - # Right top - Main flow details - with Vertical(id="right-panels"): + # Middle - Flow details + with Vertical(id="flow-panels"): yield FlowMainDetailsPanel(id="main-flow-details") yield SubFlowDetailsPanel(id="sub-flow-details") + + # Right - Debug panel (conditionally visible) + if self.debug_visible: + yield DebugPanel(id="debug-panel") yield Footer() def on_mount(self) -> None: """Initialize the application with TipTop-style updates""" + try: + debug_panel = self.query_one("#debug-panel", DebugPanel) + debug_panel.add_debug_message("APP: Application mounted, checking panels...") + + try: + main_panel = self.query_one("#main-flow-details", FlowMainDetailsPanel) + sub_panel = self.query_one("#sub-flow-details", SubFlowDetailsPanel) + debug_panel.add_debug_message("APP: Both panels found successfully") + except Exception as e: + debug_panel.add_debug_message(f"APP: Panel query failed: {e}") + except: + pass # Debug panel not visible + self.update_metrics() # Set up update intervals like TipTop @@ -239,6 +258,13 @@ class StreamLensAppV2(App): def on_enhanced_flow_table_flow_selected(self, event: EnhancedFlowTable.FlowSelected) -> None: """Handle flow selection events""" + try: + debug_panel = self.query_one("#debug-panel", DebugPanel) + flow_info = f"{event.flow.src_ip}:{event.flow.src_port}" if event.flow else "None" + debug_panel.add_debug_message(f"APP: Flow selected - {flow_info}, subflow={event.subflow_type}") + except: + pass # Debug panel not visible + if event.flow: # Update main flow details panel main_panel = self.query_one("#main-flow-details", FlowMainDetailsPanel) diff --git a/analyzer/tui/textual/styles/streamlens_v2.tcss b/analyzer/tui/textual/styles/streamlens_v2.tcss index e1be6be..c928583 100644 --- a/analyzer/tui/textual/styles/streamlens_v2.tcss +++ b/analyzer/tui/textual/styles/streamlens_v2.tcss @@ -60,9 +60,9 @@ MetricCard { padding: 0; } -/* Right Panels - Details (compact) */ -#right-panels { - width: 25%; +/* Flow Panels - Details (30% width) */ +#flow-panels { + width: 30%; background: #1a1a1a; padding: 0; } @@ -79,6 +79,12 @@ SubFlowDetailsPanel { border: solid #ff8800; } +/* Debug Panel - Fixed width when visible */ +#debug-panel { + width: 25%; + background: #1a1a1a; +} + /* Sparkline Charts */ SparklineWidget { height: 5; diff --git a/analyzer/tui/textual/widgets/debug_panel.py b/analyzer/tui/textual/widgets/debug_panel.py new file mode 100644 index 0000000..944e3c3 --- /dev/null +++ b/analyzer/tui/textual/widgets/debug_panel.py @@ -0,0 +1,69 @@ +""" +Debug Panel - Real-time debugging information in TUI +""" + +from textual.widget import Widget +from textual.containers import Vertical +from textual.widgets import Static +from rich.text import Text +from rich.console import RenderableType +from typing import Optional, List +from datetime import datetime + + +class DebugPanel(Vertical): + """Debug panel showing real-time flow selection and logic information""" + + DEFAULT_CSS = """ + DebugPanel { + height: 1fr; + padding: 1; + background: #1a1a1a; + border: solid #ff0080; + } + + DebugPanel Static { + margin-bottom: 0; + } + """ + + def __init__(self, **kwargs): + super().__init__(**kwargs) + self.debug_messages = [] + self.max_messages = 20 + + def compose(self): + """Create the debug panel layout""" + yield Static("DEBUG PANEL", classes="panel-header") + yield Static( + "Waiting for flow selection...", + id="debug-content" + ) + + def add_debug_message(self, message: str) -> None: + """Add a debug message with timestamp""" + timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3] + full_message = f"[{timestamp}] {message}" + + self.debug_messages.append(full_message) + if len(self.debug_messages) > self.max_messages: + self.debug_messages.pop(0) + + self._update_display() + + def _update_display(self) -> None: + """Update the debug display with recent messages""" + content_widget = self.query_one("#debug-content", Static) + + if not self.debug_messages: + content_widget.update("No debug messages yet...") + return + + # Show recent messages, newest at bottom + display_text = "\n".join(self.debug_messages[-15:]) # Show last 15 messages + content_widget.update(Text(display_text, style="white")) + + def clear_messages(self) -> None: + """Clear all debug messages""" + self.debug_messages.clear() + self._update_display() \ No newline at end of file diff --git a/analyzer/tui/textual/widgets/flow_table_v2.py b/analyzer/tui/textual/widgets/flow_table_v2.py index bd52085..d76f1f3 100644 --- a/analyzer/tui/textual/widgets/flow_table_v2.py +++ b/analyzer/tui/textual/widgets/flow_table_v2.py @@ -328,7 +328,7 @@ class EnhancedFlowTable(Vertical): subrows = [] combinations = self._get_protocol_frame_combinations(flow) - for extended_proto, frame_type, count, percentage in combinations[:3]: # Max 3 subrows + for extended_proto, frame_type, count, percentage in combinations: # Show all subrows # Calculate timing for this frame type if available frame_delta_t = "" frame_sigma = "" @@ -436,6 +436,18 @@ class EnhancedFlowTable(Vertical): """Handle row highlight to update selection""" selected_flow = self.get_selected_flow() subflow_type = self.get_selected_subflow_type() + + # Debug through app's debug panel + flow_info = f"{selected_flow.src_ip}:{selected_flow.src_port}" if selected_flow else "None" + table = self.query_one("#flows-data-table", DataTable) + current_row = table.cursor_row if table.cursor_row is not None else -1 + + try: + debug_panel = self.app.query_one("#debug-panel") + debug_panel.add_debug_message(f"TABLE: Row {current_row} - {flow_info}, subflow:{subflow_type}") + except: + pass # Debug panel might not be available yet + self.post_message(self.FlowSelected(selected_flow, subflow_type)) # Helper methods from original implementation diff --git a/analyzer/tui/textual/widgets/split_flow_details.py b/analyzer/tui/textual/widgets/split_flow_details.py index 01b9714..22eabf9 100644 --- a/analyzer/tui/textual/widgets/split_flow_details.py +++ b/analyzer/tui/textual/widgets/split_flow_details.py @@ -44,6 +44,13 @@ class FlowMainDetailsPanel(Vertical): def update_flow(self, flow: Optional['FlowStats']) -> None: """Update panel with main flow details""" + flow_info = f"{flow.src_ip}:{flow.src_port}" if flow else "None" + try: + debug_panel = self.app.query_one("#debug-panel") + debug_panel.add_debug_message(f"MAIN_PANEL: Update called - {flow_info}") + except: + pass + self.current_flow = flow content_widget = self.query_one("#main-details-content", Static) @@ -52,6 +59,14 @@ class FlowMainDetailsPanel(Vertical): return details = self._create_main_flow_details(flow) + + # Debug what content we're actually setting + try: + debug_panel = self.app.query_one("#debug-panel") + debug_panel.add_debug_message(f"CONTENT: Setting panel content for {flow.src_ip}:{flow.src_port}") + except: + pass + content_widget.update(details) def _create_main_flow_details(self, flow: 'FlowStats') -> RenderableType: @@ -91,21 +106,57 @@ class FlowMainDetailsPanel(Vertical): sections.append(Text("Enhanced Analysis", style="bold green")) sections.append(enhanced_table) - # Timing analysis with new columns - timing_table = Table(show_header=False, box=None, padding=0) - timing_table.add_column(style="dim", width=12) - timing_table.add_column() + # Timing analysis - only show if no sub-flows exist + # Match the same logic as _should_show_subrows in flow_table_v2.py + has_subflows = (len(flow.frame_types) > 1 or + flow.enhanced_analysis.decoder_type != "Standard") - timing_table.add_row("Duration:", f"{flow.duration:.2f}s") - timing_table.add_row("Avg ΔT:", f"{flow.avg_inter_arrival * 1000:.1f}ms") - timing_table.add_row("Std σ:", f"{flow.std_inter_arrival * 1000:.1f}ms") - timing_table.add_row("Outliers:", f"{len(flow.outlier_frames)}") - timing_table.add_row("Jitter:", f"{flow.jitter * 1000:.2f}ms") - timing_table.add_row("First Seen:", self._format_timestamp(flow.first_seen)) - timing_table.add_row("Last Seen:", self._format_timestamp(flow.last_seen)) + # Debug output + try: + debug_panel = self.app.query_one("#debug-panel") + debug_panel.add_debug_message(f"TIMING_LOGIC: {flow.src_ip}:{flow.src_port} - types={len(flow.frame_types)}, decoder={flow.enhanced_analysis.decoder_type}, has_subflows={has_subflows}") + except: + pass - sections.append(Text("Timing Analysis", style="bold cyan")) - sections.append(timing_table) + if not has_subflows: + try: + debug_panel = self.app.query_one("#debug-panel") + debug_panel.add_debug_message(f"BRANCH: Taking FULL timing branch for {flow.src_ip}:{flow.src_port}") + except: + pass + + timing_table = Table(show_header=False, box=None, padding=0) + timing_table.add_column(style="dim", width=12) + timing_table.add_column() + + timing_table.add_row("Duration:", f"{flow.duration:.2f}s") + timing_table.add_row("Avg ΔT:", f"{flow.avg_inter_arrival * 1000:.1f}ms") + timing_table.add_row("Std σ:", f"{flow.std_inter_arrival * 1000:.1f}ms") + timing_table.add_row("Outliers:", f"{len(flow.outlier_frames)}") + timing_table.add_row("Jitter:", f"{flow.jitter * 1000:.2f}ms") + timing_table.add_row("First Seen:", self._format_timestamp(flow.first_seen)) + timing_table.add_row("Last Seen:", self._format_timestamp(flow.last_seen)) + + sections.append(Text("Timing Analysis", style="bold cyan")) + sections.append(timing_table) + else: + try: + debug_panel = self.app.query_one("#debug-panel") + debug_panel.add_debug_message(f"BRANCH: Taking BASIC timeline branch for {flow.src_ip}:{flow.src_port}") + except: + pass + + # Just show duration and timestamps for flows with sub-flows + basic_timing_table = Table(show_header=False, box=None, padding=0) + basic_timing_table.add_column(style="dim", width=12) + basic_timing_table.add_column() + + basic_timing_table.add_row("Duration:", f"{flow.duration:.2f}s") + basic_timing_table.add_row("First Seen:", self._format_timestamp(flow.first_seen)) + basic_timing_table.add_row("Last Seen:", self._format_timestamp(flow.last_seen)) + + sections.append(Text("Flow Timeline", style="bold cyan")) + sections.append(basic_timing_table) return Group(*sections) diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..e3d703e --- /dev/null +++ b/debug.log @@ -0,0 +1,237 @@ +APP DEBUG: Application mounted, checking panels... +APP DEBUG: Both panels found successfully +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=CH10-Data +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=UDP +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=UDP +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=UDP +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=TMATS +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Signaling +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Sync +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Unknown (0x6) +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.202:5010 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.202:5010 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.202:5010 if flow else None +PANEL DEBUG: 11.59.19.202:5010 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.202:5010 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.202:5010 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.202:5010 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.202:5010 if flow else None +PANEL DEBUG: 11.59.19.202:5010 - frame_types=1, decoder=Standard, has_subflows=False +APP DEBUG: Flow selected event - flow=11.59.19.202:5010 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.202:5010 if flow else None +PANEL DEBUG: 11.59.19.202:5010 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61112 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:61112 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61112 if flow else None +PANEL DEBUG: 192.168.43.111:61112 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61113 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:61113 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61113 if flow else None +PANEL DEBUG: 192.168.43.111:61113 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:319 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:319 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:319 if flow else None +PANEL DEBUG: 192.168.4.89:319 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:0 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:0 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:0 if flow else None +PANEL DEBUG: 11.59.19.204:0 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:5353 if flow else None +PANEL DEBUG: 192.168.43.111:5353 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:5353 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:5353 if flow else None +PANEL DEBUG: 192.168.43.111:5353 - frame_types=1, decoder=Standard, has_subflows=False +APP DEBUG: Flow selected event - flow=192.168.43.111:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:5353 if flow else None +PANEL DEBUG: 192.168.43.111:5353 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 169.254.0.1:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=169.254.0.1:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 169.254.0.1:5353 if flow else None +PANEL DEBUG: 169.254.0.1:5353 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:5353 if flow else None +PANEL DEBUG: 192.168.43.111:5353 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:5353 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:5353 if flow else None +PANEL DEBUG: 192.168.43.111:5353 - frame_types=1, decoder=Standard, has_subflows=False +APP DEBUG: Flow selected event - flow=192.168.43.111:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:5353 if flow else None +PANEL DEBUG: 192.168.43.111:5353 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:0 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:0 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:0 if flow else None +PANEL DEBUG: 11.59.19.204:0 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:319 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:319 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:319 if flow else None +PANEL DEBUG: 192.168.4.89:319 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61113 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:61113 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61113 if flow else None +PANEL DEBUG: 192.168.43.111:61113 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61112 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:61112 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61112 if flow else None +PANEL DEBUG: 192.168.43.111:61112 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.202:5010 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.202:5010 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.202:5010 if flow else None +PANEL DEBUG: 11.59.19.202:5010 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Unknown (0x6) +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Sync +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Signaling +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=TMATS +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=UDP +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=CH10-Data +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=CH10-Data +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=CH10-Data +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=CH10-Data +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=CH10-Data +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=CH10-Data +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=UDP +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:49154 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:49154 if event.flow else None, subflow_type=TMATS +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:49154 if flow else None +PANEL DEBUG: 192.168.4.89:49154 - frame_types=10, decoder=Chapter10_Enhanced, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Signaling +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Sync +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:320 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:320 if event.flow else None, subflow_type=PTP-Unknown (0x6) +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:320 if flow else None +PANEL DEBUG: 11.59.19.204:320 - frame_types=3, decoder=Standard, has_subflows=True +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.202:5010 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.202:5010 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.202:5010 if flow else None +PANEL DEBUG: 11.59.19.202:5010 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61112 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:61112 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61112 if flow else None +PANEL DEBUG: 192.168.43.111:61112 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61112 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61112 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:61112 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61112 if flow else None +PANEL DEBUG: 192.168.43.111:61112 - frame_types=1, decoder=Standard, has_subflows=False +APP DEBUG: Flow selected event - flow=192.168.43.111:61112 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61112 if flow else None +PANEL DEBUG: 192.168.43.111:61112 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:61113 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:61113 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:61113 if flow else None +PANEL DEBUG: 192.168.43.111:61113 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.4.89:319 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.4.89:319 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.4.89:319 if flow else None +PANEL DEBUG: 192.168.4.89:319 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 11.59.19.204:0 if selected_flow else None +APP DEBUG: Flow selected event - flow=11.59.19.204:0 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 11.59.19.204:0 if flow else None +PANEL DEBUG: 11.59.19.204:0 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 192.168.43.111:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=192.168.43.111:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 192.168.43.111:5353 if flow else None +PANEL DEBUG: 192.168.43.111:5353 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 169.254.0.1:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=169.254.0.1:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 169.254.0.1:5353 if flow else None +PANEL DEBUG: 169.254.0.1:5353 - frame_types=1, decoder=Standard, has_subflows=False +TABLE DEBUG: Row highlighted, posting FlowSelected event for 169.254.0.1:5353 if selected_flow else None +TABLE DEBUG: Row highlighted, posting FlowSelected event for 169.254.0.1:5353 if selected_flow else None +APP DEBUG: Flow selected event - flow=169.254.0.1:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 169.254.0.1:5353 if flow else None +PANEL DEBUG: 169.254.0.1:5353 - frame_types=1, decoder=Standard, has_subflows=False +APP DEBUG: Flow selected event - flow=169.254.0.1:5353 if event.flow else None, subflow_type=None +UPDATE_FLOW DEBUG: Called with flow 169.254.0.1:5353 if flow else None +PANEL DEBUG: 169.254.0.1:5353 - frame_types=1, decoder=Standard, has_subflows=False diff --git a/debug_flow.py b/debug_flow.py new file mode 100644 index 0000000..3503d40 --- /dev/null +++ b/debug_flow.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +""" +Debug script to check flow data for the 192.168.7.168 source +""" + +import sys +sys.path.append('.') + +from analyzer.analysis.core import EthernetAnalyzer + +def debug_flow(): + analyzer = EthernetAnalyzer() + + # Load the sample file + pcap_file = "1 PTPGM.pcapng" + print(f"Loading {pcap_file}...") + + try: + analyzer.analyze_pcap(pcap_file) # Load the file + + # Find the flow with source 192.168.7.168 + target_flow = None + for flow in analyzer.flows.values(): + if flow.src_ip == "192.168.7.168": + target_flow = flow + break + + if not target_flow: + print("No flow found with source 192.168.7.168") + print("Available flows:") + for flow in analyzer.flows.values(): + print(f" {flow.src_ip}:{flow.src_port} -> {flow.dst_ip}:{flow.dst_port}") + return + + print(f"\n=== Flow: {target_flow.src_ip}:{target_flow.src_port} -> {target_flow.dst_ip}:{target_flow.dst_port} ===") + print(f"Frame types: {len(target_flow.frame_types)} types") + + if target_flow.frame_types: + for frame_type, stats in target_flow.frame_types.items(): + print(f" - {frame_type}: {stats.count} packets") + + print(f"Enhanced decoder: {target_flow.enhanced_analysis.decoder_type}") + + # Check the subflow logic + has_subflows_condition1 = len(target_flow.frame_types) > 1 + has_subflows_condition2 = target_flow.enhanced_analysis.decoder_type != "Standard" + has_subflows = has_subflows_condition1 or has_subflows_condition2 + + print(f"\nSubflow logic:") + print(f" Multiple frame types (>1): {has_subflows_condition1}") + print(f" Enhanced decoder (!='Standard'): {has_subflows_condition2}") + print(f" Should show subflows: {has_subflows}") + print(f" Should show timing in main panel: {not has_subflows}") + + except Exception as e: + print(f"Error: {e}") + import traceback + traceback.print_exc() + +if __name__ == "__main__": + debug_flow() \ No newline at end of file