@netkitty/codec 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +352 -0
- package/README.zh-CN.md +342 -0
- package/dist/Codec.d.ts +133 -0
- package/dist/Codec.js +632 -0
- package/dist/PacketHeaders.d.ts +189 -0
- package/dist/PacketHeaders.js +384 -0
- package/dist/abstracts/BaseHeader.d.ts +325 -0
- package/dist/abstracts/BaseHeader.js +734 -0
- package/dist/errors/CodecSchemaValidateError.d.ts +4 -0
- package/dist/errors/CodecSchemaValidateError.js +11 -0
- package/dist/headers/ADSAMS.d.ts +33 -0
- package/dist/headers/ADSAMS.js +208 -0
- package/dist/headers/AH.d.ts +28 -0
- package/dist/headers/AH.js +137 -0
- package/dist/headers/AMQP.d.ts +31 -0
- package/dist/headers/AMQP.js +316 -0
- package/dist/headers/ARP.d.ts +26 -0
- package/dist/headers/ARP.js +243 -0
- package/dist/headers/BACnetIP.d.ts +27 -0
- package/dist/headers/BACnetIP.js +97 -0
- package/dist/headers/BFD.d.ts +28 -0
- package/dist/headers/BFD.js +155 -0
- package/dist/headers/BGP.d.ts +27 -0
- package/dist/headers/BGP.js +111 -0
- package/dist/headers/BSAPIP.d.ts +33 -0
- package/dist/headers/BSAPIP.js +78 -0
- package/dist/headers/Babel.d.ts +32 -0
- package/dist/headers/Babel.js +224 -0
- package/dist/headers/BitTorrent.d.ts +28 -0
- package/dist/headers/BitTorrent.js +72 -0
- package/dist/headers/C37118.d.ts +26 -0
- package/dist/headers/C37118.js +147 -0
- package/dist/headers/CAPWAP.d.ts +38 -0
- package/dist/headers/CAPWAP.js +275 -0
- package/dist/headers/CDP.d.ts +25 -0
- package/dist/headers/CDP.js +117 -0
- package/dist/headers/CMS.d.ts +33 -0
- package/dist/headers/CMS.js +238 -0
- package/dist/headers/COTP.d.ts +30 -0
- package/dist/headers/COTP.js +193 -0
- package/dist/headers/CassandraCQL.d.ts +28 -0
- package/dist/headers/CassandraCQL.js +117 -0
- package/dist/headers/CoAP.d.ts +29 -0
- package/dist/headers/CoAP.js +140 -0
- package/dist/headers/Codesys.d.ts +32 -0
- package/dist/headers/Codesys.js +119 -0
- package/dist/headers/Collectd.d.ts +29 -0
- package/dist/headers/Collectd.js +154 -0
- package/dist/headers/DCCP.d.ts +30 -0
- package/dist/headers/DCCP.js +204 -0
- package/dist/headers/DHCP.d.ts +26 -0
- package/dist/headers/DHCP.js +148 -0
- package/dist/headers/DHCPFailover.d.ts +30 -0
- package/dist/headers/DHCPFailover.js +104 -0
- package/dist/headers/DHCPv6.d.ts +25 -0
- package/dist/headers/DHCPv6.js +145 -0
- package/dist/headers/DNP3.d.ts +27 -0
- package/dist/headers/DNP3.js +150 -0
- package/dist/headers/DNS.d.ts +55 -0
- package/dist/headers/DNS.js +309 -0
- package/dist/headers/DTLS.d.ts +33 -0
- package/dist/headers/DTLS.js +142 -0
- package/dist/headers/Diameter.d.ts +34 -0
- package/dist/headers/Diameter.js +229 -0
- package/dist/headers/EAPOL.d.ts +32 -0
- package/dist/headers/EAPOL.js +135 -0
- package/dist/headers/EIGRP.d.ts +28 -0
- package/dist/headers/EIGRP.js +165 -0
- package/dist/headers/ENIP.d.ts +31 -0
- package/dist/headers/ENIP.js +164 -0
- package/dist/headers/ESP.d.ts +27 -0
- package/dist/headers/ESP.js +140 -0
- package/dist/headers/Elasticsearch.d.ts +30 -0
- package/dist/headers/Elasticsearch.js +125 -0
- package/dist/headers/EtherCAT.d.ts +35 -0
- package/dist/headers/EtherCAT.js +150 -0
- package/dist/headers/EthernetII.d.ts +28 -0
- package/dist/headers/EthernetII.js +117 -0
- package/dist/headers/FCoE.d.ts +38 -0
- package/dist/headers/FCoE.js +210 -0
- package/dist/headers/FTP.d.ts +34 -0
- package/dist/headers/FTP.js +158 -0
- package/dist/headers/Finger.d.ts +41 -0
- package/dist/headers/Finger.js +135 -0
- package/dist/headers/FoundationFieldbusHSE.d.ts +43 -0
- package/dist/headers/FoundationFieldbusHSE.js +163 -0
- package/dist/headers/GELF.d.ts +35 -0
- package/dist/headers/GELF.js +261 -0
- package/dist/headers/GENEVE.d.ts +26 -0
- package/dist/headers/GENEVE.js +209 -0
- package/dist/headers/GESRTP.d.ts +32 -0
- package/dist/headers/GESRTP.js +141 -0
- package/dist/headers/GLBP.d.ts +29 -0
- package/dist/headers/GLBP.js +159 -0
- package/dist/headers/GRE.d.ts +27 -0
- package/dist/headers/GRE.js +181 -0
- package/dist/headers/GTPU.d.ts +25 -0
- package/dist/headers/GTPU.js +203 -0
- package/dist/headers/GTPv2C.d.ts +30 -0
- package/dist/headers/GTPv2C.js +281 -0
- package/dist/headers/GitProtocol.d.ts +34 -0
- package/dist/headers/GitProtocol.js +141 -0
- package/dist/headers/Goose.d.ts +115 -0
- package/dist/headers/Goose.js +1067 -0
- package/dist/headers/Gopher.d.ts +43 -0
- package/dist/headers/Gopher.js +182 -0
- package/dist/headers/HARTIP.d.ts +30 -0
- package/dist/headers/HARTIP.js +145 -0
- package/dist/headers/HSR.d.ts +27 -0
- package/dist/headers/HSR.js +105 -0
- package/dist/headers/HSRP.d.ts +26 -0
- package/dist/headers/HSRP.js +173 -0
- package/dist/headers/HTTP.d.ts +32 -0
- package/dist/headers/HTTP.js +153 -0
- package/dist/headers/HTTP2.d.ts +34 -0
- package/dist/headers/HTTP2.js +190 -0
- package/dist/headers/IAX2.d.ts +33 -0
- package/dist/headers/IAX2.js +274 -0
- package/dist/headers/ICMP.d.ts +15 -0
- package/dist/headers/ICMP.js +148 -0
- package/dist/headers/ICMPv6.d.ts +15 -0
- package/dist/headers/ICMPv6.js +129 -0
- package/dist/headers/IEC104_I_Frame.d.ts +23 -0
- package/dist/headers/IEC104_I_Frame.js +6489 -0
- package/dist/headers/IEC104_S_Frame.d.ts +26 -0
- package/dist/headers/IEC104_S_Frame.js +135 -0
- package/dist/headers/IEC104_U_Frame.d.ts +27 -0
- package/dist/headers/IEC104_U_Frame.js +176 -0
- package/dist/headers/IEC61850SampledValues.d.ts +20 -0
- package/dist/headers/IEC61850SampledValues.js +420 -0
- package/dist/headers/IGMP.d.ts +31 -0
- package/dist/headers/IGMP.js +274 -0
- package/dist/headers/IMAP.d.ts +32 -0
- package/dist/headers/IMAP.js +185 -0
- package/dist/headers/IPFIX.d.ts +29 -0
- package/dist/headers/IPFIX.js +156 -0
- package/dist/headers/IPv4.d.ts +20 -0
- package/dist/headers/IPv4.js +370 -0
- package/dist/headers/IPv6.d.ts +29 -0
- package/dist/headers/IPv6.js +209 -0
- package/dist/headers/IPv6HopByHopOptions.d.ts +81 -0
- package/dist/headers/IPv6HopByHopOptions.js +495 -0
- package/dist/headers/IRC.d.ts +34 -0
- package/dist/headers/IRC.js +175 -0
- package/dist/headers/ISAKMP.d.ts +29 -0
- package/dist/headers/ISAKMP.js +197 -0
- package/dist/headers/ISCSI.d.ts +39 -0
- package/dist/headers/ISCSI.js +289 -0
- package/dist/headers/ISIS.d.ts +25 -0
- package/dist/headers/ISIS.js +79 -0
- package/dist/headers/ISOSession.d.ts +27 -0
- package/dist/headers/ISOSession.js +343 -0
- package/dist/headers/Ident.d.ts +42 -0
- package/dist/headers/Ident.js +184 -0
- package/dist/headers/KNXnetIP.d.ts +30 -0
- package/dist/headers/KNXnetIP.js +135 -0
- package/dist/headers/Kafka.d.ts +35 -0
- package/dist/headers/Kafka.js +128 -0
- package/dist/headers/Kerberos.d.ts +30 -0
- package/dist/headers/Kerberos.js +217 -0
- package/dist/headers/L2TP.d.ts +26 -0
- package/dist/headers/L2TP.js +297 -0
- package/dist/headers/LACP.d.ts +31 -0
- package/dist/headers/LACP.js +151 -0
- package/dist/headers/LDAP.d.ts +31 -0
- package/dist/headers/LDAP.js +226 -0
- package/dist/headers/LDP.d.ts +31 -0
- package/dist/headers/LDP.js +138 -0
- package/dist/headers/LISP.d.ts +30 -0
- package/dist/headers/LISP.js +103 -0
- package/dist/headers/LLC.d.ts +27 -0
- package/dist/headers/LLC.js +81 -0
- package/dist/headers/LLDP.d.ts +26 -0
- package/dist/headers/LLDP.js +126 -0
- package/dist/headers/LLMNR.d.ts +23 -0
- package/dist/headers/LLMNR.js +40 -0
- package/dist/headers/LPD.d.ts +31 -0
- package/dist/headers/LPD.js +159 -0
- package/dist/headers/MACsec.d.ts +34 -0
- package/dist/headers/MACsec.js +178 -0
- package/dist/headers/MDNS.d.ts +26 -0
- package/dist/headers/MDNS.js +45 -0
- package/dist/headers/MGCP.d.ts +30 -0
- package/dist/headers/MGCP.js +155 -0
- package/dist/headers/MMS.d.ts +29 -0
- package/dist/headers/MMS.js +243 -0
- package/dist/headers/MPLS.d.ts +31 -0
- package/dist/headers/MPLS.js +145 -0
- package/dist/headers/MQTT.d.ts +30 -0
- package/dist/headers/MQTT.js +173 -0
- package/dist/headers/MQTTSN.d.ts +34 -0
- package/dist/headers/MQTTSN.js +177 -0
- package/dist/headers/MarkerProtocol.d.ts +32 -0
- package/dist/headers/MarkerProtocol.js +153 -0
- package/dist/headers/Megaco.d.ts +32 -0
- package/dist/headers/Megaco.js +144 -0
- package/dist/headers/Memcached.d.ts +44 -0
- package/dist/headers/Memcached.js +285 -0
- package/dist/headers/ModbusTCP.d.ts +25 -0
- package/dist/headers/ModbusTCP.js +99 -0
- package/dist/headers/ModbusUDP.d.ts +26 -0
- package/dist/headers/ModbusUDP.js +100 -0
- package/dist/headers/MongoDB.d.ts +33 -0
- package/dist/headers/MongoDB.js +143 -0
- package/dist/headers/MySQL.d.ts +30 -0
- package/dist/headers/MySQL.js +114 -0
- package/dist/headers/NATS.d.ts +29 -0
- package/dist/headers/NATS.js +135 -0
- package/dist/headers/NBDS.d.ts +34 -0
- package/dist/headers/NBDS.js +176 -0
- package/dist/headers/NBNS.d.ts +34 -0
- package/dist/headers/NBNS.js +78 -0
- package/dist/headers/NBSS.d.ts +36 -0
- package/dist/headers/NBSS.js +137 -0
- package/dist/headers/NFS.d.ts +36 -0
- package/dist/headers/NFS.js +273 -0
- package/dist/headers/NHRP.d.ts +32 -0
- package/dist/headers/NHRP.js +154 -0
- package/dist/headers/NNTP.d.ts +35 -0
- package/dist/headers/NNTP.js +162 -0
- package/dist/headers/NTP.d.ts +18 -0
- package/dist/headers/NTP.js +73 -0
- package/dist/headers/NetFlowV5.d.ts +28 -0
- package/dist/headers/NetFlowV5.js +205 -0
- package/dist/headers/OLSR.d.ts +31 -0
- package/dist/headers/OLSR.js +213 -0
- package/dist/headers/OPCUA.d.ts +33 -0
- package/dist/headers/OPCUA.js +165 -0
- package/dist/headers/OPCUAPubSub.d.ts +33 -0
- package/dist/headers/OPCUAPubSub.js +144 -0
- package/dist/headers/OSPF.d.ts +31 -0
- package/dist/headers/OSPF.js +365 -0
- package/dist/headers/OmronFINS.d.ts +31 -0
- package/dist/headers/OmronFINS.js +90 -0
- package/dist/headers/OpenFlow.d.ts +30 -0
- package/dist/headers/OpenFlow.js +113 -0
- package/dist/headers/OpenVPN.d.ts +35 -0
- package/dist/headers/OpenVPN.js +214 -0
- package/dist/headers/PCWorx.d.ts +35 -0
- package/dist/headers/PCWorx.js +115 -0
- package/dist/headers/PIM.d.ts +27 -0
- package/dist/headers/PIM.js +129 -0
- package/dist/headers/POP3.d.ts +31 -0
- package/dist/headers/POP3.js +152 -0
- package/dist/headers/POWERLINK.d.ts +28 -0
- package/dist/headers/POWERLINK.js +116 -0
- package/dist/headers/PPPoEDiscovery.d.ts +29 -0
- package/dist/headers/PPPoEDiscovery.js +198 -0
- package/dist/headers/PPPoESession.d.ts +28 -0
- package/dist/headers/PPPoESession.js +125 -0
- package/dist/headers/PPTP.d.ts +30 -0
- package/dist/headers/PPTP.js +122 -0
- package/dist/headers/PROFINETRT.d.ts +28 -0
- package/dist/headers/PROFINETRT.js +74 -0
- package/dist/headers/PTP.d.ts +34 -0
- package/dist/headers/PTP.js +213 -0
- package/dist/headers/PostgreSQL.d.ts +40 -0
- package/dist/headers/PostgreSQL.js +236 -0
- package/dist/headers/QUIC.d.ts +34 -0
- package/dist/headers/QUIC.js +308 -0
- package/dist/headers/RADIUS.d.ts +24 -0
- package/dist/headers/RADIUS.js +138 -0
- package/dist/headers/RDP.d.ts +27 -0
- package/dist/headers/RDP.js +93 -0
- package/dist/headers/RFB.d.ts +39 -0
- package/dist/headers/RFB.js +151 -0
- package/dist/headers/RGoose.d.ts +72 -0
- package/dist/headers/RGoose.js +340 -0
- package/dist/headers/RIP.d.ts +29 -0
- package/dist/headers/RIP.js +133 -0
- package/dist/headers/RIPng.d.ts +26 -0
- package/dist/headers/RIPng.js +140 -0
- package/dist/headers/RMCP.d.ts +26 -0
- package/dist/headers/RMCP.js +155 -0
- package/dist/headers/RSVP.d.ts +31 -0
- package/dist/headers/RSVP.js +263 -0
- package/dist/headers/RTCP.d.ts +34 -0
- package/dist/headers/RTCP.js +217 -0
- package/dist/headers/RTP.d.ts +33 -0
- package/dist/headers/RTP.js +291 -0
- package/dist/headers/RTPS.d.ts +33 -0
- package/dist/headers/RTPS.js +182 -0
- package/dist/headers/RTSP.d.ts +36 -0
- package/dist/headers/RTSP.js +184 -0
- package/dist/headers/RawData.d.ts +17 -0
- package/dist/headers/RawData.js +43 -0
- package/dist/headers/Redis.d.ts +32 -0
- package/dist/headers/Redis.js +202 -0
- package/dist/headers/Rlogin.d.ts +42 -0
- package/dist/headers/Rlogin.js +139 -0
- package/dist/headers/Rsync.d.ts +28 -0
- package/dist/headers/Rsync.js +117 -0
- package/dist/headers/S7comm.d.ts +36 -0
- package/dist/headers/S7comm.js +244 -0
- package/dist/headers/SCTP.d.ts +35 -0
- package/dist/headers/SCTP.js +174 -0
- package/dist/headers/SFlow.d.ts +29 -0
- package/dist/headers/SFlow.js +242 -0
- package/dist/headers/SIP.d.ts +27 -0
- package/dist/headers/SIP.js +146 -0
- package/dist/headers/SLMP.d.ts +36 -0
- package/dist/headers/SLMP.js +154 -0
- package/dist/headers/SLP.d.ts +30 -0
- package/dist/headers/SLP.js +207 -0
- package/dist/headers/SLPv1.d.ts +32 -0
- package/dist/headers/SLPv1.js +138 -0
- package/dist/headers/SMB1.d.ts +37 -0
- package/dist/headers/SMB1.js +200 -0
- package/dist/headers/SMB2.d.ts +36 -0
- package/dist/headers/SMB2.js +203 -0
- package/dist/headers/SMPP.d.ts +33 -0
- package/dist/headers/SMPP.js +119 -0
- package/dist/headers/SMTP.d.ts +33 -0
- package/dist/headers/SMTP.js +157 -0
- package/dist/headers/SNAP.d.ts +22 -0
- package/dist/headers/SNAP.js +68 -0
- package/dist/headers/SNMP.d.ts +28 -0
- package/dist/headers/SNMP.js +302 -0
- package/dist/headers/SOCKS4.d.ts +42 -0
- package/dist/headers/SOCKS4.js +302 -0
- package/dist/headers/SOCKS5.d.ts +45 -0
- package/dist/headers/SOCKS5.js +223 -0
- package/dist/headers/SSDP.d.ts +27 -0
- package/dist/headers/SSDP.js +161 -0
- package/dist/headers/SSH.d.ts +44 -0
- package/dist/headers/SSH.js +274 -0
- package/dist/headers/STOMP.d.ts +48 -0
- package/dist/headers/STOMP.js +177 -0
- package/dist/headers/STP.d.ts +26 -0
- package/dist/headers/STP.js +150 -0
- package/dist/headers/STUN.d.ts +25 -0
- package/dist/headers/STUN.js +183 -0
- package/dist/headers/SercosIII.d.ts +43 -0
- package/dist/headers/SercosIII.js +199 -0
- package/dist/headers/Skinny.d.ts +32 -0
- package/dist/headers/Skinny.js +139 -0
- package/dist/headers/StatsD.d.ts +27 -0
- package/dist/headers/StatsD.js +134 -0
- package/dist/headers/SunRPC.d.ts +34 -0
- package/dist/headers/SunRPC.js +268 -0
- package/dist/headers/Syslog.d.ts +21 -0
- package/dist/headers/Syslog.js +91 -0
- package/dist/headers/TCP.d.ts +19 -0
- package/dist/headers/TCP.js +905 -0
- package/dist/headers/TFTP.d.ts +28 -0
- package/dist/headers/TFTP.js +224 -0
- package/dist/headers/TLS_Alert.d.ts +24 -0
- package/dist/headers/TLS_Alert.js +639 -0
- package/dist/headers/TLS_ApplicationData.d.ts +24 -0
- package/dist/headers/TLS_ApplicationData.js +170 -0
- package/dist/headers/TLS_ChangeCipherSpec.d.ts +23 -0
- package/dist/headers/TLS_ChangeCipherSpec.js +168 -0
- package/dist/headers/TLS_Handshake.d.ts +65 -0
- package/dist/headers/TLS_Handshake.js +860 -0
- package/dist/headers/TLS_Heartbeat.d.ts +27 -0
- package/dist/headers/TLS_Heartbeat.js +247 -0
- package/dist/headers/TPKT.d.ts +26 -0
- package/dist/headers/TPKT.js +99 -0
- package/dist/headers/TacacsPlus.d.ts +27 -0
- package/dist/headers/TacacsPlus.js +133 -0
- package/dist/headers/Telnet.d.ts +40 -0
- package/dist/headers/Telnet.js +193 -0
- package/dist/headers/Teredo.d.ts +40 -0
- package/dist/headers/Teredo.js +251 -0
- package/dist/headers/TimeProtocol.d.ts +25 -0
- package/dist/headers/TimeProtocol.js +53 -0
- package/dist/headers/UDP.d.ts +19 -0
- package/dist/headers/UDP.js +171 -0
- package/dist/headers/VLAN_802dot1Q.d.ts +24 -0
- package/dist/headers/VLAN_802dot1Q.js +96 -0
- package/dist/headers/VRRP.d.ts +26 -0
- package/dist/headers/VRRP.js +309 -0
- package/dist/headers/VXLAN.d.ts +24 -0
- package/dist/headers/VXLAN.js +75 -0
- package/dist/headers/WCCP.d.ts +29 -0
- package/dist/headers/WCCP.js +117 -0
- package/dist/headers/WHOIS.d.ts +37 -0
- package/dist/headers/WHOIS.js +126 -0
- package/dist/headers/WSDiscovery.d.ts +29 -0
- package/dist/headers/WSDiscovery.js +118 -0
- package/dist/headers/WakeOnLAN.d.ts +30 -0
- package/dist/headers/WakeOnLAN.js +126 -0
- package/dist/headers/WebSocket.d.ts +26 -0
- package/dist/headers/WebSocket.js +173 -0
- package/dist/headers/WireGuard.d.ts +38 -0
- package/dist/headers/WireGuard.js +216 -0
- package/dist/headers/XMPP.d.ts +37 -0
- package/dist/headers/XMPP.js +149 -0
- package/dist/headers/Zabbix.d.ts +35 -0
- package/dist/headers/Zabbix.js +153 -0
- package/dist/headers/cms/AcsiPdu.d.ts +45 -0
- package/dist/headers/cms/AcsiPdu.js +112 -0
- package/dist/headers/cms/PerDecoder.d.ts +68 -0
- package/dist/headers/cms/PerDecoder.js +211 -0
- package/dist/headers/cms/PerReader.d.ts +64 -0
- package/dist/headers/cms/PerReader.js +155 -0
- package/dist/helper/BufferToHex.d.ts +5 -0
- package/dist/helper/BufferToHex.js +10 -0
- package/dist/helper/BufferToIP.d.ts +12 -0
- package/dist/helper/BufferToIP.js +23 -0
- package/dist/helper/BufferToNumber.d.ts +18 -0
- package/dist/helper/BufferToNumber.js +47 -0
- package/dist/helper/HexToBuffer.d.ts +7 -0
- package/dist/helper/HexToBuffer.js +27 -0
- package/dist/helper/HexToNumber.d.ts +18 -0
- package/dist/helper/HexToNumber.js +48 -0
- package/dist/helper/IPToBuffer.d.ts +12 -0
- package/dist/helper/IPToBuffer.js +34 -0
- package/dist/helper/NumberToBERBuffer.d.ts +18 -0
- package/dist/helper/NumberToBERBuffer.js +31 -0
- package/dist/helper/NumberToBERHex.d.ts +18 -0
- package/dist/helper/NumberToBERHex.js +52 -0
- package/dist/helper/NumberToBuffer.d.ts +18 -0
- package/dist/helper/NumberToBuffer.js +38 -0
- package/dist/helper/NumberToHex.d.ts +18 -0
- package/dist/helper/NumberToHex.js +35 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +113 -0
- package/dist/lib/FlexibleObject.d.ts +27 -0
- package/dist/lib/FlexibleObject.js +113 -0
- package/dist/lib/GetBERIntegerLengthFromBuffer.d.ts +6 -0
- package/dist/lib/GetBERIntegerLengthFromBuffer.js +16 -0
- package/dist/lib/ProcessPacketPostHandlers.d.ts +13 -0
- package/dist/lib/ProcessPacketPostHandlers.js +53 -0
- package/dist/lib/SortPostHandlers.d.ts +7 -0
- package/dist/lib/SortPostHandlers.js +11 -0
- package/dist/lib/StringContentEncodingEnum.d.ts +10 -0
- package/dist/lib/StringContentEncodingEnum.js +14 -0
- package/dist/schema/ProtocolFieldJSONSchema.d.ts +35 -0
- package/dist/schema/ProtocolFieldJSONSchema.js +2 -0
- package/dist/schema/ProtocolFieldJSONSchemaDefinition.d.ts +2 -0
- package/dist/schema/ProtocolFieldJSONSchemaDefinition.js +2 -0
- package/dist/schema/ProtocolJSONSchema.d.ts +32 -0
- package/dist/schema/ProtocolJSONSchema.js +2 -0
- package/dist/types/CodecData.d.ts +7 -0
- package/dist/types/CodecData.js +2 -0
- package/dist/types/CodecDecodeResult.d.ts +10 -0
- package/dist/types/CodecDecodeResult.js +2 -0
- package/dist/types/CodecEncodeInput.d.ts +2 -0
- package/dist/types/CodecEncodeInput.js +2 -0
- package/dist/types/CodecEncodeResult.d.ts +5 -0
- package/dist/types/CodecEncodeResult.js +2 -0
- package/dist/types/CodecErrorInfo.d.ts +5 -0
- package/dist/types/CodecErrorInfo.js +2 -0
- package/dist/types/CodecModule.d.ts +2 -0
- package/dist/types/CodecModule.js +2 -0
- package/dist/types/CodecModuleConstructor.d.ts +2 -0
- package/dist/types/CodecModuleConstructor.js +2 -0
- package/dist/types/CodecSchema.d.ts +6 -0
- package/dist/types/CodecSchema.js +2 -0
- package/dist/types/DemuxProducer.d.ts +23 -0
- package/dist/types/DemuxProducer.js +2 -0
- package/dist/types/Dissection.d.ts +23 -0
- package/dist/types/Dissection.js +2 -0
- package/dist/types/HeaderTreeNode.d.ts +4 -0
- package/dist/types/HeaderTreeNode.js +2 -0
- package/dist/types/LayerGraph.d.ts +32 -0
- package/dist/types/LayerGraph.js +2 -0
- package/dist/types/PostHandlerItem.d.ts +4 -0
- package/dist/types/PostHandlerItem.js +2 -0
- package/package.json +141 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* TFTP — Trivial File Transfer Protocol (RFC 1350, options RFC 2347). Each message starts with a
|
|
6
|
+
* 2-byte opcode: RRQ(1)/WRQ(2) = filename + mode (both null-terminated) + optional name/value options;
|
|
7
|
+
* DATA(3) = block-number(2) + data; ACK(4) = block-number(2); ERROR(5) = error-code(2) + message
|
|
8
|
+
* (null-terminated); OACK(6) = name/value options.
|
|
9
|
+
*
|
|
10
|
+
* Only the initial RRQ/WRQ rides the well-known UDP port 69; the ensuing DATA/ACK transfer moves to a
|
|
11
|
+
* server-chosen ephemeral port (a TID), so those packets are a stateful conversation that belongs to
|
|
12
|
+
* the reassembly/conversation layer, not this single-packet, port-69 codec. The codec decodes every
|
|
13
|
+
* opcode structurally (so a DATA/ACK reached by other means still parses), but demux only claims
|
|
14
|
+
* port-69 traffic. Strings are kept verbatim (latin1) and re-emitted with their null terminator; DATA
|
|
15
|
+
* payload is kept as raw hex — so a well-formed message round-trips byte-for-byte. (A truncated string
|
|
16
|
+
* missing its RFC-mandated null terminator is malformed: it decodes best-effort but re-emits with the
|
|
17
|
+
* terminator, so it is not byte-perfect — the byte-perfect guarantee is for standard-conformant TFTP.)
|
|
18
|
+
*/
|
|
19
|
+
export declare class TFTP extends BaseHeader {
|
|
20
|
+
#private;
|
|
21
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly nickname: string;
|
|
25
|
+
readonly matchKeys: string[];
|
|
26
|
+
match(): boolean;
|
|
27
|
+
readonly demuxProducers: DemuxProducer[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TFTP = void 0;
|
|
4
|
+
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
5
|
+
const BufferToHex_1 = require("../helper/BufferToHex");
|
|
6
|
+
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
7
|
+
const BufferToNumber_1 = require("../helper/BufferToNumber");
|
|
8
|
+
const NumberToBuffer_1 = require("../helper/NumberToBuffer");
|
|
9
|
+
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
10
|
+
/**
|
|
11
|
+
* TFTP — Trivial File Transfer Protocol (RFC 1350, options RFC 2347). Each message starts with a
|
|
12
|
+
* 2-byte opcode: RRQ(1)/WRQ(2) = filename + mode (both null-terminated) + optional name/value options;
|
|
13
|
+
* DATA(3) = block-number(2) + data; ACK(4) = block-number(2); ERROR(5) = error-code(2) + message
|
|
14
|
+
* (null-terminated); OACK(6) = name/value options.
|
|
15
|
+
*
|
|
16
|
+
* Only the initial RRQ/WRQ rides the well-known UDP port 69; the ensuing DATA/ACK transfer moves to a
|
|
17
|
+
* server-chosen ephemeral port (a TID), so those packets are a stateful conversation that belongs to
|
|
18
|
+
* the reassembly/conversation layer, not this single-packet, port-69 codec. The codec decodes every
|
|
19
|
+
* opcode structurally (so a DATA/ACK reached by other means still parses), but demux only claims
|
|
20
|
+
* port-69 traffic. Strings are kept verbatim (latin1) and re-emitted with their null terminator; DATA
|
|
21
|
+
* payload is kept as raw hex — so a well-formed message round-trips byte-for-byte. (A truncated string
|
|
22
|
+
* missing its RFC-mandated null terminator is malformed: it decodes best-effort but re-emits with the
|
|
23
|
+
* terminator, so it is not byte-perfect — the byte-perfect guarantee is for standard-conformant TFTP.)
|
|
24
|
+
*/
|
|
25
|
+
class TFTP extends BaseHeader_1.BaseHeader {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.id = 'tftp';
|
|
29
|
+
this.name = 'Trivial File Transfer Protocol';
|
|
30
|
+
this.nickname = 'TFTP';
|
|
31
|
+
//Only the initial RRQ/WRQ uses the well-known port 69; the DATA/ACK transfer moves to an ephemeral
|
|
32
|
+
//TID (a stateful conversation for the reassembly layer), so demux claims port 69 only.
|
|
33
|
+
this.matchKeys = ['udpport:69'];
|
|
34
|
+
//A leaf header — nothing demuxes above TFTP.
|
|
35
|
+
this.demuxProducers = [];
|
|
36
|
+
}
|
|
37
|
+
static #schemaCache;
|
|
38
|
+
get SCHEMA() {
|
|
39
|
+
return (TFTP.#schemaCache ??= TFTP.#buildSchema());
|
|
40
|
+
}
|
|
41
|
+
/** The payload length bounded by the UDP datagram (so a retained FCS/padding is not absorbed). */
|
|
42
|
+
#payloadLength() {
|
|
43
|
+
let available = this.packet.length - this.startPos;
|
|
44
|
+
if (this.prevCodecModule && this.prevCodecModule.id === 'udp') {
|
|
45
|
+
const udpLength = this.prevCodecModule.instance.length.getValue(0);
|
|
46
|
+
if (udpLength >= 8 && udpLength - 8 < available)
|
|
47
|
+
available = udpLength - 8;
|
|
48
|
+
}
|
|
49
|
+
return available < 0 ? 0 : available;
|
|
50
|
+
}
|
|
51
|
+
/** Read a null-terminated string at `offset` (bounded by `available`); returns it plus the offset past the terminator. */
|
|
52
|
+
#readCString(offset, available) {
|
|
53
|
+
let p = offset;
|
|
54
|
+
while (p < available && this.readBytes(p, 1, true)[0] !== 0)
|
|
55
|
+
p++;
|
|
56
|
+
const value = p > offset ? this.readBytes(offset, p - offset).toString('latin1') : '';
|
|
57
|
+
let next = p;
|
|
58
|
+
if (p < available) {
|
|
59
|
+
this.readBytes(p, 1); //consume the null terminator (extends headerLength)
|
|
60
|
+
next = p + 1;
|
|
61
|
+
}
|
|
62
|
+
return { value: value, next: next };
|
|
63
|
+
}
|
|
64
|
+
/** Read a run of null-terminated name/value option pairs from `offset` to `available`. */
|
|
65
|
+
#readOptions(offset, available) {
|
|
66
|
+
const options = [];
|
|
67
|
+
let o = offset;
|
|
68
|
+
while (o < available) {
|
|
69
|
+
const name = this.#readCString(o, available);
|
|
70
|
+
if (name.next >= available && name.value === '')
|
|
71
|
+
break;
|
|
72
|
+
const value = this.#readCString(name.next, available);
|
|
73
|
+
options.push({ name: name.value, value: value.value });
|
|
74
|
+
o = value.next;
|
|
75
|
+
}
|
|
76
|
+
return { options: options, next: o };
|
|
77
|
+
}
|
|
78
|
+
#writeCString(offset, value) {
|
|
79
|
+
const bytes = Buffer.from(value ? value : '', 'latin1');
|
|
80
|
+
this.writeBytes(offset, bytes);
|
|
81
|
+
this.writeBytes(offset + bytes.length, Buffer.from([0]));
|
|
82
|
+
return offset + bytes.length + 1;
|
|
83
|
+
}
|
|
84
|
+
static #buildSchema() {
|
|
85
|
+
return {
|
|
86
|
+
type: 'object',
|
|
87
|
+
summary: 'TFTP opcode=${opcode}',
|
|
88
|
+
properties: {
|
|
89
|
+
//Opcode-driven layout, so the whole message is parsed/emitted here; the fields below
|
|
90
|
+
//carry only schema metadata and are populated per opcode.
|
|
91
|
+
opcode: {
|
|
92
|
+
type: 'integer',
|
|
93
|
+
label: 'Opcode',
|
|
94
|
+
minimum: 0,
|
|
95
|
+
maximum: 65535,
|
|
96
|
+
decode: function () {
|
|
97
|
+
const available = this.#payloadLength();
|
|
98
|
+
if (available < 2) {
|
|
99
|
+
//Too short to hold even the 2-byte opcode. match() already prevents claiming
|
|
100
|
+
//such a payload; seed a valid (schema-shaped) instance defensively so the
|
|
101
|
+
//decode result is always re-encodable (never an undefined-data layer).
|
|
102
|
+
this.instance.opcode.setValue(0);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const opcode = (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(0, 2));
|
|
106
|
+
this.instance.opcode.setValue(opcode);
|
|
107
|
+
let offset = 2;
|
|
108
|
+
switch (opcode) {
|
|
109
|
+
case 1:
|
|
110
|
+
case 2: {
|
|
111
|
+
const filename = this.#readCString(offset, available);
|
|
112
|
+
const mode = this.#readCString(filename.next, available);
|
|
113
|
+
this.instance.filename.setValue(filename.value);
|
|
114
|
+
this.instance.mode.setValue(mode.value);
|
|
115
|
+
this.instance.options.setValue(this.#readOptions(mode.next, available).options);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case 3: {
|
|
119
|
+
this.instance.block.setValue(available >= 4 ? (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(offset, 2)) : 0);
|
|
120
|
+
offset += 2;
|
|
121
|
+
this.instance.data.setValue(offset < available ? (0, BufferToHex_1.BufferToHex)(this.readBytes(offset, available - offset)) : '');
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case 4: {
|
|
125
|
+
this.instance.block.setValue(available >= 4 ? (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(offset, 2)) : 0);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 5: {
|
|
129
|
+
this.instance.errorCode.setValue(available >= 4 ? (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(offset, 2)) : 0);
|
|
130
|
+
offset += 2;
|
|
131
|
+
this.instance.errorMessage.setValue(this.#readCString(offset, available).value);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case 6: {
|
|
135
|
+
this.instance.options.setValue(this.#readOptions(offset, available).options);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
default: {
|
|
139
|
+
//Unknown opcode: keep the body verbatim for a byte-perfect round-trip.
|
|
140
|
+
this.instance.rawBody.setValue(offset < available ? (0, BufferToHex_1.BufferToHex)(this.readBytes(offset, available - offset)) : '');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
encode: function () {
|
|
145
|
+
const opcode = this.instance.opcode.getValue(0);
|
|
146
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(opcode));
|
|
147
|
+
let offset = 2;
|
|
148
|
+
switch (opcode) {
|
|
149
|
+
case 1:
|
|
150
|
+
case 2: {
|
|
151
|
+
offset = this.#writeCString(offset, this.instance.filename.getValue(''));
|
|
152
|
+
offset = this.#writeCString(offset, this.instance.mode.getValue(''));
|
|
153
|
+
const options = this.instance.options.getValue([]);
|
|
154
|
+
if (options)
|
|
155
|
+
for (const option of options) {
|
|
156
|
+
offset = this.#writeCString(offset, option.name ? option.name : '');
|
|
157
|
+
offset = this.#writeCString(offset, option.value ? option.value : '');
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case 3: {
|
|
162
|
+
this.writeBytes(offset, (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.block.getValue(0)));
|
|
163
|
+
offset += 2;
|
|
164
|
+
const data = (0, HexToBuffer_1.HexToBuffer)(this.instance.data.getValue(''));
|
|
165
|
+
if (data.length)
|
|
166
|
+
this.writeBytes(offset, data);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case 4: {
|
|
170
|
+
this.writeBytes(offset, (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.block.getValue(0)));
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
case 5: {
|
|
174
|
+
this.writeBytes(offset, (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.errorCode.getValue(0)));
|
|
175
|
+
offset += 2;
|
|
176
|
+
this.#writeCString(offset, this.instance.errorMessage.getValue(''));
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
case 6: {
|
|
180
|
+
const options = this.instance.options.getValue([]);
|
|
181
|
+
if (options)
|
|
182
|
+
for (const option of options) {
|
|
183
|
+
offset = this.#writeCString(offset, option.name ? option.name : '');
|
|
184
|
+
offset = this.#writeCString(offset, option.value ? option.value : '');
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
default: {
|
|
189
|
+
const rawBody = this.instance.rawBody.getValue('');
|
|
190
|
+
if (rawBody)
|
|
191
|
+
this.writeBytes(offset, (0, HexToBuffer_1.HexToBuffer)(rawBody));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
filename: { type: 'string', label: 'File Name' },
|
|
197
|
+
mode: { type: 'string', label: 'Mode' },
|
|
198
|
+
block: { type: 'integer', label: 'Block Number', minimum: 0, maximum: 65535 },
|
|
199
|
+
errorCode: { type: 'integer', label: 'Error Code', minimum: 0, maximum: 65535 },
|
|
200
|
+
errorMessage: { type: 'string', label: 'Error Message' },
|
|
201
|
+
data: { type: 'string', label: 'Data', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX },
|
|
202
|
+
options: {
|
|
203
|
+
type: 'array',
|
|
204
|
+
label: 'Options',
|
|
205
|
+
items: {
|
|
206
|
+
type: 'object',
|
|
207
|
+
label: 'Option',
|
|
208
|
+
properties: {
|
|
209
|
+
name: { type: 'string', label: 'Name' },
|
|
210
|
+
value: { type: 'string', label: 'Value' }
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
rawBody: { type: 'string', label: 'Body', contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX, hidden: true }
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
match() {
|
|
219
|
+
//Require at least the 2-byte opcode within the UDP payload — a shorter datagram on port 69 is
|
|
220
|
+
//not a TFTP message and must fall through to raw (rather than claim an un-decodable layer).
|
|
221
|
+
return !!this.prevCodecModule && this.prevCodecModule.id === 'udp' && this.#payloadLength() >= 2;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
exports.TFTP = TFTP;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
2
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
+
/**
|
|
4
|
+
* TLS Alert protocol — a TLS/SSL record carrying an alert, over TCP (heuristically, port 443). This codec
|
|
5
|
+
* decodes the 5-octet TLS record header followed by the 2-octet alert body: an 8-bit Content Type
|
|
6
|
+
* (`contentType`, offset 0, = 21 for Alert), a 16-bit legacy Version (`version`, offset 1, mapped to the
|
|
7
|
+
* labels SSL3.0 / TLS1.0 / TLS1.1 / TLS1.2 / TLS1.3 for 0x0300-0x0304, else "0"), a 16-bit record Length
|
|
8
|
+
* (`length`, offset 3), then the AlertLevel (`levelType`, offset 5; 1 Warning, 2 Fatal, else the numeric
|
|
9
|
+
* value) and the AlertDescription (`descriptionType`, offset 6; mapped to a named string for each defined
|
|
10
|
+
* code — Close notify, Handshake failure, Bad certificate, … — else the numeric value).
|
|
11
|
+
*
|
|
12
|
+
* The Version, level and description are decoded to friendly labels and re-encoded back to their numeric
|
|
13
|
+
* on-wire form, so a well-formed alert round-trips. In the heuristic chain (`heuristicFallback`), match()
|
|
14
|
+
* requires a Content Type of 21 and a recognized legacy Version (0x0300-0x0304).
|
|
15
|
+
*/
|
|
16
|
+
export declare class TLS_Alert extends BaseHeader {
|
|
17
|
+
SCHEMA: ProtocolJSONSchema;
|
|
18
|
+
id: string;
|
|
19
|
+
readonly matchKeys: string[];
|
|
20
|
+
readonly heuristicFallback: boolean;
|
|
21
|
+
name: string;
|
|
22
|
+
nickname: string;
|
|
23
|
+
match(): boolean;
|
|
24
|
+
}
|