Protocol models describe structure — field types, dictionaries, message templates, optional sequences — so mutation stays semantic instead of pure random bytes. Built-in models cover common protocols; JSON models (feature json-model) and offline inference extend the surface without core changes.

Pipeline position

src/input/ — models feed the hierarchical mutator; integrity repair runs post-mutation, pre-encrypt. See Mutation and Integrity Repair.

Selecting a model

nexsiz -h 127.0.0.1 -p 21 -m ftp -s seeds/ftp -v
nexsiz -h 10.0.0.5 -p 53 -m dns -P tcp -v
nexsiz -h 10.0.0.5 -p 1883 -m mqtt -v
nexsiz -m models/custom-example.json -h 10.0.0.5 -p 9000 -v   # needs --features json-model

CLI: -m / --model. Config: model= or protocol_model=. Paths ending in .json or containing / are treated as file paths; bare names are lowercased built-ins.

Built-in models

NameNotesTypical integrity auto-map
ftpText commands, login sequencesftp (CRLF)
smtpText + DATA terminator awarenesssmtp
httpRequest structure, Content-Lengthhttp
dnsTCP length prefix + query layoutbinary
mqttFixed header, remaining length, CONNECT/PUBLISHbinary
smbBinary / CIFS-orientedbinary
binary-lpGeneric BE length-prefix + CRCbinary
binary-lp-leLittle-endian length-prefix variantbinary-le
genericMinimal structure; dictionary + opaque payloadsdefault

JSON model schema

Shipped examples: models/dns.json, models/mqtt.json, models/binary-lp.json, models/custom-example.json. Requires build feature json-model.

FieldDescription
nameModel identifier
length_prefixedWhether frames use length prefixes
length_width1 / 2 / 4 byte length fields
endianbe | le
delimiterOptional delimiter byte / null
checksume.g. crc32
dictionaryTokens (strings or \xNN escapes)
messages[]Named message specs with typed fields
desocketOptional reset sequences (see Snapshot & Desocket)

Field types in message specs

TypeRole
CommandOpcodes / verbs; high mutation weight
StringText payloads
Binary / PayloadOpaque bytes
NumericFixed-width numbers
LengthRepaired to match following payload size
ChecksumRepaired after length (CRC/XOR/etc.)
// models/binary-lp.json (excerpt)
{
  "name": "binary-lp",
  "length_prefixed": true,
  "length_width": 2,
  "endian": "be",
  "checksum": "crc32",
  "dictionary": ["\\x00", "\\xff", "\\x00\\x00", "\\xff\\xff"],
  "messages": [{
    "name": "frame",
    "fields": [
      { "name": "len", "type": "Length", "size": 2, "endian": "be" },
      { "name": "payload", "type": "Binary" },
      { "name": "crc", "type": "Checksum", "size": 4 }
    ]
  }]
}

Offline inference

Derive a model sketch from a seed directory without starting a campaign:

nexsiz --infer-model -s seeds/ftp -v
nexsiz --infer-model -s seeds/custom --infer-out models/inferred.json

Infers delimiter, length-prefix heuristics, endian, and dictionary tokens. With json-model, --infer-out writes JSON; otherwise a human-readable dump. Refine the result into a formal model before production campaigns.