Description
Problem Description
Mitmproxy currently lacks support for reassembling TCP messages fragmented across multiple packets. This limitation hinders detailed analysis and modification of TCP sessions, especially for protocols where messages are split across multiple TCP segments. For accurate inspection of data flows, it’s essential to view complete TCP messages as they are sent over the wire. Specifically, many protocols use a length field or message delimiter to mark the start and end of messages, but fragmented packets can disrupt this structure, complicating inspection and modification.
Proposal
Introduce TCP message reassembly in mitmproxy, with support for reassembly based on both length fields and message delimiters. This enhancement would enable mitmproxy to detect the start and end of messages within TCP streams, reassembling them across multiple packets when necessary. By using either a specified length field or a predefined message delimiter, mitmproxy can reconstruct complete messages, making it easier to analyze and manipulate the full content of TCP sessions without losing context due to packet fragmentation.
Additional context
Adding support for TCP message reassembly based on length fields and message delimiters would make mitmproxy a more versatile tool for protocol analysis, especially for custom or proprietary protocols relying on raw TCP streams. This enhancement would cater to advanced debugging needs, enabling more detailed session reconstruction and modification capabilities for low-level TCP data.