@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,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.FTP = 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
|
+
/** FTP command verbs (RFC 959 + common extensions) used only to recognize a command line. */
|
|
10
|
+
const FTP_COMMANDS = ['USER', 'PASS', 'ACCT', 'CWD', 'CDUP', 'QUIT', 'PORT', 'PASV', 'TYPE', 'RETR', 'STOR', 'LIST', 'NLST', 'DELE', 'MKD', 'RMD', 'PWD', 'SYST', 'FEAT', 'EPSV', 'EPRT', 'SIZE', 'MDTM', 'RNFR', 'RNTO', 'NOOP', 'OPTS', 'AUTH', 'HELP', 'STAT', 'ABOR', 'REST', 'APPE'];
|
|
11
|
+
/**
|
|
12
|
+
* FTP — the File Transfer Protocol control channel (RFC 959), carried as US-ASCII text over TCP
|
|
13
|
+
* well-known port 21. The control channel is line-based: a client sends commands
|
|
14
|
+
* (`USER anonymous\r\n`, `PASS x\r\n`, `RETR file\r\n`, …) and a server sends replies
|
|
15
|
+
* (`220 Service ready\r\n`, `331 …\r\n`); a multi-line reply repeats the code with a '-' after the
|
|
16
|
+
* first line (`220-…\r\n…\r\n220 …\r\n`). The bulk data transfer runs on a separate dynamic-port
|
|
17
|
+
* connection which is out of scope — only the control channel on port 21 is claimed here (like TFTP,
|
|
18
|
+
* whose data channel is likewise not claimed).
|
|
19
|
+
*
|
|
20
|
+
* Like Syslog, SIP and HTTP, the message is text whose full internal structure (arbitrary arguments,
|
|
21
|
+
* significant whitespace, multi-line reply continuations) is richer than a form needs. So the ENTIRE
|
|
22
|
+
* raw message is kept verbatim as the authoritative `message` field (hex) and re-emitted untouched;
|
|
23
|
+
* only the first line is parsed on decode into display-only metadata (command/argument for a command,
|
|
24
|
+
* replyCode/replyText for a reply). Encode never reconstructs the message from the parsed fields — it
|
|
25
|
+
* writes `message` back byte-for-byte — so any conformant (or even malformed) FTP line round-trips
|
|
26
|
+
* exactly.
|
|
27
|
+
*
|
|
28
|
+
* Note: a single TCP segment may carry more than one control line (pipelined commands) or only part of
|
|
29
|
+
* a multi-line reply; reassembly across segments is out of scope. This single-segment codec keeps
|
|
30
|
+
* whatever bytes are present verbatim, which is byte-perfect for the single-packet case.
|
|
31
|
+
*/
|
|
32
|
+
class FTP extends BaseHeader_1.BaseHeader {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.id = 'ftp';
|
|
36
|
+
this.name = 'File Transfer Protocol';
|
|
37
|
+
this.nickname = 'FTP';
|
|
38
|
+
//FTP is recognized ONLY on the well-known control port 21 — deliberately NOT via heuristicFallback.
|
|
39
|
+
//Unlike HTTP/RTSP (whose method sets are distinctive), FTP's line signature is a 3-digit reply code
|
|
40
|
+
//or a generic verb (USER/PASS/LIST/STAT/QUIT/RETR/…) that is SHARED with other US-ASCII line
|
|
41
|
+
//protocols this codec does not model — POP3 (USER/PASS/STAT/LIST/RETR/QUIT), SMTP (AUTH/QUIT/NOOP),
|
|
42
|
+
//IRC (USER/QUIT), and any NNN-code greeting (SMTP/NNTP). Joining the global heuristic chain would
|
|
43
|
+
//mislabel all of those as FTP on their own ports. Confining FTP to the tcp:21 bucket keeps that
|
|
44
|
+
//collision impossible (POP3/SMTP/IRC live on 110/25/6667, which never reach this bucket); alt-port
|
|
45
|
+
//FTP control is rare and falls losslessly to raw.
|
|
46
|
+
this.matchKeys = ['tcpport:21'];
|
|
47
|
+
//A leaf header — the FTP data channel and the session it belongs to are a higher-layer concern.
|
|
48
|
+
this.demuxProducers = [];
|
|
49
|
+
}
|
|
50
|
+
static #schemaCache;
|
|
51
|
+
get SCHEMA() {
|
|
52
|
+
return (_a.#schemaCache ??= _a.#buildSchema());
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Bytes of this header: FTP rides on TCP, which has no per-message length, so take the rest of the
|
|
56
|
+
* segment. Reassembly across segments is out of scope (see class doc).
|
|
57
|
+
*/
|
|
58
|
+
#payloadLength() {
|
|
59
|
+
const available = this.packet.length - this.startPos;
|
|
60
|
+
return available < 0 ? 0 : available;
|
|
61
|
+
}
|
|
62
|
+
/** The first line of the message (up to the first CRLF, or the whole payload if none). */
|
|
63
|
+
static #firstLine(text) {
|
|
64
|
+
const idx = text.indexOf('\r\n');
|
|
65
|
+
return idx >= 0 ? text.slice(0, idx) : text;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parse the first line into the display-only metadata fields. A line matching `^\d{3}[ -]` is a
|
|
69
|
+
* server reply (the code, whether it is multi-line, and the trailing text); anything else is a
|
|
70
|
+
* client command (the uppercased verb and its argument). Populated on decode only — these fields
|
|
71
|
+
* have no encode, so they never affect the re-emitted bytes and never mutate `message`. Never
|
|
72
|
+
* throws: missing/garbage tokens yield empty strings or 0.
|
|
73
|
+
*/
|
|
74
|
+
#parseFirstLine(text) {
|
|
75
|
+
const line = _a.#firstLine(text);
|
|
76
|
+
const reply = line.match(/^(\d{3})([ -])(.*)$/);
|
|
77
|
+
if (reply) {
|
|
78
|
+
//Reply: 3-digit code, then ' ' (final) or '-' (a multi-line continuation follows).
|
|
79
|
+
this.instance.isReply.setValue(true);
|
|
80
|
+
this.instance.replyCode.setValue(Number(reply[1]));
|
|
81
|
+
this.instance.isMultiline.setValue(reply[2] === '-');
|
|
82
|
+
this.instance.replyText.setValue(reply[3]);
|
|
83
|
+
this.instance.command.setValue('');
|
|
84
|
+
this.instance.argument.setValue('');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
//Command: VERB SP argument (the argument may itself contain spaces, e.g. a path).
|
|
88
|
+
const idx = line.indexOf(' ');
|
|
89
|
+
const verb = idx >= 0 ? line.slice(0, idx) : line;
|
|
90
|
+
this.instance.isReply.setValue(false);
|
|
91
|
+
this.instance.replyCode.setValue(0);
|
|
92
|
+
this.instance.isMultiline.setValue(false);
|
|
93
|
+
this.instance.replyText.setValue('');
|
|
94
|
+
this.instance.command.setValue(verb.toUpperCase());
|
|
95
|
+
this.instance.argument.setValue(idx >= 0 ? line.slice(idx + 1) : '');
|
|
96
|
+
}
|
|
97
|
+
static #buildSchema() {
|
|
98
|
+
return {
|
|
99
|
+
type: 'object',
|
|
100
|
+
summary: 'FTP ${command}${replyCode}',
|
|
101
|
+
properties: {
|
|
102
|
+
//The whole raw message is the single source of truth: decoded verbatim to hex and
|
|
103
|
+
//re-emitted untouched (byte-perfect for any FTP control text). The first line is parsed
|
|
104
|
+
//into the display-only metadata below, which carry no codec of their own.
|
|
105
|
+
message: {
|
|
106
|
+
type: 'string',
|
|
107
|
+
label: 'Message',
|
|
108
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
109
|
+
decode: function () {
|
|
110
|
+
const available = this.#payloadLength();
|
|
111
|
+
if (available <= 0) {
|
|
112
|
+
this.instance.message.setValue('');
|
|
113
|
+
this.#parseFirstLine('');
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const raw = this.readBytes(0, available);
|
|
117
|
+
this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
|
|
118
|
+
this.#parseFirstLine(raw.toString('latin1'));
|
|
119
|
+
},
|
|
120
|
+
encode: function () {
|
|
121
|
+
//Re-emit the authoritative message verbatim — never reconstruct from metadata.
|
|
122
|
+
this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
//Display-only metadata parsed from the first line on decode (no encode — populated by the
|
|
126
|
+
//message field above, never read back). isReply distinguishes a server reply from a
|
|
127
|
+
//client command; replyCode/isMultiline/replyText describe a reply, command/argument a
|
|
128
|
+
//command.
|
|
129
|
+
isReply: { type: 'boolean', label: 'Is Reply' },
|
|
130
|
+
replyCode: { type: 'integer', label: 'Reply Code', minimum: 0, maximum: 999 },
|
|
131
|
+
isMultiline: { type: 'boolean', label: 'Is Multiline' },
|
|
132
|
+
replyText: { type: 'string', label: 'Reply Text' },
|
|
133
|
+
command: { type: 'string', label: 'Command' },
|
|
134
|
+
argument: { type: 'string', label: 'Argument' }
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
match() {
|
|
139
|
+
//FTP rides on TCP as US-ASCII text. Recognize it by the line signature: a 3-digit reply code
|
|
140
|
+
//followed by space or '-', or a known command verb as the leading token (up to the first space
|
|
141
|
+
//or CR) — so non-FTP traffic on port 21 falls through to raw rather than claiming an
|
|
142
|
+
//un-decodable text layer.
|
|
143
|
+
if (!this.prevCodecModule)
|
|
144
|
+
return false;
|
|
145
|
+
if (this.prevCodecModule.id !== 'tcp')
|
|
146
|
+
return false;
|
|
147
|
+
if (this.#payloadLength() < 3)
|
|
148
|
+
return false;
|
|
149
|
+
const lead = this.readBytes(0, 16, true).toString('latin1');
|
|
150
|
+
if (/^\d{3}[ -]/.test(lead))
|
|
151
|
+
return true;
|
|
152
|
+
const line = _a.#firstLine(lead);
|
|
153
|
+
const token = (line.split(/[ \r]/)[0] || '').toUpperCase();
|
|
154
|
+
return FTP_COMMANDS.includes(token);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.FTP = FTP;
|
|
158
|
+
_a = FTP;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* Finger — the Finger User Information Protocol (RFC 1288), carried over TCP well-known port 79. A Finger
|
|
6
|
+
* transaction opens with a single US-ASCII query line the client sends to the server, terminated by CR LF:
|
|
7
|
+
*
|
|
8
|
+
* {C} — empty line: "list all users" ({U} query with no username)
|
|
9
|
+
* {username}{C} — a {U} query naming one user, e.g. "root\r\n"
|
|
10
|
+
* /W{C} · /W {username}{C} — the verbose ("whois") switch {W} = "/W", optionally followed by a
|
|
11
|
+
* username, e.g. "/W root\r\n" (a forwarding {H} form "user@host" is just
|
|
12
|
+
* carried inside the username text)
|
|
13
|
+
*
|
|
14
|
+
* MINIMAL slice (mirrors the SSH/Telnet verbatim-message pattern): the query is free-form US-ASCII text
|
|
15
|
+
* with only a line ending for framing, so the structure a form needs is far poorer than the exact bytes a
|
|
16
|
+
* peer sees. The ENTIRE payload is therefore the single source of truth — decoded verbatim to hex in the
|
|
17
|
+
* authoritative `message` field and re-emitted byte-for-byte on encode. On top of that the first line is
|
|
18
|
+
* parsed into DISPLAY-ONLY metadata: `query` (the username with any leading "/W" verbose switch and
|
|
19
|
+
* surrounding whitespace stripped) and `isVerbose` (true when the line opens with "/W"). Those carry no
|
|
20
|
+
* codec of their own and never reconstruct the bytes — the message owns them. So any Finger payload (an
|
|
21
|
+
* empty list-all query, a username, a verbose query, a server's textual response, or a truncated
|
|
22
|
+
* fragment) round-trips exactly.
|
|
23
|
+
*
|
|
24
|
+
* Matching rationale (NO heuristicFallback): Finger is claimed ONLY on the tcp:79 bucket. A Finger query
|
|
25
|
+
* is arbitrary US-ASCII text with no distinctive off-port content signature (a bare "root\r\n" or an empty
|
|
26
|
+
* "\r\n" is indistinguishable from countless other line protocols), so recognizing it relies entirely on
|
|
27
|
+
* the well-known port. Joining the global content-heuristic chain would let Finger mislabel arbitrary text
|
|
28
|
+
* TCP payloads on any port. Confining Finger to tcp:79 keeps that impossible; alt-port Finger is rare and
|
|
29
|
+
* falls losslessly to raw. For the same reason match() does NOT gate on printable text: on the port-79
|
|
30
|
+
* bucket every payload IS Finger, so any non-empty payload is kept verbatim rather than dropped to raw.
|
|
31
|
+
*/
|
|
32
|
+
export declare class Finger extends BaseHeader {
|
|
33
|
+
#private;
|
|
34
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly nickname: string;
|
|
38
|
+
readonly matchKeys: string[];
|
|
39
|
+
match(): boolean;
|
|
40
|
+
readonly demuxProducers: DemuxProducer[];
|
|
41
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Finger = 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
|
+
* Finger — the Finger User Information Protocol (RFC 1288), carried over TCP well-known port 79. A Finger
|
|
10
|
+
* transaction opens with a single US-ASCII query line the client sends to the server, terminated by CR LF:
|
|
11
|
+
*
|
|
12
|
+
* {C} — empty line: "list all users" ({U} query with no username)
|
|
13
|
+
* {username}{C} — a {U} query naming one user, e.g. "root\r\n"
|
|
14
|
+
* /W{C} · /W {username}{C} — the verbose ("whois") switch {W} = "/W", optionally followed by a
|
|
15
|
+
* username, e.g. "/W root\r\n" (a forwarding {H} form "user@host" is just
|
|
16
|
+
* carried inside the username text)
|
|
17
|
+
*
|
|
18
|
+
* MINIMAL slice (mirrors the SSH/Telnet verbatim-message pattern): the query is free-form US-ASCII text
|
|
19
|
+
* with only a line ending for framing, so the structure a form needs is far poorer than the exact bytes a
|
|
20
|
+
* peer sees. The ENTIRE payload is therefore the single source of truth — decoded verbatim to hex in the
|
|
21
|
+
* authoritative `message` field and re-emitted byte-for-byte on encode. On top of that the first line is
|
|
22
|
+
* parsed into DISPLAY-ONLY metadata: `query` (the username with any leading "/W" verbose switch and
|
|
23
|
+
* surrounding whitespace stripped) and `isVerbose` (true when the line opens with "/W"). Those carry no
|
|
24
|
+
* codec of their own and never reconstruct the bytes — the message owns them. So any Finger payload (an
|
|
25
|
+
* empty list-all query, a username, a verbose query, a server's textual response, or a truncated
|
|
26
|
+
* fragment) round-trips exactly.
|
|
27
|
+
*
|
|
28
|
+
* Matching rationale (NO heuristicFallback): Finger is claimed ONLY on the tcp:79 bucket. A Finger query
|
|
29
|
+
* is arbitrary US-ASCII text with no distinctive off-port content signature (a bare "root\r\n" or an empty
|
|
30
|
+
* "\r\n" is indistinguishable from countless other line protocols), so recognizing it relies entirely on
|
|
31
|
+
* the well-known port. Joining the global content-heuristic chain would let Finger mislabel arbitrary text
|
|
32
|
+
* TCP payloads on any port. Confining Finger to tcp:79 keeps that impossible; alt-port Finger is rare and
|
|
33
|
+
* falls losslessly to raw. For the same reason match() does NOT gate on printable text: on the port-79
|
|
34
|
+
* bucket every payload IS Finger, so any non-empty payload is kept verbatim rather than dropped to raw.
|
|
35
|
+
*/
|
|
36
|
+
class Finger extends BaseHeader_1.BaseHeader {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(...arguments);
|
|
39
|
+
this.id = 'finger';
|
|
40
|
+
this.name = 'Finger';
|
|
41
|
+
this.nickname = 'Finger';
|
|
42
|
+
//Finger is recognized ONLY on the well-known port 79 — deliberately NOT via heuristicFallback. A Finger
|
|
43
|
+
//query is arbitrary US-ASCII text with no distinctive off-port content signature, so its recognition
|
|
44
|
+
//depends entirely on the port bucket; joining the global heuristic chain would mislabel arbitrary text
|
|
45
|
+
//TCP payloads on any port. See the class doc for the full rationale.
|
|
46
|
+
this.matchKeys = ['tcpport:79'];
|
|
47
|
+
//A leaf header — a Finger query/response is free-form user-information text; nothing demuxes off it.
|
|
48
|
+
this.demuxProducers = [];
|
|
49
|
+
}
|
|
50
|
+
static #schemaCache;
|
|
51
|
+
get SCHEMA() {
|
|
52
|
+
return (Finger.#schemaCache ??= Finger.#buildSchema());
|
|
53
|
+
}
|
|
54
|
+
/** Bytes available to this header: Finger rides on TCP, which has no per-message length. */
|
|
55
|
+
#payloadLength() {
|
|
56
|
+
const available = this.packet.length - this.startPos;
|
|
57
|
+
return available < 0 ? 0 : available;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Parse the first line into the display-only metadata fields. The Finger query is `[/W[ ]]username{C}`
|
|
61
|
+
* where {C} is CR LF (a lone LF is tolerated); "/W" is the verbose switch. Populated on decode only —
|
|
62
|
+
* these fields have no encode, so they never affect the re-emitted bytes and never mutate `message`.
|
|
63
|
+
* Never throws: an empty payload yields empty query / isVerbose false.
|
|
64
|
+
*/
|
|
65
|
+
#parseQuery(text) {
|
|
66
|
+
//Keep only up to the first line ending for the display parse; `message` still holds all bytes.
|
|
67
|
+
let line = text;
|
|
68
|
+
const lf = line.indexOf('\n');
|
|
69
|
+
if (lf >= 0)
|
|
70
|
+
line = line.slice(0, lf);
|
|
71
|
+
if (line.endsWith('\r'))
|
|
72
|
+
line = line.slice(0, -1);
|
|
73
|
+
//The verbose switch is the literal "/W" at the very start of the line (RFC 1288 §2.3).
|
|
74
|
+
let verbose = false;
|
|
75
|
+
if (line.startsWith('/W')) {
|
|
76
|
+
verbose = true;
|
|
77
|
+
line = line.slice(2);
|
|
78
|
+
}
|
|
79
|
+
//Strip the whitespace that separates the switch from the username (or leads a plain query).
|
|
80
|
+
const query = line.trim();
|
|
81
|
+
this.instance.isVerbose.setValue(verbose);
|
|
82
|
+
this.instance.query.setValue(query);
|
|
83
|
+
this.instance.summaryInfo.setValue(query ? query : 'list all');
|
|
84
|
+
}
|
|
85
|
+
static #buildSchema() {
|
|
86
|
+
return {
|
|
87
|
+
type: 'object',
|
|
88
|
+
summary: 'Finger ${summaryInfo}',
|
|
89
|
+
properties: {
|
|
90
|
+
//Display-only metadata parsed from the first line on decode (no encode — populated by the
|
|
91
|
+
//`message` field below, never read back). isVerbose flags a query opening with "/W"; query
|
|
92
|
+
//is the username text with the verbose switch and surrounding whitespace removed.
|
|
93
|
+
isVerbose: { type: 'boolean', label: 'Is Verbose', default: false },
|
|
94
|
+
query: { type: 'string', label: 'Query', default: '' },
|
|
95
|
+
//Drives the one-line summary: the query text, or 'list all' for the empty query.
|
|
96
|
+
summaryInfo: { type: 'string', label: 'Summary', hidden: true, default: '' },
|
|
97
|
+
//The whole raw payload is the single source of truth: decoded verbatim to hex and re-emitted
|
|
98
|
+
//untouched (byte-perfect for any Finger payload). The first line is parsed into the
|
|
99
|
+
//display-only metadata above, which carry no codec of their own.
|
|
100
|
+
message: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
label: 'Message',
|
|
103
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
104
|
+
default: '',
|
|
105
|
+
decode: function () {
|
|
106
|
+
const available = this.#payloadLength();
|
|
107
|
+
if (available <= 0) {
|
|
108
|
+
this.instance.message.setValue('');
|
|
109
|
+
this.#parseQuery('');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const raw = this.readBytes(0, available);
|
|
113
|
+
this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(raw));
|
|
114
|
+
this.#parseQuery(raw.toString('latin1'));
|
|
115
|
+
},
|
|
116
|
+
encode: function () {
|
|
117
|
+
//Re-emit the authoritative payload verbatim — never reconstruct from metadata.
|
|
118
|
+
this.writeBytes(0, (0, HexToBuffer_1.HexToBuffer)(this.instance.message.getValue('')));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
match() {
|
|
125
|
+
//Reached only on the tcp:79 bucket. Port 79 IS Finger's, so any non-empty payload over TCP is
|
|
126
|
+
//claimed and kept verbatim (byte-perfect) — deliberately without a printable-text gate, so a
|
|
127
|
+
//response body is never wrongly dropped to raw. An empty payload is not claimed.
|
|
128
|
+
if (!this.prevCodecModule)
|
|
129
|
+
return false;
|
|
130
|
+
if (this.prevCodecModule.id !== 'tcp')
|
|
131
|
+
return false;
|
|
132
|
+
return this.#payloadLength() >= 1;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.Finger = Finger;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* FOUNDATION Fieldbus HSE — High Speed Ethernet (IEC 61158), the process-control fieldbus mapping onto
|
|
6
|
+
* TCP + UDP ports 1089/1090/1091. Every HSE frame carries an FDA (Field Device Access) message, which
|
|
7
|
+
* begins with a 12-octet FDA Message Header (FF-588 §6.3 / Wireshark `ff` dissector layout):
|
|
8
|
+
*
|
|
9
|
+
* 0 Version (1 octet) FDA message version
|
|
10
|
+
* 1 Options (1 octet) trailer-presence bitmap + pad length; bit fields are
|
|
11
|
+
* 0x80 msg-num, 0x40 invoke-id, 0x20 timestamp,
|
|
12
|
+
* 0x10 reserved, 0x08 ext-ctrl, 0x07 pad length —
|
|
13
|
+
* kept as the whole octet so every bit round-trips
|
|
14
|
+
* 2 Protocol Id And Confirmed Type (1 octet) 0xFC protocol id (FDA/SM/FMS/LAN), 0x03 confirmed msg type
|
|
15
|
+
* 3 Service (1 octet) 0x80 confirmed flag, 0x7F service id
|
|
16
|
+
* 4..7 FDA Address (4 octets) session/address handle, kept as hex (BASE_HEX)
|
|
17
|
+
* 8..11 Message Length (4 octets) total octet count of the whole FDA message (this
|
|
18
|
+
* 12-octet header + service body + trailer)
|
|
19
|
+
*
|
|
20
|
+
* The service-specific body (and any optional trailer selected by the Options bits) follows the header.
|
|
21
|
+
* Its layout is per protocol id + service id and needs cross-message session context, so this
|
|
22
|
+
* single-message codec keeps everything after the header verbatim as `body` hex (byte-perfect) and does
|
|
23
|
+
* not sub-decode it (a later enrichment). Message Length delimits this layer: the FDA message ends at
|
|
24
|
+
* `Message Length` octets, so a second pipelined FDA message or trailing/padding bytes are left to the
|
|
25
|
+
* codec's recursion / RawData rather than swallowed. Message Length is honored when supplied (a crafted
|
|
26
|
+
* frame may lie) else derived from the header + body on encode. A well-formed message round-trips
|
|
27
|
+
* byte-for-byte.
|
|
28
|
+
*
|
|
29
|
+
* Transport framing is identical over TCP and UDP — the FDA message has no record/length prefix of its
|
|
30
|
+
* own (unlike Kerberos/SunRPC over TCP); Message Length is the sole delimiter. The only transport-aware
|
|
31
|
+
* detail is the payload bound: over UDP the message is capped by (udp.length − 8) so Ethernet padding is
|
|
32
|
+
* never read into `body`; over TCP it is capped by the captured stream bytes.
|
|
33
|
+
*/
|
|
34
|
+
export declare class FoundationFieldbusHSE extends BaseHeader {
|
|
35
|
+
#private;
|
|
36
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly nickname: string;
|
|
40
|
+
readonly matchKeys: string[];
|
|
41
|
+
match(): boolean;
|
|
42
|
+
readonly demuxProducers: DemuxProducer[];
|
|
43
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FoundationFieldbusHSE = 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
|
+
* FOUNDATION Fieldbus HSE — High Speed Ethernet (IEC 61158), the process-control fieldbus mapping onto
|
|
12
|
+
* TCP + UDP ports 1089/1090/1091. Every HSE frame carries an FDA (Field Device Access) message, which
|
|
13
|
+
* begins with a 12-octet FDA Message Header (FF-588 §6.3 / Wireshark `ff` dissector layout):
|
|
14
|
+
*
|
|
15
|
+
* 0 Version (1 octet) FDA message version
|
|
16
|
+
* 1 Options (1 octet) trailer-presence bitmap + pad length; bit fields are
|
|
17
|
+
* 0x80 msg-num, 0x40 invoke-id, 0x20 timestamp,
|
|
18
|
+
* 0x10 reserved, 0x08 ext-ctrl, 0x07 pad length —
|
|
19
|
+
* kept as the whole octet so every bit round-trips
|
|
20
|
+
* 2 Protocol Id And Confirmed Type (1 octet) 0xFC protocol id (FDA/SM/FMS/LAN), 0x03 confirmed msg type
|
|
21
|
+
* 3 Service (1 octet) 0x80 confirmed flag, 0x7F service id
|
|
22
|
+
* 4..7 FDA Address (4 octets) session/address handle, kept as hex (BASE_HEX)
|
|
23
|
+
* 8..11 Message Length (4 octets) total octet count of the whole FDA message (this
|
|
24
|
+
* 12-octet header + service body + trailer)
|
|
25
|
+
*
|
|
26
|
+
* The service-specific body (and any optional trailer selected by the Options bits) follows the header.
|
|
27
|
+
* Its layout is per protocol id + service id and needs cross-message session context, so this
|
|
28
|
+
* single-message codec keeps everything after the header verbatim as `body` hex (byte-perfect) and does
|
|
29
|
+
* not sub-decode it (a later enrichment). Message Length delimits this layer: the FDA message ends at
|
|
30
|
+
* `Message Length` octets, so a second pipelined FDA message or trailing/padding bytes are left to the
|
|
31
|
+
* codec's recursion / RawData rather than swallowed. Message Length is honored when supplied (a crafted
|
|
32
|
+
* frame may lie) else derived from the header + body on encode. A well-formed message round-trips
|
|
33
|
+
* byte-for-byte.
|
|
34
|
+
*
|
|
35
|
+
* Transport framing is identical over TCP and UDP — the FDA message has no record/length prefix of its
|
|
36
|
+
* own (unlike Kerberos/SunRPC over TCP); Message Length is the sole delimiter. The only transport-aware
|
|
37
|
+
* detail is the payload bound: over UDP the message is capped by (udp.length − 8) so Ethernet padding is
|
|
38
|
+
* never read into `body`; over TCP it is capped by the captured stream bytes.
|
|
39
|
+
*/
|
|
40
|
+
class FoundationFieldbusHSE extends BaseHeader_1.BaseHeader {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
this.id = 'ffhse';
|
|
44
|
+
this.name = 'FOUNDATION Fieldbus HSE';
|
|
45
|
+
this.nickname = 'FF-HSE';
|
|
46
|
+
//HSE FDA agent ports 1089/1090/1091 on both TCP and UDP.
|
|
47
|
+
this.matchKeys = [
|
|
48
|
+
'tcpport:1089', 'udpport:1089',
|
|
49
|
+
'tcpport:1090', 'udpport:1090',
|
|
50
|
+
'tcpport:1091', 'udpport:1091'
|
|
51
|
+
];
|
|
52
|
+
//A leaf header — the service body / trailer needs per-protocol, session-dependent parsing.
|
|
53
|
+
this.demuxProducers = [];
|
|
54
|
+
}
|
|
55
|
+
static #schemaCache;
|
|
56
|
+
get SCHEMA() {
|
|
57
|
+
return (FoundationFieldbusHSE.#schemaCache ??= FoundationFieldbusHSE.#buildSchema());
|
|
58
|
+
}
|
|
59
|
+
/** Length of the fixed FDA Message Header in octets. */
|
|
60
|
+
static #HEADER_LENGTH = 12;
|
|
61
|
+
/**
|
|
62
|
+
* Header-relative end offset of the bytes this layer may read: the captured remainder, further capped
|
|
63
|
+
* by (udp.length − 8) over UDP so a lying Message Length can never read past the real transport
|
|
64
|
+
* payload (and Ethernet padding is never swallowed into `body`). Over TCP the stream bytes are the cap.
|
|
65
|
+
*/
|
|
66
|
+
#payloadEnd() {
|
|
67
|
+
let end = this.packet.length - this.startPos;
|
|
68
|
+
const prev = this.prevCodecModule;
|
|
69
|
+
if (prev && prev.id === 'udp') {
|
|
70
|
+
const udpLength = prev.instance.length.getValue(0);
|
|
71
|
+
if (udpLength >= 8 && udpLength - 8 < end)
|
|
72
|
+
end = udpLength - 8;
|
|
73
|
+
}
|
|
74
|
+
return end < 0 ? 0 : end;
|
|
75
|
+
}
|
|
76
|
+
static #buildSchema() {
|
|
77
|
+
return {
|
|
78
|
+
type: 'object',
|
|
79
|
+
summary: 'FF-HSE ver=${version} svc=${service} len=${messageLength}',
|
|
80
|
+
properties: {
|
|
81
|
+
//FDA Message Version (FF-588 §6.3).
|
|
82
|
+
version: this.fieldUInt('version', 0, 1, 'Version'),
|
|
83
|
+
//Options: a trailer-presence bitmap (0x80 message number, 0x40 invoke id, 0x20 timestamp,
|
|
84
|
+
//0x08 extended control) plus 0x10 reserved and a 0x07 pad-length. Kept as the whole octet
|
|
85
|
+
//so every reserved/flag bit round-trips untouched.
|
|
86
|
+
options: this.fieldUInt('options', 1, 1, 'Options'),
|
|
87
|
+
//Protocol Id And Confirmed Msg Type: 0xFC = protocol id (FDA/SM/FMS/LAN dispatch),
|
|
88
|
+
//0x03 = confirmed message type. Whole octet kept so both sub-fields round-trip.
|
|
89
|
+
protocolAndType: this.fieldUInt('protocolAndType', 2, 1, 'Protocol Id And Confirmed Msg Type'),
|
|
90
|
+
//Service: 0x80 = confirmed flag, 0x7F = service id. Whole octet kept.
|
|
91
|
+
service: this.fieldUInt('service', 3, 1, 'Service'),
|
|
92
|
+
//FDA Address — a session/address handle, kept verbatim as hex (BASE_HEX in the dissector).
|
|
93
|
+
fdaAddress: this.fieldHex('fdaAddress', 4, 4, 'FDA Address'),
|
|
94
|
+
messageLength: {
|
|
95
|
+
type: 'integer',
|
|
96
|
+
label: 'Message Length',
|
|
97
|
+
minimum: 0,
|
|
98
|
+
maximum: 4294967295,
|
|
99
|
+
decode: function () {
|
|
100
|
+
this.instance.messageLength.setValue((0, BufferToNumber_1.BufferToUInt32)(this.readBytes(8, 4)));
|
|
101
|
+
},
|
|
102
|
+
encode: function () {
|
|
103
|
+
//Total octet count of the whole FDA message = 12-byte header + body. Honored when
|
|
104
|
+
//supplied (a crafted frame may lie); else derived from the body.
|
|
105
|
+
const provided = this.instance.messageLength.getValue();
|
|
106
|
+
let value = (provided !== undefined && provided !== null)
|
|
107
|
+
? provided
|
|
108
|
+
: FoundationFieldbusHSE.#HEADER_LENGTH + (0, HexToBuffer_1.HexToBuffer)(this.instance.body.getValue('')).length;
|
|
109
|
+
if (value > 4294967295) {
|
|
110
|
+
this.recordError(this.instance.messageLength.getPath(), 'Maximum value is 4294967295');
|
|
111
|
+
value = 4294967295;
|
|
112
|
+
}
|
|
113
|
+
if (value < 0) {
|
|
114
|
+
this.recordError(this.instance.messageLength.getPath(), 'Minimum value is 0');
|
|
115
|
+
value = 0;
|
|
116
|
+
}
|
|
117
|
+
this.instance.messageLength.setValue(value);
|
|
118
|
+
this.writeBytes(8, (0, NumberToBuffer_1.UInt32ToBuffer)(value));
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
//The service body + optional trailer after the 12-byte header, kept verbatim. Bounded by
|
|
122
|
+
//Message Length (the FDA message ends at that octet count) and by the transport payload, so
|
|
123
|
+
//trailing / pipelined FDA messages and Ethernet padding are left to the codec's recursion.
|
|
124
|
+
body: {
|
|
125
|
+
type: 'string',
|
|
126
|
+
label: 'Body',
|
|
127
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
128
|
+
decode: function () {
|
|
129
|
+
const payloadEnd = this.#payloadEnd();
|
|
130
|
+
const messageLength = this.instance.messageLength.getValue(0);
|
|
131
|
+
let end = messageLength;
|
|
132
|
+
if (end > payloadEnd)
|
|
133
|
+
end = payloadEnd;
|
|
134
|
+
this.instance.body.setValue(end > FoundationFieldbusHSE.#HEADER_LENGTH
|
|
135
|
+
? (0, BufferToHex_1.BufferToHex)(this.readBytes(FoundationFieldbusHSE.#HEADER_LENGTH, end - FoundationFieldbusHSE.#HEADER_LENGTH))
|
|
136
|
+
: '');
|
|
137
|
+
},
|
|
138
|
+
encode: function () {
|
|
139
|
+
const body = this.instance.body.getValue('');
|
|
140
|
+
if (body)
|
|
141
|
+
this.writeBytes(FoundationFieldbusHSE.#HEADER_LENGTH, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
match() {
|
|
148
|
+
//FF-HSE rides TCP/UDP ports 1089-1091 (selected via the port buckets). This stays a port-bucket
|
|
149
|
+
//protocol: matchKeys only, NO heuristicFallback — the FDA header has no distinctive magic to
|
|
150
|
+
//claim FF off its well-known ports, and Wireshark itself dissects these ports by port alone. The
|
|
151
|
+
//only guard is that the full 12-byte FDA Message Header fits within the transport payload (payload
|
|
152
|
+
//length, not whole-frame remainder, so Ethernet padding on a short UDP datagram does not match).
|
|
153
|
+
if (!this.prevCodecModule)
|
|
154
|
+
return false;
|
|
155
|
+
const prev = this.prevCodecModule;
|
|
156
|
+
if (prev.id !== 'tcp' && prev.id !== 'udp')
|
|
157
|
+
return false;
|
|
158
|
+
if (this.#payloadEnd() < FoundationFieldbusHSE.#HEADER_LENGTH)
|
|
159
|
+
return false;
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.FoundationFieldbusHSE = FoundationFieldbusHSE;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* GELF — Graylog Extended Log Format, the log-shipping payload Graylog and its inputs exchange over
|
|
6
|
+
* UDP port 12201. A GELF UDP datagram carries a single log message in one of three on-wire forms, told
|
|
7
|
+
* apart by the first bytes of the payload:
|
|
8
|
+
*
|
|
9
|
+
* - Chunked (magic 0x1E0F): a large message split across datagrams. The 12-byte chunk header is the
|
|
10
|
+
* 2-byte magic, an 8-byte Message ID (shared by all chunks of one message), a 1-byte Sequence Number
|
|
11
|
+
* (this chunk's index) and a 1-byte Sequence Count (total chunks), followed by this chunk's slice of
|
|
12
|
+
* the (possibly compressed) message. The receiver reassembles the slices by Message ID / Sequence.
|
|
13
|
+
* - GZIP (magic 0x1F8B): the whole datagram is a single gzip-compressed GELF JSON document.
|
|
14
|
+
* - Uncompressed: anything else — the datagram is the GELF JSON document as UTF-8 text (a `{ ... }`
|
|
15
|
+
* object). (A zlib-deflated document, magic 0x78, also falls here and is kept verbatim.)
|
|
16
|
+
*
|
|
17
|
+
* This is the minimal faithful slice: the form is detected from the leading magic and the chunk header
|
|
18
|
+
* is structured (magic / messageId / sequenceNumber / sequenceCount + chunk `data` hex); the gzip body
|
|
19
|
+
* and the uncompressed/zlib body are opaque here and kept verbatim (`payload` / `message` hex) — the
|
|
20
|
+
* chunk-reassembly, gunzip and JSON decoding are a later enrichment layered on top of this byte-perfect
|
|
21
|
+
* base. Everything is bounded by the enclosing UDP payload length so a trailing FCS/padding is not
|
|
22
|
+
* absorbed. Nothing is recomputed on encode (the Sequence Count is honored, not derived), so a
|
|
23
|
+
* well-formed datagram of any form round-trips byte-for-byte. `form` is a decode-time discriminant that
|
|
24
|
+
* writes no bytes; on encode it is honored when supplied, else inferred from which fields are present.
|
|
25
|
+
*/
|
|
26
|
+
export declare class GELF 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
|
+
match(): boolean;
|
|
34
|
+
readonly demuxProducers: DemuxProducer[];
|
|
35
|
+
}
|