feat: packet payload hex+ASCII viewer (#46)#69
Merged
NotYuSheng merged 2 commits intomainfrom Mar 28, 2026
Merged
Conversation
- DB migration V12: add payload TEXT column to packets - PcapParserService: extract raw frame bytes as lowercase hex (first 1024 bytes) in pcap4j path via extractPayloadHex(); tshark fallback leaves payload null - PacketEntity, PacketResponse, AnalysisService: propagate payload end-to-end - HexViewer component: renders offset / hex (split 8+8) / ASCII columns in a dark monospace panel with truncation notice - ConversationDetail: clickable packet rows expand inline HexViewer; ASCII badge shown on rows where >30% of bytes are printable ASCII - ConversationPage: detail view converted from split-panel to modal-xl; prev/next navigation with ←/→ arrow keys; ESC closes modal; backdrop click closes modal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to view packet payloads in a hex viewer within the conversation detail view. Changes include backend updates to store and serve the first 1024 bytes of packet data, a new database migration, and a frontend refactor that moves conversation details into a modal with keyboard navigation. Feedback focuses on improving performance in hex string conversion, fixing potential stale state issues in React hooks, addressing magic numbers and hardcoded styles, and ensuring proper error logging and UI alignment.
- PcapParserService: replace String.format hex loop with char[] lookup array for performance - ConversationPage: wrap handlePrev/handleNext in useCallback; remove eslint-disable; log error in catch block - ConversationDetail: extract 0.3 threshold into PRINTABLE_ASCII_THRESHOLD constant - HexViewer: move inline styles to HexViewer.css; fix hex column padding (48 not 49 chars) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
modal-xlwith prev/next navigation and keyboard shortcutsChanges
Backend
V12__add_payload_to_packets.sql— new migrationPcapParserService—extractPayloadHex()helper converts raw frame bytes to hex (capped at 1024 bytes); threaded throughprocessIpPacket→buildPacketInfo; tshark fallback leaves payload nullPacketEntity,PacketResponse,AnalysisService— payload field propagated end-to-endFrontend
HexViewer.tsx— new component rendering offset / hex (8+8 split) / ASCII columns in a dark monospace panel with a truncation noticeConversationDetail— clickable packet rows expandHexViewer; yellow ASCII badge on rows where >30% of bytes are printable ASCII; hint text in card headerConversationPage— split-panel replaced withmodal-xl; ←/→ arrow keys navigate prev/next; ESC or backdrop click closes; X/N counter in header; hint text on conversations cardTest plan
ftp.pcap— verify packet rows show ASCII badge and hex dump displays readable FTP commands/responses on clickCloses #46
🤖 Generated with Claude Code