CCSDS_study project

This commit is contained in:
2026-05-05 21:54:35 +08:00
commit 9be41f9270
585 changed files with 91275 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
import os
from netzob.all import (Automata, OpenChannelTransition,
Protocol, State)
# Load symbols from ZDL file
path = os.path.dirname(os.path.realpath(__file__))
format_zdl = os.path.join(path, "UDP_format.zdl")
symbols = Protocol.load_format(format_zdl)
# Specify the states
s0 = State(name="Initial state")
s1 = State(name="Channel opened")
# s2 = State(name="Channel closed")
# Specify the transitions
openTransition = OpenChannelTransition(startState=s0, endState=s1, name="Open")
# closeTransition = CloseChannelTransition(startState=s1,
# endState=s2,
# name="Closed")
# Specify the main automaton structure
automata = Automata(s0, list(symbols.values()))

View File

@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
from bitarray import bitarray
from netzob.all import (AbstractType, UnitSize, BitArray, Field, uint16,
InternetChecksum, IPv4, Raw, Size, Symbol)
# Reference: https://www.ietf.org/rfc/rfc768.txt
# UDP header fields
udp_sport = Field(uint16(), "udp.sport")
udp_dport = Field(uint16(), "udp.dport")
udp_length = Field(bitarray('0000000000000000'), "udp.length")
udp_checksum = Field(bitarray('0000000000000000'), "udp.checksum")
udp_payload = Field(Raw(), "udp.payload")
udp_header = [udp_sport, udp_dport, udp_length, udp_checksum, udp_payload]
# Update UDP length field
udp_length.domain = Size(udp_header, dataType=uint16(), factor=1./8)
# Pseudo IP header to compute the UDP checksum
pseudo_ip_src = Field(IPv4(), "udp.pseudoIP.saddr")
pseudo_ip_dst = Field(IPv4(), "udp.pseudoIP.daddr")
pseudo_ip_proto = Field(Raw(b'\x00\x11'), "udp.pseudoIP.proto")
pseudo_ip_length = Field(Size(udp_header, dataType=uint16(), factor=1./8), "udp.pseudoIP.length")
pseudo_ip_header = Field(name="udp.pseudoIP", isPseudoField=True)
pseudo_ip_header.fields = [pseudo_ip_src, pseudo_ip_dst, pseudo_ip_proto, pseudo_ip_length]
udp_checksum.domain = InternetChecksum([pseudo_ip_header] + udp_header, dataType=Raw(nbBytes=2, unitSize=UnitSize.SIZE_16))
# UDP symbol
symbol_udp = Symbol(name="udp", fields=(udp_header + [pseudo_ip_header]))
symbols = [symbol_udp]

View File

@@ -0,0 +1,13 @@
The life that I have
Is all that I have
And the life that I have
Is yours.
The love that I have
Of the life that I have
Is yours and yours and yours.
A sleep I shall have
A rest I shall have
Yet death will be but a pause.
For the peace of my years
In the long green grass
Will be yours and yours and yours.