LLabelFen
Product

Product features · Backward-pointer DNS names

01

Review dns_name.py for the distinction between consumed packet bytes and labels reached through compression pointers.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Backward-pointer DNS names

● ● ●LabelFen●
A concrete starting point · Backward-pointer DNS names ×
def dns_name(data, offset):
    if type(data) is not bytes or len(data) > 65535 or type(offset) is not int or not 0 <= offset < len(data):
        raise ValueError("dns.input")
    labels, seen, pos, end, size = [], set(), offset, None, 1
    while True:
        if pos in seen or pos >= len(data):
            raise ValueError("dns.pointer")
        seen.add(pos)
        count = data[pos]
        if count & 192 == 192:
            if pos+1 >= len(data):
                raise ValueError("dns.truncated")
            target = ((count & 63) << 8) | data[pos+1]
            if target >= pos:
                raise ValueError("dns.forward")
            if end is None:
                end = pos+2
            pos = target
            continue
        if count & 192 or pos+1+count > len(data):
            raise ValueError("dns.label")
        pos += 1
        if count == 0:
            return labels, pos if end is None else end
        size += count+1
        if size > 255:
            raise ValueError("dns.length")
        labels.append(data[pos:pos+count])
        pos += count
✳Backward-pointer DNS names
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗