diff --git a/example.yml b/example.yml new file mode 100644 index 0000000..406a447 --- /dev/null +++ b/example.yml @@ -0,0 +1,70 @@ +# Example YAML protocol structure + +protocol: &tcp + name: TCP + fields: + - + field: source port + length: 2 + - + field: destination port + length: 2 + - + field: sequence number + length: 4 + - + field: acknowledgment number + length: 4 + - + field: data offset + bitfield: yes + length: 4 + - + field: reserved + bitfield: yes + length: 6 + - + field: URG + bitfield: yes + length: 1 + - + field: ACK + bitfield: yes + length: 1 + - + field: PSH + bitfield: yes + length: 1 + - + field: RST + bitfield: yes + length: 1 + - + field: SYN + bitfield: yes + length: 1 + - + field: FIN + bitfield: yes + length: 1 + - + field: window + length: 2 + - + field: checksum + length: 2 + - + field: options + length: 4 + optional: true + repeatable: true + - + field: data + length: 0 + data: true + osilayer: 4 + + + + + diff --git a/protocols/osi1-2/eth-frame.yml b/protocols/osi1-2/eth-frame.yml new file mode 100644 index 0000000..893b40a --- /dev/null +++ b/protocols/osi1-2/eth-frame.yml @@ -0,0 +1,45 @@ +#Ethernet +--- +protocol: ð + name: eth + osilayer: 2 + fields: + - + field: destination MAC + length: 6 + - + field: source MAC + length: 6 + - + field: vlan tag + length: 4 + subfields: + - + field: tag protocol identifier (0x8100) + length: 2 + - + field: tag control information + length: 2 + subfields: + - + field: priority code point (PCP) + bitfield: yes + length: 3 + - + field: drop eligible indicator (DEI) + bitfield: yes + length: 1 + - + field: VLAN identifier (VID) + bitfield: yes + length: 12 + - + field: Ethertype (Eth II) or length (IEEE 802.3) + length: 2 + - + field: data + length: 0 + data: true + - + field: FCS (32-bit CRC) + length: 4 diff --git a/protocols/osi4/tcp.yml b/protocols/osi4/tcp.yml new file mode 100644 index 0000000..ddff1ad --- /dev/null +++ b/protocols/osi4/tcp.yml @@ -0,0 +1,64 @@ +--- +protocol: &tcp + name: TCP + fields: + - + field: source port + length: 2 + - + field: destination port + length: 2 + - + field: sequence number + length: 4 + - + field: acknowledgment number + length: 4 + - + field: data offset + bitfield: yes + length: 4 + - + field: reserved + bitfield: yes + length: 6 + - + field: URG + bitfield: yes + length: 1 + - + field: ACK + bitfield: yes + length: 1 + - + field: PSH + bitfield: yes + length: 1 + - + field: RST + bitfield: yes + length: 1 + - + field: SYN + bitfield: yes + length: 1 + - + field: FIN + bitfield: yes + length: 1 + - + field: window + length: 2 + - + field: checksum + length: 2 + - + field: options + length: 4 + optional: true + repeatable: true + - + field: data + length: 0 + data: true + osilayer: 4 diff --git a/structure-schema.yml b/structure-schema.yml new file mode 100644 index 0000000..7bdcac7 --- /dev/null +++ b/structure-schema.yml @@ -0,0 +1,36 @@ +type: map +mapping: + "protocol": + type: map + required: yes + mapping: + "name": + type: str + required: yes + "fields": + type: seq + required: yes + sequence: &fieldsseq + - type: map + mapping: + "field": + type: str + required: yes + "length": #length in bytes, except bitfield is set to true! + type: int + required: yes + "bitfield": #if this is true length is in BITS! + type: bool + "optional": + type: bool + "repeatable": + type: bool + "data": #data placeholder for next layer (length should be 0!) + type: bool + "subfields": + type: seq + sequence: *fieldsseq + "osilayer": + type: int + range: { max: 7, min: 1 } + required: yes