@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,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Redis = void 0;
|
|
5
|
+
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
6
|
+
const BufferToHex_1 = require("../helper/BufferToHex");
|
|
7
|
+
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
8
|
+
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
9
|
+
/**
|
|
10
|
+
* RESP type bytes → human names. The leading byte of every RESP message names its type: the RESP2 set
|
|
11
|
+
* `+ - : $ *` (simple-string / error / integer / bulk-string / array) plus the RESP3 additions
|
|
12
|
+
* `_ # , ( ! = % ~ >` (null / boolean / double / big-number / blob-error / verbatim-string / map / set /
|
|
13
|
+
* push). Used only to label the message for display — it never affects the re-emitted bytes.
|
|
14
|
+
*/
|
|
15
|
+
const RESP_TYPES = {
|
|
16
|
+
'*': 'array',
|
|
17
|
+
'$': 'bulk-string',
|
|
18
|
+
'+': 'simple-string',
|
|
19
|
+
'-': 'error',
|
|
20
|
+
':': 'integer',
|
|
21
|
+
'_': 'null',
|
|
22
|
+
'#': 'boolean',
|
|
23
|
+
',': 'double',
|
|
24
|
+
'(': 'big-number',
|
|
25
|
+
'%': 'map',
|
|
26
|
+
'~': 'set',
|
|
27
|
+
'>': 'push',
|
|
28
|
+
'!': 'blob-error',
|
|
29
|
+
'=': 'verbatim-string'
|
|
30
|
+
};
|
|
31
|
+
/** The RESP type bytes, as a lookup set for match(). A single leading byte is a WEAK signature — see matchKeys. */
|
|
32
|
+
const RESP_TYPE_BYTES = '*$+-:_#,(%~>!=';
|
|
33
|
+
/**
|
|
34
|
+
* Redis RESP — the REdis Serialization Protocol (RESP2/RESP3), carried over TCP well-known port 6379. RESP
|
|
35
|
+
* is a text-ish line protocol whose FIRST byte names the message type: `+` simple string (`+OK\r\n`), `-`
|
|
36
|
+
* error (`-ERR msg\r\n`), `:` integer (`:1000\r\n`), `$` bulk string (`$6\r\nfoobar\r\n`, or `$-1\r\n` null),
|
|
37
|
+
* `*` array (`*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n`). RESP3 adds `_` null, `#` boolean, `,` double,
|
|
38
|
+
* `(` big number, `!` blob error, `=` verbatim string, `%` map, `~` set, `>` push. Client commands are
|
|
39
|
+
* almost always arrays of bulk strings (`*` framing), so the first bulk-string element is the command verb.
|
|
40
|
+
*
|
|
41
|
+
* Like FTP, SMTP, POP3, IMAP, Syslog, SIP and HTTP, the message is text whose full internal structure
|
|
42
|
+
* (nested aggregates, binary-safe bulk strings, inline commands) is richer than a form needs. So the ENTIRE
|
|
43
|
+
* raw segment is kept verbatim as the authoritative `message` field (hex) and re-emitted untouched; only a
|
|
44
|
+
* little first-byte/first-line metadata is parsed on decode for display (respType/isRequest/command/preview).
|
|
45
|
+
* Encode never reconstructs the message from the parsed fields — it writes `message` back byte-for-byte — so
|
|
46
|
+
* any conformant (or even malformed) RESP frame round-trips exactly.
|
|
47
|
+
*
|
|
48
|
+
* Note: a single TCP segment may carry more than one RESP message (pipelined commands) or only part of a
|
|
49
|
+
* large bulk string; reassembly across segments is out of scope. This single-segment codec keeps whatever
|
|
50
|
+
* bytes are present verbatim, which is byte-perfect for the single-packet case.
|
|
51
|
+
*/
|
|
52
|
+
class Redis extends BaseHeader_1.BaseHeader {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
this.id = 'redis';
|
|
56
|
+
this.name = 'Redis Serialization Protocol';
|
|
57
|
+
this.nickname = 'Redis';
|
|
58
|
+
//Redis is recognized ONLY on its well-known port bucket 6379 — deliberately NOT via heuristicFallback.
|
|
59
|
+
//A RESP message is identified by a SINGLE leading type byte (`* $ + - : _ # , ( % ~ > ! =`), which is an
|
|
60
|
+
//extremely WEAK signature: countless non-RESP byte streams begin with one of these bytes (`*` 0x2a, `+`
|
|
61
|
+
//0x2b, `-` 0x2d, `:` 0x3a, `#` 0x23, `=` 0x3d, `,` 0x2c all appear in ordinary ASCII text and binary
|
|
62
|
+
//data). Unlike HTTP/RTSP (multi-byte distinctive method sets), a 1-byte signature carries almost no
|
|
63
|
+
//discriminating power. Joining the global heuristic chain would let Redis mis-claim essentially every
|
|
64
|
+
//layer whose first byte happens to fall in that set, on ANY port — an unacceptable outcome. Confining
|
|
65
|
+
//Redis to its tcp:6379 bucket makes that impossible off-port; alt-port Redis is rare and falls losslessly
|
|
66
|
+
//to raw. (Even in-bucket, match() additionally sanity-checks the byte after `*`/`$`/`:` to further reduce
|
|
67
|
+
//false claims — see match().)
|
|
68
|
+
this.matchKeys = ['tcpport:6379'];
|
|
69
|
+
//A leaf header — the Redis session / pipelined command stream it belongs to is a higher-layer concern.
|
|
70
|
+
this.demuxProducers = [];
|
|
71
|
+
}
|
|
72
|
+
static #schemaCache;
|
|
73
|
+
get SCHEMA() {
|
|
74
|
+
return (_a.#schemaCache ??= _a.#buildSchema());
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Bytes of this header: RESP rides on TCP, which has no per-message length, so take the rest of the
|
|
78
|
+
* segment. Reassembly across segments is out of scope (see class doc).
|
|
79
|
+
*/
|
|
80
|
+
#payloadLength() {
|
|
81
|
+
const available = this.packet.length - this.startPos;
|
|
82
|
+
return available < 0 ? 0 : available;
|
|
83
|
+
}
|
|
84
|
+
/** The first line of the message (up to the first CRLF, or the whole payload if none). */
|
|
85
|
+
static #firstLine(text) {
|
|
86
|
+
const idx = text.indexOf('\r\n');
|
|
87
|
+
return idx >= 0 ? text.slice(0, idx) : text;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* If the message is an array of bulk strings (RESP `*` framing, the usual client-command shape), parse
|
|
91
|
+
* the FIRST bulk-string element and uppercase it — that is the Redis command verb (SET/GET/PING/AUTH/…).
|
|
92
|
+
* Layout: `*<count>\r\n` then the first element `$<len>\r\n<bytes>\r\n`. Never throws: any malformed or
|
|
93
|
+
* non-array/non-bulk shape yields ''. Purely display-only — it never affects the re-emitted bytes.
|
|
94
|
+
*/
|
|
95
|
+
static #parseCommand(text) {
|
|
96
|
+
if (text[0] !== '*')
|
|
97
|
+
return '';
|
|
98
|
+
//Step past the `*<count>\r\n` array header.
|
|
99
|
+
const arrEol = text.indexOf('\r\n');
|
|
100
|
+
if (arrEol < 0)
|
|
101
|
+
return '';
|
|
102
|
+
//The first element must be a bulk string: `$<len>\r\n<bytes>\r\n`.
|
|
103
|
+
const pos = arrEol + 2;
|
|
104
|
+
if (text[pos] !== '$')
|
|
105
|
+
return '';
|
|
106
|
+
const lenEol = text.indexOf('\r\n', pos);
|
|
107
|
+
if (lenEol < 0)
|
|
108
|
+
return '';
|
|
109
|
+
const len = Number(text.slice(pos + 1, lenEol));
|
|
110
|
+
if (!Number.isInteger(len) || len < 0)
|
|
111
|
+
return '';
|
|
112
|
+
const start = lenEol + 2;
|
|
113
|
+
const end = start + len;
|
|
114
|
+
if (end > text.length)
|
|
115
|
+
return '';
|
|
116
|
+
return text.slice(start, end).toUpperCase();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Parse the leading byte / first line into the display-only metadata fields. respType names the leading
|
|
120
|
+
* type byte; isRequest is the pragmatic `*`-means-client-command heuristic; command is the array's first
|
|
121
|
+
* bulk string (verb); preview is the first line for display. Populated on decode only — these fields have
|
|
122
|
+
* no encode, so they never affect the re-emitted bytes and never mutate `message`. Never throws:
|
|
123
|
+
* empty/garbage input yields sensible defaults.
|
|
124
|
+
*/
|
|
125
|
+
#parseMetadata(text) {
|
|
126
|
+
const lead = text.length > 0 ? text[0] : '';
|
|
127
|
+
const respType = lead in RESP_TYPES ? RESP_TYPES[lead] : 'unknown';
|
|
128
|
+
this.instance.respType.setValue(respType);
|
|
129
|
+
this.instance.isRequest.setValue(lead === '*');
|
|
130
|
+
this.instance.command.setValue(_a.#parseCommand(text));
|
|
131
|
+
this.instance.preview.setValue(_a.#firstLine(text));
|
|
132
|
+
}
|
|
133
|
+
static #buildSchema() {
|
|
134
|
+
return {
|
|
135
|
+
type: 'object',
|
|
136
|
+
summary: 'Redis ${respType} ${command}',
|
|
137
|
+
properties: {
|
|
138
|
+
//The whole raw segment is the single source of truth: decoded verbatim to hex and re-emitted
|
|
139
|
+
//untouched (byte-perfect for any RESP frame). The leading byte / first line is parsed into the
|
|
140
|
+
//display-only metadata below, which carry no codec of their own.
|
|
141
|
+
message: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
label: 'Message',
|
|
144
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
145
|
+
decode: function () {
|
|
146
|
+
const available = this.#payloadLength();
|
|
147
|
+
if (available <= 0) {
|
|
148
|
+
this.instance.message.setValue('');
|
|
149
|
+
this.#parseMetadata('');
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const raw = this.readBytes(0, available);
|
|
153
|
+
this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
|
|
154
|
+
this.#parseMetadata(raw.toString('latin1'));
|
|
155
|
+
},
|
|
156
|
+
encode: function () {
|
|
157
|
+
//Re-emit the authoritative message verbatim — never reconstruct from metadata.
|
|
158
|
+
this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
//Display-only metadata parsed on decode (no encode — populated by the message field above,
|
|
162
|
+
//never read back). respType names the leading type byte; isRequest flags the `*` array shape
|
|
163
|
+
//that client commands use; command is the array's first bulk string (the verb); preview is the
|
|
164
|
+
//first line as latin1 text.
|
|
165
|
+
respType: { type: 'string', label: 'RESP Type' },
|
|
166
|
+
isRequest: { type: 'boolean', label: 'Is Request' },
|
|
167
|
+
command: { type: 'string', label: 'Command' },
|
|
168
|
+
preview: { type: 'string', label: 'Preview' }
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
match() {
|
|
173
|
+
//RESP rides on TCP. Recognize it by the leading type byte only within the tcp:6379 bucket. To reduce
|
|
174
|
+
//even in-bucket false claims from binary traffic that happens to start with a type byte, the numeric
|
|
175
|
+
//framings `*` (array), `$` (bulk string) and `:` (integer) additionally require the next byte to be a
|
|
176
|
+
//plausible count/length — a digit or `-` (RESP encodes null/negative counts as `$-1`, `*-1`). The
|
|
177
|
+
//text framings (`+ - _ # , ( % ~ > ! =`) carry free-form content, so only the type byte is checked.
|
|
178
|
+
if (!this.prevCodecModule)
|
|
179
|
+
return false;
|
|
180
|
+
if (this.prevCodecModule.id !== 'tcp')
|
|
181
|
+
return false;
|
|
182
|
+
if (this.#payloadLength() < 1)
|
|
183
|
+
return false;
|
|
184
|
+
const lead = this.readBytes(0, 2, true);
|
|
185
|
+
const type = String.fromCharCode(lead[0]);
|
|
186
|
+
if (!RESP_TYPE_BYTES.includes(type))
|
|
187
|
+
return false;
|
|
188
|
+
if (type === '*' || type === '$' || type === ':') {
|
|
189
|
+
//Need the following byte to decide plausibility; a 1-byte segment is too short to trust.
|
|
190
|
+
if (lead.length < 2)
|
|
191
|
+
return false;
|
|
192
|
+
const next = lead[1];
|
|
193
|
+
const isDigit = next >= 0x30 && next <= 0x39;
|
|
194
|
+
const isMinus = next === 0x2d;
|
|
195
|
+
if (!isDigit && !isMinus)
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.Redis = Redis;
|
|
202
|
+
_a = Redis;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* Rlogin — the Remote Login protocol (RFC 1282), carried over TCP well-known port 513. After the TCP
|
|
6
|
+
* connection opens, the client sends a single startup message: four null-separated strings
|
|
7
|
+
*
|
|
8
|
+
* \0 {client-user-name} \0 {server-user-name} \0 {terminal-type}/{terminal-speed} \0
|
|
9
|
+
*
|
|
10
|
+
* e.g. `00 6a 64 6f 65 00 72 6f 6f 74 00 78 74 65 72 6d 2f 33 38 34 30 30 00`
|
|
11
|
+
* ("\0jdoe\0root\0xterm/38400\0"). The leading null makes the first split field empty. After that startup
|
|
12
|
+
* exchange the connection is an unframed byte stream (the server replies with a single 0x00 to accept,
|
|
13
|
+
* then terminal data flows; interrupts and window-size changes ride in-band as URG/control bytes).
|
|
14
|
+
*
|
|
15
|
+
* MINIMAL slice (mirrors the SSH/Telnet/Finger verbatim-message pattern): the connection has no
|
|
16
|
+
* per-message framing, so the ENTIRE payload is the single source of truth — decoded verbatim to hex in
|
|
17
|
+
* the authoritative `message` field and re-emitted byte-for-byte on encode. On top of that, when the
|
|
18
|
+
* payload opens with a 0x00 byte (the startup shape) the leading null-separated fields are parsed into
|
|
19
|
+
* DISPLAY-ONLY metadata: `isStartup`, `clientUser`, `serverUser`, `terminalType` (the raw
|
|
20
|
+
* "terminal/speed" field). Those carry no codec of their own and never reconstruct the bytes — the
|
|
21
|
+
* message owns them. So any Rlogin payload (a startup message, the server's 0x00 ack, terminal data, or
|
|
22
|
+
* a truncated fragment) round-trips exactly.
|
|
23
|
+
*
|
|
24
|
+
* Matching rationale (NO heuristicFallback): Rlogin is claimed ONLY on the tcp:513 bucket. The startup
|
|
25
|
+
* message opens with a 0x00 byte, but that is a weak, generic signature (a leading null byte matches
|
|
26
|
+
* countless binary payloads) and the ensuing byte stream has no content magic at all, so recognizing
|
|
27
|
+
* Rlogin relies entirely on the well-known port. Joining the global content-heuristic chain would let
|
|
28
|
+
* Rlogin mislabel arbitrary TCP payloads on any port. Confining Rlogin to tcp:513 keeps that impossible;
|
|
29
|
+
* alt-port Rlogin is rare and falls losslessly to raw. For the same reason match() does NOT gate on a
|
|
30
|
+
* leading null: on the port-513 bucket every payload IS Rlogin (including the byte-stream phase), so any
|
|
31
|
+
* non-empty payload is kept verbatim rather than dropped to raw.
|
|
32
|
+
*/
|
|
33
|
+
export declare class Rlogin extends BaseHeader {
|
|
34
|
+
#private;
|
|
35
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly nickname: string;
|
|
39
|
+
readonly matchKeys: string[];
|
|
40
|
+
match(): boolean;
|
|
41
|
+
readonly demuxProducers: DemuxProducer[];
|
|
42
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rlogin = 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 StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
8
|
+
/**
|
|
9
|
+
* Rlogin — the Remote Login protocol (RFC 1282), carried over TCP well-known port 513. After the TCP
|
|
10
|
+
* connection opens, the client sends a single startup message: four null-separated strings
|
|
11
|
+
*
|
|
12
|
+
* \0 {client-user-name} \0 {server-user-name} \0 {terminal-type}/{terminal-speed} \0
|
|
13
|
+
*
|
|
14
|
+
* e.g. `00 6a 64 6f 65 00 72 6f 6f 74 00 78 74 65 72 6d 2f 33 38 34 30 30 00`
|
|
15
|
+
* ("\0jdoe\0root\0xterm/38400\0"). The leading null makes the first split field empty. After that startup
|
|
16
|
+
* exchange the connection is an unframed byte stream (the server replies with a single 0x00 to accept,
|
|
17
|
+
* then terminal data flows; interrupts and window-size changes ride in-band as URG/control bytes).
|
|
18
|
+
*
|
|
19
|
+
* MINIMAL slice (mirrors the SSH/Telnet/Finger verbatim-message pattern): the connection has no
|
|
20
|
+
* per-message framing, so the ENTIRE payload is the single source of truth — decoded verbatim to hex in
|
|
21
|
+
* the authoritative `message` field and re-emitted byte-for-byte on encode. On top of that, when the
|
|
22
|
+
* payload opens with a 0x00 byte (the startup shape) the leading null-separated fields are parsed into
|
|
23
|
+
* DISPLAY-ONLY metadata: `isStartup`, `clientUser`, `serverUser`, `terminalType` (the raw
|
|
24
|
+
* "terminal/speed" field). Those carry no codec of their own and never reconstruct the bytes — the
|
|
25
|
+
* message owns them. So any Rlogin payload (a startup message, the server's 0x00 ack, terminal data, or
|
|
26
|
+
* a truncated fragment) round-trips exactly.
|
|
27
|
+
*
|
|
28
|
+
* Matching rationale (NO heuristicFallback): Rlogin is claimed ONLY on the tcp:513 bucket. The startup
|
|
29
|
+
* message opens with a 0x00 byte, but that is a weak, generic signature (a leading null byte matches
|
|
30
|
+
* countless binary payloads) and the ensuing byte stream has no content magic at all, so recognizing
|
|
31
|
+
* Rlogin relies entirely on the well-known port. Joining the global content-heuristic chain would let
|
|
32
|
+
* Rlogin mislabel arbitrary TCP payloads on any port. Confining Rlogin to tcp:513 keeps that impossible;
|
|
33
|
+
* alt-port Rlogin is rare and falls losslessly to raw. For the same reason match() does NOT gate on a
|
|
34
|
+
* leading null: on the port-513 bucket every payload IS Rlogin (including the byte-stream phase), so any
|
|
35
|
+
* non-empty payload is kept verbatim rather than dropped to raw.
|
|
36
|
+
*/
|
|
37
|
+
class Rlogin extends BaseHeader_1.BaseHeader {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(...arguments);
|
|
40
|
+
this.id = 'rlogin';
|
|
41
|
+
this.name = 'Rlogin';
|
|
42
|
+
this.nickname = 'Rlogin';
|
|
43
|
+
//Rlogin is recognized ONLY on the well-known port 513 — deliberately NOT via heuristicFallback. The
|
|
44
|
+
//startup message opens with a weak, generic 0x00 byte and the ensuing byte stream has no content magic,
|
|
45
|
+
//so its recognition depends entirely on the port bucket; joining the global heuristic chain would
|
|
46
|
+
//mislabel arbitrary TCP traffic. See the class doc for the full rationale.
|
|
47
|
+
this.matchKeys = ['tcpport:513'];
|
|
48
|
+
//A leaf header — the Rlogin byte stream is the terminal session itself; nothing demuxes off it.
|
|
49
|
+
this.demuxProducers = [];
|
|
50
|
+
}
|
|
51
|
+
static #schemaCache;
|
|
52
|
+
get SCHEMA() {
|
|
53
|
+
return (Rlogin.#schemaCache ??= Rlogin.#buildSchema());
|
|
54
|
+
}
|
|
55
|
+
/** Bytes available to this header: Rlogin rides on TCP, which has no per-message length. */
|
|
56
|
+
#payloadLength() {
|
|
57
|
+
const available = this.packet.length - this.startPos;
|
|
58
|
+
return available < 0 ? 0 : available;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parse the startup message into the display-only metadata fields. The startup message is
|
|
62
|
+
* `\0 client-user \0 server-user \0 terminal-type/speed \0`, so splitting the payload on the null byte
|
|
63
|
+
* yields ['', clientUser, serverUser, terminalType, …]. Populated on decode only — these fields have no
|
|
64
|
+
* encode, so they never affect the re-emitted bytes and never mutate `message`. Never throws: a payload
|
|
65
|
+
* that does not open with 0x00 (the byte-stream phase) yields isStartup false and empty fields.
|
|
66
|
+
*/
|
|
67
|
+
#parseStartup(raw) {
|
|
68
|
+
const isStartup = raw.length >= 1 && raw[0] === 0x00;
|
|
69
|
+
this.instance.isStartup.setValue(isStartup);
|
|
70
|
+
if (!isStartup) {
|
|
71
|
+
this.instance.clientUser.setValue('');
|
|
72
|
+
this.instance.serverUser.setValue('');
|
|
73
|
+
this.instance.terminalType.setValue('');
|
|
74
|
+
this.instance.summaryInfo.setValue('data');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
//The leading null makes segments[0] the empty first field; the three named fields follow.
|
|
78
|
+
const segments = raw.toString('latin1').split('\0');
|
|
79
|
+
const clientUser = segments[1] !== undefined ? segments[1] : '';
|
|
80
|
+
const serverUser = segments[2] !== undefined ? segments[2] : '';
|
|
81
|
+
const terminalType = segments[3] !== undefined ? segments[3] : '';
|
|
82
|
+
this.instance.clientUser.setValue(clientUser);
|
|
83
|
+
this.instance.serverUser.setValue(serverUser);
|
|
84
|
+
this.instance.terminalType.setValue(terminalType);
|
|
85
|
+
this.instance.summaryInfo.setValue(clientUser || serverUser ? `${clientUser}/${serverUser}` : 'startup');
|
|
86
|
+
}
|
|
87
|
+
static #buildSchema() {
|
|
88
|
+
return {
|
|
89
|
+
type: 'object',
|
|
90
|
+
summary: 'Rlogin ${summaryInfo}',
|
|
91
|
+
properties: {
|
|
92
|
+
//Display-only metadata parsed from the startup message on decode (no encode — populated by
|
|
93
|
+
//the `message` field below, never read back). isStartup flags a payload that opens with a
|
|
94
|
+
//0x00 byte; clientUser/serverUser/terminalType are the leading null-separated fields.
|
|
95
|
+
isStartup: { type: 'boolean', label: 'Is Startup', default: false },
|
|
96
|
+
clientUser: { type: 'string', label: 'Client User', default: '' },
|
|
97
|
+
serverUser: { type: 'string', label: 'Server User', default: '' },
|
|
98
|
+
terminalType: { type: 'string', label: 'Terminal Type', default: '' },
|
|
99
|
+
//Drives the one-line summary: "clientUser/serverUser" for a startup, else 'data'.
|
|
100
|
+
summaryInfo: { type: 'string', label: 'Summary', hidden: true, default: '' },
|
|
101
|
+
//The whole raw payload is the single source of truth: decoded verbatim to hex and re-emitted
|
|
102
|
+
//untouched (byte-perfect for any Rlogin payload). The startup fields are parsed into the
|
|
103
|
+
//display-only metadata above, which carry no codec of their own.
|
|
104
|
+
message: {
|
|
105
|
+
type: 'string',
|
|
106
|
+
label: 'Message',
|
|
107
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
108
|
+
default: '',
|
|
109
|
+
decode: function () {
|
|
110
|
+
const available = this.#payloadLength();
|
|
111
|
+
if (available <= 0) {
|
|
112
|
+
this.instance.message.setValue('');
|
|
113
|
+
this.#parseStartup(Buffer.alloc(0));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const raw = this.readBytes(0, available);
|
|
117
|
+
this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
|
|
118
|
+
this.#parseStartup(raw);
|
|
119
|
+
},
|
|
120
|
+
encode: function () {
|
|
121
|
+
//Re-emit the authoritative payload verbatim — never reconstruct from metadata.
|
|
122
|
+
this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
match() {
|
|
129
|
+
//Reached only on the tcp:513 bucket. Port 513 IS Rlogin's, so any non-empty payload over TCP is
|
|
130
|
+
//claimed and kept verbatim (byte-perfect) — deliberately without a leading-null gate, so the
|
|
131
|
+
//byte-stream phase is never wrongly dropped to raw. An empty payload is not claimed.
|
|
132
|
+
if (!this.prevCodecModule)
|
|
133
|
+
return false;
|
|
134
|
+
if (this.prevCodecModule.id !== 'tcp')
|
|
135
|
+
return false;
|
|
136
|
+
return this.#payloadLength() >= 1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.Rlogin = Rlogin;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* rsync — the rsync daemon protocol (TCP port 873). A session opens with a US-ASCII text handshake: the
|
|
6
|
+
* server sends a greeting line `@RSYNCD: <version>\n` (e.g. `@RSYNCD: 31.0\n`, LF-terminated, no CR), the
|
|
7
|
+
* client echoes its own `@RSYNCD: <version>\n`, then the client sends the module name and options as text
|
|
8
|
+
* lines, after which the connection switches to a binary multiplexed stream (4-byte tag/length framed
|
|
9
|
+
* messages) for the actual file-list / delta transfer.
|
|
10
|
+
*
|
|
11
|
+
* The post-handshake binary multiplexing is stateful and cross-message (tag demux, per-tag length,
|
|
12
|
+
* reassembly across segments), and even the text phase carries significant whitespace / ordering, far
|
|
13
|
+
* richer than a form needs. So, like SIP/HTTP/Finger, the ENTIRE raw payload is kept verbatim as the
|
|
14
|
+
* authoritative `message` field (hex) and re-emitted untouched — byte-perfect for any rsync segment,
|
|
15
|
+
* text handshake or binary frame alike. When the payload begins with the `@RSYNCD:` greeting signature,
|
|
16
|
+
* its first line is additionally parsed into display-only metadata (isGreeting + version); those fields
|
|
17
|
+
* carry no codec of their own and never affect the re-emitted bytes.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Rsync 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,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Rsync = void 0;
|
|
5
|
+
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
6
|
+
const BufferToHex_1 = require("../helper/BufferToHex");
|
|
7
|
+
const HexToBuffer_1 = require("../helper/HexToBuffer");
|
|
8
|
+
const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
|
|
9
|
+
/**
|
|
10
|
+
* rsync — the rsync daemon protocol (TCP port 873). A session opens with a US-ASCII text handshake: the
|
|
11
|
+
* server sends a greeting line `@RSYNCD: <version>\n` (e.g. `@RSYNCD: 31.0\n`, LF-terminated, no CR), the
|
|
12
|
+
* client echoes its own `@RSYNCD: <version>\n`, then the client sends the module name and options as text
|
|
13
|
+
* lines, after which the connection switches to a binary multiplexed stream (4-byte tag/length framed
|
|
14
|
+
* messages) for the actual file-list / delta transfer.
|
|
15
|
+
*
|
|
16
|
+
* The post-handshake binary multiplexing is stateful and cross-message (tag demux, per-tag length,
|
|
17
|
+
* reassembly across segments), and even the text phase carries significant whitespace / ordering, far
|
|
18
|
+
* richer than a form needs. So, like SIP/HTTP/Finger, the ENTIRE raw payload is kept verbatim as the
|
|
19
|
+
* authoritative `message` field (hex) and re-emitted untouched — byte-perfect for any rsync segment,
|
|
20
|
+
* text handshake or binary frame alike. When the payload begins with the `@RSYNCD:` greeting signature,
|
|
21
|
+
* its first line is additionally parsed into display-only metadata (isGreeting + version); those fields
|
|
22
|
+
* carry no codec of their own and never affect the re-emitted bytes.
|
|
23
|
+
*/
|
|
24
|
+
class Rsync extends BaseHeader_1.BaseHeader {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.id = 'rsync';
|
|
28
|
+
this.name = 'Rsync Daemon Protocol';
|
|
29
|
+
this.nickname = 'RSYNC';
|
|
30
|
+
this.matchKeys = ['tcpport:873'];
|
|
31
|
+
//A leaf header — the binary multiplexed stream that follows the handshake is a higher-layer concern.
|
|
32
|
+
this.demuxProducers = [];
|
|
33
|
+
}
|
|
34
|
+
static #schemaCache;
|
|
35
|
+
get SCHEMA() {
|
|
36
|
+
return (_a.#schemaCache ??= _a.#buildSchema());
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Bytes of this header: rsync rides on TCP, which has no per-message length, so take the rest of the
|
|
40
|
+
* segment. The binary multiplexed framing (and reassembly across segments) is out of scope; whatever
|
|
41
|
+
* bytes are present in the current segment are kept verbatim.
|
|
42
|
+
*/
|
|
43
|
+
#payloadLength() {
|
|
44
|
+
const available = this.packet.length - this.startPos;
|
|
45
|
+
return available < 0 ? 0 : available;
|
|
46
|
+
}
|
|
47
|
+
/** The first line of the payload (up to the first LF, or the whole payload if none); a trailing CR is stripped. */
|
|
48
|
+
static #firstLine(text) {
|
|
49
|
+
const idx = text.indexOf('\n');
|
|
50
|
+
let line = idx >= 0 ? text.slice(0, idx) : text;
|
|
51
|
+
if (line.endsWith('\r'))
|
|
52
|
+
line = line.slice(0, -1);
|
|
53
|
+
return line;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse the first line into the display-only metadata. Only a line beginning with the `@RSYNCD:`
|
|
57
|
+
* signature is a greeting; its remainder (trimmed) is the protocol version token (e.g. "31.0", or a
|
|
58
|
+
* status word like "OK"/"AUTHREQD ..."). Populated on decode only — these fields have no encode, so
|
|
59
|
+
* they never affect the re-emitted bytes. Never throws: a non-greeting payload yields empty metadata.
|
|
60
|
+
*/
|
|
61
|
+
#parseFirstLine(text) {
|
|
62
|
+
const line = _a.#firstLine(text);
|
|
63
|
+
if (line.startsWith('@RSYNCD:')) {
|
|
64
|
+
this.instance.isGreeting.setValue(true);
|
|
65
|
+
this.instance.version.setValue(line.slice('@RSYNCD:'.length).trim());
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.instance.isGreeting.setValue(false);
|
|
69
|
+
this.instance.version.setValue('');
|
|
70
|
+
}
|
|
71
|
+
static #buildSchema() {
|
|
72
|
+
return {
|
|
73
|
+
type: 'object',
|
|
74
|
+
summary: 'rsync ${version}',
|
|
75
|
+
properties: {
|
|
76
|
+
//The whole raw payload is the single source of truth: decoded verbatim to hex and
|
|
77
|
+
//re-emitted untouched (byte-perfect for any rsync segment). The greeting line, when
|
|
78
|
+
//present, is parsed into the display-only metadata below, which carry no codec.
|
|
79
|
+
message: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
label: 'Message',
|
|
82
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
83
|
+
decode: function () {
|
|
84
|
+
const available = this.#payloadLength();
|
|
85
|
+
if (available <= 0) {
|
|
86
|
+
this.instance.message.setValue('');
|
|
87
|
+
this.#parseFirstLine('');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const raw = this.readBytes(0, available);
|
|
91
|
+
this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
|
|
92
|
+
this.#parseFirstLine(raw.toString('latin1'));
|
|
93
|
+
},
|
|
94
|
+
encode: function () {
|
|
95
|
+
//Re-emit the authoritative payload verbatim — never reconstruct from metadata.
|
|
96
|
+
this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
//Display-only metadata parsed from the first line on decode (no encode — populated by the
|
|
100
|
+
//message field above, never read back). isGreeting is true only for a `@RSYNCD:` line;
|
|
101
|
+
//version is the token after `@RSYNCD:` (empty for a binary/non-greeting segment).
|
|
102
|
+
isGreeting: { type: 'boolean', label: 'Is Greeting' },
|
|
103
|
+
version: { type: 'string', label: 'Version' }
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
match() {
|
|
108
|
+
//rsync rides on TCP port 873. The payload has no fixed content magic once the connection turns
|
|
109
|
+
//binary, so the well-known port is the signature (no heuristicFallback: it is not claimed on any
|
|
110
|
+
//other port). Require the previous layer to be TCP and at least one payload byte to be present.
|
|
111
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'tcp')
|
|
112
|
+
return false;
|
|
113
|
+
return this.#payloadLength() > 0;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.Rsync = Rsync;
|
|
117
|
+
_a = Rsync;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* S7comm — the Siemens S7 Communication protocol (S7-300/400/1200/1500 PLC), the application layer of
|
|
6
|
+
* the S7 ISO-on-TCP stack: it rides inside a COTP DT (Data) TPDU, itself carried by a TPKT PDU on TCP
|
|
7
|
+
* port 102 (RFC 1006). Every S7comm PDU begins with a fixed 10-byte header — a Protocol Id (always
|
|
8
|
+
* 0x32), a ROSCTR (message class: 1 Job request, 2 Ack, 3 Ack_Data, 7 Userdata), a 2-byte Redundancy
|
|
9
|
+
* Identification (reserved, normally 0), a 2-byte PDU Reference, and the 2-byte Parameter Length and
|
|
10
|
+
* Data Length that delimit the two variable sections — plus, ONLY for the Ack / Ack_Data classes
|
|
11
|
+
* (ROSCTR 2 or 3), a 2-byte error field (Error Class + Error Code). The Parameter section (the S7
|
|
12
|
+
* function + its arguments) and the Data section (item values, results) then follow, sized by the two
|
|
13
|
+
* length fields.
|
|
14
|
+
*
|
|
15
|
+
* The Parameter and Data sections are function-dependent, cross-PDU state (Setup Communication,
|
|
16
|
+
* Read/Write Var, block up/download, PLC control, …), so this codec keeps them verbatim as bounded hex
|
|
17
|
+
* (byte-perfect): `parameter` sized by Parameter Length and `data` sized by Data Length. The two length
|
|
18
|
+
* fields are honor-else-derive (honored verbatim when supplied — a crafted PDU may lie — else derived
|
|
19
|
+
* from the hex byte length of their section). Every field is BIG-ENDIAN (S7comm is not CIP/ENIP). A
|
|
20
|
+
* well-formed PDU round-trips byte-for-byte.
|
|
21
|
+
*
|
|
22
|
+
* S7comm is gated purely on its parent being a COTP DT TPDU (prev.id === 'cotp') plus the Protocol Id
|
|
23
|
+
* 0x32 signature at offset 0 (heuristicFallback), mirroring how COTP itself is an unkeyed
|
|
24
|
+
* content-heuristic child of TPKT — nothing on TCP/102 other than a COTP-carried 0x32 PDU is S7comm.
|
|
25
|
+
*/
|
|
26
|
+
export declare class S7comm extends BaseHeader {
|
|
27
|
+
#private;
|
|
28
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly nickname: string;
|
|
32
|
+
readonly matchKeys: string[];
|
|
33
|
+
readonly heuristicFallback: boolean;
|
|
34
|
+
match(): boolean;
|
|
35
|
+
readonly demuxProducers: DemuxProducer[];
|
|
36
|
+
}
|