Security tools

IPv4 / TCP / UDP header parser

Decode an IPv4 header, then its TCP or UDP header if the protocol field says so (checksum verified against the standard Internet checksum, not TCP/UDP's, which need a pseudo-header this tool is not given the source context to build). Give it bytes starting at the IP header, e.g. an Ethernet frame's payload.

Runs on your device. The file is never uploaded.

IPv4 / TCP / UDP header parser decodes raw bytes from the front of an IPv4 header, printing IHL, total length, fragment flags, TTL, protocol and both addresses. The RFC 1071 header checksum reads valid or INVALID, then TCP ports, sequence numbers and flags follow, or UDP ports and length. A version field other than 4 stops it.

Input

Questions

What do I feed it?

Raw bytes starting at the IPv4 header, for example the payload of an Ethernet frame. Not a pcap file, and not a hex dump as text. If what you have is a hex dump, convert it to bytes with the From hexdump tool first, then drop the result here.

What does it decode?

Version, IHL and header length, DSCP and ECN, total length, identification, the DF and MF flags, fragment offset, TTL, protocol number with a name for the common ones, and both addresses. When the protocol is TCP it adds ports, sequence and acknowledgement numbers, data offset, the eight flag bits and the window. When it is UDP it adds ports and length.

Does it verify the checksum?

The IPv4 header checksum, yes, using the standard Internet checksum from RFC 1071, reported as valid or INVALID. TCP and UDP checksums are not verified, because those cover a pseudo-header built from context this tool is not given. So an INVALID line points at the IP header itself, not at the payload.

Why did it refuse my bytes?

Three checks can fail. Fewer than 20 bytes gives a message naming the minimum and how many you gave. A version field that is not 4 is refused, with a note that IPv6 headers are not handled. And an IHL that claims a header longer than the bytes available is refused with both numbers.

Can it read a pcap capture?

No. It parses one header at a time from raw bytes, and a pcap file begins with its own global and per packet headers, which would be read as an IP header and rejected. Export the packet bytes from your capture tool, starting at the IP header, and drop those instead.

Related Security tools