@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,35 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* OpenVPN, the control/data channel protocol on UDP + TCP port 1194. Every packet begins with a single
|
|
6
|
+
* opcode/key-id octet: the high 5 bits are the opcode (1 P_CONTROL_HARD_RESET_CLIENT_V1, 2 …SERVER_V1,
|
|
7
|
+
* 3 P_CONTROL_SOFT_RESET_V1, 4 P_ACK_V1, 5 P_CONTROL_V1, 6 P_DATA_V1, 7 …HARD_RESET_CLIENT_V2,
|
|
8
|
+
* 8 …HARD_RESET_SERVER_V2, 9 P_DATA_V2) and the low 3 bits are the key id. For a control packet the
|
|
9
|
+
* octet is followed by an 8-byte session id, an optional (config-dependent) HMAC + packet-id when
|
|
10
|
+
* tls-auth/tls-crypt is used, a message-packet-id array (ACKs) and the message packet-id; a data packet
|
|
11
|
+
* carries the encrypted/authenticated payload. None of that tail is self-describing without the session's
|
|
12
|
+
* negotiated crypto parameters.
|
|
13
|
+
*
|
|
14
|
+
* Transport framing differs by L4: over UDP the OpenVPN packet is the whole datagram; over TCP a 2-byte
|
|
15
|
+
* big-endian length prefix precedes each packet (OpenVPN's own record framing on a stream). This header
|
|
16
|
+
* detects the transport via prevCodecModule.id and structures accordingly — TCP → length prefix then the
|
|
17
|
+
* packet at offset 2; UDP → the packet directly at offset 0.
|
|
18
|
+
*
|
|
19
|
+
* Byte-perfect strategy (minimal slice): structure the opcode + key-id bit split, and keep the remainder
|
|
20
|
+
* (session id / HMAC / packet-id / ack array for a control packet, or the payload for a data packet)
|
|
21
|
+
* verbatim as `body` hex, bounded by the transport payload (UDP length − 8, or 2 + the TCP length prefix).
|
|
22
|
+
* The TCP length prefix is honored when supplied (a crafted frame may lie) else derived from the encoded
|
|
23
|
+
* packet bytes; a well-formed packet round-trips byte-for-byte. Trailing / pipelined bytes are left to the
|
|
24
|
+
* codec's recursion / RawData.
|
|
25
|
+
*/
|
|
26
|
+
export declare class OpenVPN 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
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenVPN = 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
|
+
* OpenVPN, the control/data channel protocol on UDP + TCP port 1194. Every packet begins with a single
|
|
12
|
+
* opcode/key-id octet: the high 5 bits are the opcode (1 P_CONTROL_HARD_RESET_CLIENT_V1, 2 …SERVER_V1,
|
|
13
|
+
* 3 P_CONTROL_SOFT_RESET_V1, 4 P_ACK_V1, 5 P_CONTROL_V1, 6 P_DATA_V1, 7 …HARD_RESET_CLIENT_V2,
|
|
14
|
+
* 8 …HARD_RESET_SERVER_V2, 9 P_DATA_V2) and the low 3 bits are the key id. For a control packet the
|
|
15
|
+
* octet is followed by an 8-byte session id, an optional (config-dependent) HMAC + packet-id when
|
|
16
|
+
* tls-auth/tls-crypt is used, a message-packet-id array (ACKs) and the message packet-id; a data packet
|
|
17
|
+
* carries the encrypted/authenticated payload. None of that tail is self-describing without the session's
|
|
18
|
+
* negotiated crypto parameters.
|
|
19
|
+
*
|
|
20
|
+
* Transport framing differs by L4: over UDP the OpenVPN packet is the whole datagram; over TCP a 2-byte
|
|
21
|
+
* big-endian length prefix precedes each packet (OpenVPN's own record framing on a stream). This header
|
|
22
|
+
* detects the transport via prevCodecModule.id and structures accordingly — TCP → length prefix then the
|
|
23
|
+
* packet at offset 2; UDP → the packet directly at offset 0.
|
|
24
|
+
*
|
|
25
|
+
* Byte-perfect strategy (minimal slice): structure the opcode + key-id bit split, and keep the remainder
|
|
26
|
+
* (session id / HMAC / packet-id / ack array for a control packet, or the payload for a data packet)
|
|
27
|
+
* verbatim as `body` hex, bounded by the transport payload (UDP length − 8, or 2 + the TCP length prefix).
|
|
28
|
+
* The TCP length prefix is honored when supplied (a crafted frame may lie) else derived from the encoded
|
|
29
|
+
* packet bytes; a well-formed packet round-trips byte-for-byte. Trailing / pipelined bytes are left to the
|
|
30
|
+
* codec's recursion / RawData.
|
|
31
|
+
*/
|
|
32
|
+
class OpenVPN extends BaseHeader_1.BaseHeader {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.id = 'openvpn';
|
|
36
|
+
this.name = 'OpenVPN Protocol';
|
|
37
|
+
this.nickname = 'OpenVPN';
|
|
38
|
+
//OpenVPN's default port 1194 on both UDP and TCP.
|
|
39
|
+
this.matchKeys = ['udpport:1194', 'tcpport:1194'];
|
|
40
|
+
//A leaf header — the control/data tail requires the session's negotiated crypto parameters to parse.
|
|
41
|
+
this.demuxProducers = [];
|
|
42
|
+
}
|
|
43
|
+
static #schemaCache;
|
|
44
|
+
get SCHEMA() {
|
|
45
|
+
return (OpenVPN.#schemaCache ??= OpenVPN.#buildSchema());
|
|
46
|
+
}
|
|
47
|
+
/** True when this OpenVPN packet rides on TCP (a 2-byte big-endian length prefix precedes the packet). */
|
|
48
|
+
#isTcp() {
|
|
49
|
+
return !!this.prevCodecModule && this.prevCodecModule.id === 'tcp';
|
|
50
|
+
}
|
|
51
|
+
/** Offset of the OpenVPN packet within this header: 2 bytes past startPos for TCP, 0 for UDP. */
|
|
52
|
+
#packetOffset() {
|
|
53
|
+
return this.#isTcp() ? 2 : 0;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Header-relative end offset of the bytes this OpenVPN layer consumes, so a lying length never reads
|
|
57
|
+
* past the real transport payload and trailing / pipelined data is left to the codec. Over UDP the
|
|
58
|
+
* bound is (udp.length − 8); over TCP it is 2 (length prefix) + the length carried in that prefix;
|
|
59
|
+
* both clamped to the captured bytes.
|
|
60
|
+
*/
|
|
61
|
+
#payloadEnd() {
|
|
62
|
+
let end = this.packet.length - this.startPos;
|
|
63
|
+
const prev = this.prevCodecModule;
|
|
64
|
+
if (prev && prev.id === 'udp') {
|
|
65
|
+
const udpLength = prev.instance.length.getValue(0);
|
|
66
|
+
if (udpLength >= 8 && udpLength - 8 < end)
|
|
67
|
+
end = udpLength - 8;
|
|
68
|
+
}
|
|
69
|
+
else if (prev && prev.id === 'tcp') {
|
|
70
|
+
if (end >= 2) {
|
|
71
|
+
const prefix = (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(0, 2, true));
|
|
72
|
+
const total = 2 + prefix;
|
|
73
|
+
if (total < end)
|
|
74
|
+
end = total;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return end < 0 ? 0 : end;
|
|
78
|
+
}
|
|
79
|
+
static #buildSchema() {
|
|
80
|
+
return {
|
|
81
|
+
type: 'object',
|
|
82
|
+
summary: 'OpenVPN opcode=${opcode} keyId=${keyId}',
|
|
83
|
+
properties: {
|
|
84
|
+
//==== TCP-only 2-byte big-endian record length prefix ====
|
|
85
|
+
//The number of OpenVPN packet bytes that follow this prefix. Absent over UDP.
|
|
86
|
+
length: {
|
|
87
|
+
type: 'integer',
|
|
88
|
+
label: 'Length',
|
|
89
|
+
minimum: 0,
|
|
90
|
+
maximum: 65535,
|
|
91
|
+
decode: function () {
|
|
92
|
+
if (!this.#isTcp())
|
|
93
|
+
return;
|
|
94
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(0, 2)));
|
|
95
|
+
},
|
|
96
|
+
encode: function () {
|
|
97
|
+
if (!this.#isTcp())
|
|
98
|
+
return;
|
|
99
|
+
const provided = this.instance.length.getValue();
|
|
100
|
+
if (provided !== undefined && provided !== null) {
|
|
101
|
+
//Honored verbatim (a crafted frame may lie about the record length).
|
|
102
|
+
let value = provided;
|
|
103
|
+
if (value > 65535) {
|
|
104
|
+
this.recordError(this.instance.length.getPath(), 'Maximum value is 65535');
|
|
105
|
+
value = 65535;
|
|
106
|
+
}
|
|
107
|
+
if (value < 0) {
|
|
108
|
+
this.recordError(this.instance.length.getPath(), 'Minimum value is 0');
|
|
109
|
+
value = 0;
|
|
110
|
+
}
|
|
111
|
+
this.instance.length.setValue(value);
|
|
112
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
//Derive after the packet bytes are written: the prefix counts exactly the
|
|
116
|
+
//OpenVPN packet (everything after this 2-byte prefix).
|
|
117
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(0));
|
|
118
|
+
this.addPostSelfEncodeHandler(() => {
|
|
119
|
+
const packetLength = this.headerLength - 2;
|
|
120
|
+
const value = packetLength > 0 ? (packetLength > 65535 ? 65535 : packetLength) : 0;
|
|
121
|
+
this.instance.length.setValue(value);
|
|
122
|
+
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
|
|
123
|
+
}, 0);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
//==== opcode/key-id octet ====
|
|
128
|
+
//High 5 bits: the packet opcode (message type). Any value 0-31 is emitted faithfully.
|
|
129
|
+
opcode: {
|
|
130
|
+
type: 'integer',
|
|
131
|
+
label: 'Opcode',
|
|
132
|
+
minimum: 0,
|
|
133
|
+
maximum: 31,
|
|
134
|
+
decode: function () {
|
|
135
|
+
this.instance.opcode.setValue(this.readBits(this.#packetOffset(), 1, 0, 5));
|
|
136
|
+
},
|
|
137
|
+
encode: function () {
|
|
138
|
+
const node = this.instance.opcode;
|
|
139
|
+
let value = node.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
140
|
+
if (value > 31) {
|
|
141
|
+
this.recordError(node.getPath(), 'Maximum value is 31');
|
|
142
|
+
value = 31;
|
|
143
|
+
}
|
|
144
|
+
if (value < 0) {
|
|
145
|
+
this.recordError(node.getPath(), 'Minimum value is 0');
|
|
146
|
+
value = 0;
|
|
147
|
+
}
|
|
148
|
+
node.setValue(value);
|
|
149
|
+
this.writeBits(this.#packetOffset(), 1, 0, 5, value);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
//Low 3 bits: the key id selecting the negotiated crypto key set (0-7).
|
|
153
|
+
keyId: {
|
|
154
|
+
type: 'integer',
|
|
155
|
+
label: 'Key ID',
|
|
156
|
+
minimum: 0,
|
|
157
|
+
maximum: 7,
|
|
158
|
+
decode: function () {
|
|
159
|
+
this.instance.keyId.setValue(this.readBits(this.#packetOffset(), 1, 5, 3));
|
|
160
|
+
},
|
|
161
|
+
encode: function () {
|
|
162
|
+
const node = this.instance.keyId;
|
|
163
|
+
let value = node.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
164
|
+
if (value > 7) {
|
|
165
|
+
this.recordError(node.getPath(), 'Maximum value is 7');
|
|
166
|
+
value = 7;
|
|
167
|
+
}
|
|
168
|
+
if (value < 0) {
|
|
169
|
+
this.recordError(node.getPath(), 'Minimum value is 0');
|
|
170
|
+
value = 0;
|
|
171
|
+
}
|
|
172
|
+
node.setValue(value);
|
|
173
|
+
this.writeBits(this.#packetOffset(), 1, 5, 3, value);
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
//The remainder kept verbatim: for a control packet the session id + optional HMAC/packet-id
|
|
177
|
+
//+ ack array + message packet-id; for a data packet the encrypted payload. Bounded by
|
|
178
|
+
//#payloadEnd so a lying length can't read past the transport payload.
|
|
179
|
+
body: {
|
|
180
|
+
type: 'string',
|
|
181
|
+
label: 'Body',
|
|
182
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
183
|
+
decode: function () {
|
|
184
|
+
const start = this.#packetOffset() + 1;
|
|
185
|
+
const end = this.#payloadEnd();
|
|
186
|
+
this.instance.body.setValue(end > start ? (0, BufferToHex_1.BufferToHex)(this.readBytes(start, end - start)) : '');
|
|
187
|
+
},
|
|
188
|
+
encode: function () {
|
|
189
|
+
const start = this.#packetOffset() + 1;
|
|
190
|
+
const body = this.instance.body.getValue('');
|
|
191
|
+
if (body)
|
|
192
|
+
this.writeBytes(start, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
match() {
|
|
199
|
+
//OpenVPN rides UDP/TCP port 1194 (selected via the udpport:1194 / tcpport:1194 buckets). This
|
|
200
|
+
//stays a port-bucket protocol: matchKeys only, NO heuristicFallback — the opcode/key-id octet is
|
|
201
|
+
//too weak a signature to claim OpenVPN off port 1194. Over TCP the packet sits after the 2-byte
|
|
202
|
+
//length prefix; over UDP it is the first byte. Require at least the opcode octet within the
|
|
203
|
+
//transport payload.
|
|
204
|
+
if (!this.prevCodecModule)
|
|
205
|
+
return false;
|
|
206
|
+
const isTcp = this.prevCodecModule.id === 'tcp';
|
|
207
|
+
const isUdp = this.prevCodecModule.id === 'udp';
|
|
208
|
+
if (!isTcp && !isUdp)
|
|
209
|
+
return false;
|
|
210
|
+
const offset = isTcp ? 2 : 0;
|
|
211
|
+
return this.#payloadEnd() >= offset + 1;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.OpenVPN = OpenVPN;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* PCWorx (Phoenix Contact ILC / AXC classic PLC engineering protocol), TCP port 1962. There is no
|
|
6
|
+
* public authoritative specification for PCWorx; the on-wire framing used here is reverse-engineered
|
|
7
|
+
* from the Digital Bond "Redpoint" pcworx-info.nse scanner and the OpenVAS "PCWorx Detection (TCP)"
|
|
8
|
+
* probe, which agree on a fixed 4-byte message header:
|
|
9
|
+
*
|
|
10
|
+
* offset 0 opcode (1 byte) — leading message opcode; 0x01 in every observed PCWorx frame
|
|
11
|
+
* offset 1 service (1 byte) — service / sequence byte. Requests use small values (Redpoint's
|
|
12
|
+
* three-step probe sends 0x01, 0x05, 0x06); a response sets the high
|
|
13
|
+
* bit (the scanner validates a reply by testing this byte == 0x81).
|
|
14
|
+
* offset 2 length (2 bytes, big-endian) — the TOTAL message length in octets INCLUDING this
|
|
15
|
+
* 4-byte header (verified on Redpoint's requests: 0x001a=26 = 4+22,
|
|
16
|
+
* 0x0016=22 = 4+18, 0x000e=14 = 4+10).
|
|
17
|
+
*
|
|
18
|
+
* followed by `length - 4` bytes of opcode/service-specific body (session id, string-table indices,
|
|
19
|
+
* null-terminated PLC-type / firmware / model strings — all cross-message, session-stateful, and not
|
|
20
|
+
* publicly documented). This single-message codec therefore keeps the body verbatim as `body` hex
|
|
21
|
+
* (byte-perfect) and does not sub-decode it. The Length is auto-computed (4 + body) on encode when not
|
|
22
|
+
* supplied, else honored verbatim (a crafted message may lie); the message is bounded by Length so a
|
|
23
|
+
* pipelined/trailing message is left to the codec's recursion / RawData. A well-formed message
|
|
24
|
+
* round-trips byte-for-byte.
|
|
25
|
+
*/
|
|
26
|
+
export declare class PCWorx 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
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PCWorx = 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
|
+
* PCWorx (Phoenix Contact ILC / AXC classic PLC engineering protocol), TCP port 1962. There is no
|
|
12
|
+
* public authoritative specification for PCWorx; the on-wire framing used here is reverse-engineered
|
|
13
|
+
* from the Digital Bond "Redpoint" pcworx-info.nse scanner and the OpenVAS "PCWorx Detection (TCP)"
|
|
14
|
+
* probe, which agree on a fixed 4-byte message header:
|
|
15
|
+
*
|
|
16
|
+
* offset 0 opcode (1 byte) — leading message opcode; 0x01 in every observed PCWorx frame
|
|
17
|
+
* offset 1 service (1 byte) — service / sequence byte. Requests use small values (Redpoint's
|
|
18
|
+
* three-step probe sends 0x01, 0x05, 0x06); a response sets the high
|
|
19
|
+
* bit (the scanner validates a reply by testing this byte == 0x81).
|
|
20
|
+
* offset 2 length (2 bytes, big-endian) — the TOTAL message length in octets INCLUDING this
|
|
21
|
+
* 4-byte header (verified on Redpoint's requests: 0x001a=26 = 4+22,
|
|
22
|
+
* 0x0016=22 = 4+18, 0x000e=14 = 4+10).
|
|
23
|
+
*
|
|
24
|
+
* followed by `length - 4` bytes of opcode/service-specific body (session id, string-table indices,
|
|
25
|
+
* null-terminated PLC-type / firmware / model strings — all cross-message, session-stateful, and not
|
|
26
|
+
* publicly documented). This single-message codec therefore keeps the body verbatim as `body` hex
|
|
27
|
+
* (byte-perfect) and does not sub-decode it. The Length is auto-computed (4 + body) on encode when not
|
|
28
|
+
* supplied, else honored verbatim (a crafted message may lie); the message is bounded by Length so a
|
|
29
|
+
* pipelined/trailing message is left to the codec's recursion / RawData. A well-formed message
|
|
30
|
+
* round-trips byte-for-byte.
|
|
31
|
+
*/
|
|
32
|
+
class PCWorx extends BaseHeader_1.BaseHeader {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
this.id = 'pcworx';
|
|
36
|
+
this.name = 'PCWorx';
|
|
37
|
+
this.nickname = 'PCWorx';
|
|
38
|
+
this.matchKeys = ['tcpport:1962'];
|
|
39
|
+
//A leaf header — the body is session-stateful and not publicly specified; kept as hex, not demuxed.
|
|
40
|
+
this.demuxProducers = [];
|
|
41
|
+
}
|
|
42
|
+
static #schemaCache;
|
|
43
|
+
get SCHEMA() {
|
|
44
|
+
return (PCWorx.#schemaCache ??= PCWorx.#buildSchema());
|
|
45
|
+
}
|
|
46
|
+
static #buildSchema() {
|
|
47
|
+
return {
|
|
48
|
+
type: 'object',
|
|
49
|
+
summary: 'PCWorx op=${opcode} svc=${service} len=${length}',
|
|
50
|
+
properties: {
|
|
51
|
+
//Leading message opcode (0x01 in every observed PCWorx frame). Kept as a plain uint8
|
|
52
|
+
//(no enum) so any on-wire value still decodes and re-encodes.
|
|
53
|
+
opcode: this.fieldUInt('opcode', 0, 1, 'Opcode'),
|
|
54
|
+
//Service / sequence byte. Requests carry small values; a response sets the high bit
|
|
55
|
+
//(0x81). Kept as a plain uint8 so both directions round-trip.
|
|
56
|
+
service: this.fieldUInt('service', 1, 1, 'Service'),
|
|
57
|
+
length: {
|
|
58
|
+
type: 'integer',
|
|
59
|
+
label: 'Length',
|
|
60
|
+
minimum: 0,
|
|
61
|
+
maximum: 65535,
|
|
62
|
+
decode: function () {
|
|
63
|
+
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(2, 2)));
|
|
64
|
+
},
|
|
65
|
+
encode: function () {
|
|
66
|
+
//Length counts the WHOLE message = 4-byte header + body. Honored when supplied
|
|
67
|
+
//(a crafted message may lie); else derived from the body.
|
|
68
|
+
const provided = this.instance.length.getValue();
|
|
69
|
+
let value = (provided !== undefined && provided !== null)
|
|
70
|
+
? provided
|
|
71
|
+
: 4 + (0, HexToBuffer_1.HexToBuffer)(this.instance.body.getValue('')).length;
|
|
72
|
+
if (value > 65535) {
|
|
73
|
+
this.recordError(this.instance.length.getPath(), 'Maximum value is 65535');
|
|
74
|
+
value = 65535;
|
|
75
|
+
}
|
|
76
|
+
this.instance.length.setValue(value);
|
|
77
|
+
this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(value));
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
//The opcode/service-specific body after the 4-byte header, kept verbatim. Bounded by the
|
|
81
|
+
//message Length (the message ends at offset Length) and the captured bytes, so trailing /
|
|
82
|
+
//pipelined data is left to the codec's recursion / RawData.
|
|
83
|
+
body: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
label: 'Body',
|
|
86
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
87
|
+
decode: function () {
|
|
88
|
+
const remaining = this.packet.length - this.startPos;
|
|
89
|
+
const length = this.instance.length.getValue(0);
|
|
90
|
+
let end = length;
|
|
91
|
+
if (end > remaining)
|
|
92
|
+
end = remaining;
|
|
93
|
+
this.instance.body.setValue(end > 4 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(4, end - 4)) : '');
|
|
94
|
+
},
|
|
95
|
+
encode: function () {
|
|
96
|
+
const body = this.instance.body.getValue('');
|
|
97
|
+
if (body)
|
|
98
|
+
this.writeBytes(4, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
match() {
|
|
105
|
+
//PCWorx rides on TCP port 1962. The 4-byte header carries no strong content magic (opcode is
|
|
106
|
+
//0x01 but that is far too weak to key on off-port), so the well-known port is the signature:
|
|
107
|
+
//require the full 4-byte header to be present so a too-short segment falls through to raw.
|
|
108
|
+
//Selection stays port-bucketed (matchKeys) like the other length-bounded TCP payload codecs;
|
|
109
|
+
//no heuristicFallback.
|
|
110
|
+
if (!this.prevCodecModule || this.prevCodecModule.id !== 'tcp')
|
|
111
|
+
return false;
|
|
112
|
+
return this.packet.length - this.startPos >= 4;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.PCWorx = PCWorx;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* PIM — Protocol Independent Multicast, Sparse Mode version 2 (RFC 7761), carried directly over IP as
|
|
6
|
+
* protocol 103. Every PIM message begins with a fixed 4-byte header: a byte whose high nibble is the
|
|
7
|
+
* Version (2 for PIMv2) and low nibble is the message Type, a Reserved byte, and a 2-byte Checksum,
|
|
8
|
+
* followed by the type-specific body.
|
|
9
|
+
*
|
|
10
|
+
* Type selects the body layout — 0 Hello, 1 Register, 2 Register-Stop, 3 Join/Prune, 4 Bootstrap,
|
|
11
|
+
* 5 Assert, 8 Candidate-RP-Advertisement — and several bodies embed Encoded-Address / Encoded-Group /
|
|
12
|
+
* Encoded-Source structures whose parsing depends on address-family and PIM-neighbour context, so this
|
|
13
|
+
* single-message codec keeps the body verbatim as `body` hex (byte-perfect) and does not sub-decode it.
|
|
14
|
+
* The Checksum and Reserved byte are honored verbatim, never recomputed (encode is a faithful executor);
|
|
15
|
+
* a well-formed PIM message round-trips byte-for-byte. The body is bounded by the enclosing IP payload
|
|
16
|
+
* so a trailing FCS / pipelined data is left to the codec's recursion / RawData.
|
|
17
|
+
*/
|
|
18
|
+
export declare class PIM extends BaseHeader {
|
|
19
|
+
#private;
|
|
20
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly nickname: string;
|
|
24
|
+
readonly matchKeys: string[];
|
|
25
|
+
match(): boolean;
|
|
26
|
+
readonly demuxProducers: DemuxProducer[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PIM = 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
|
+
* PIM — Protocol Independent Multicast, Sparse Mode version 2 (RFC 7761), carried directly over IP as
|
|
10
|
+
* protocol 103. Every PIM message begins with a fixed 4-byte header: a byte whose high nibble is the
|
|
11
|
+
* Version (2 for PIMv2) and low nibble is the message Type, a Reserved byte, and a 2-byte Checksum,
|
|
12
|
+
* followed by the type-specific body.
|
|
13
|
+
*
|
|
14
|
+
* Type selects the body layout — 0 Hello, 1 Register, 2 Register-Stop, 3 Join/Prune, 4 Bootstrap,
|
|
15
|
+
* 5 Assert, 8 Candidate-RP-Advertisement — and several bodies embed Encoded-Address / Encoded-Group /
|
|
16
|
+
* Encoded-Source structures whose parsing depends on address-family and PIM-neighbour context, so this
|
|
17
|
+
* single-message codec keeps the body verbatim as `body` hex (byte-perfect) and does not sub-decode it.
|
|
18
|
+
* The Checksum and Reserved byte are honored verbatim, never recomputed (encode is a faithful executor);
|
|
19
|
+
* a well-formed PIM message round-trips byte-for-byte. The body is bounded by the enclosing IP payload
|
|
20
|
+
* so a trailing FCS / pipelined data is left to the codec's recursion / RawData.
|
|
21
|
+
*/
|
|
22
|
+
class PIM extends BaseHeader_1.BaseHeader {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.id = 'pim';
|
|
26
|
+
this.name = 'Protocol Independent Multicast';
|
|
27
|
+
this.nickname = 'PIM';
|
|
28
|
+
this.matchKeys = ['ipproto:103'];
|
|
29
|
+
//A leaf header — the type-specific body (Encoded-Address structures, RP sets, …) needs per-type,
|
|
30
|
+
//address-family-dependent parsing. Inner recursion is deferred to a later serial slice.
|
|
31
|
+
this.demuxProducers = [];
|
|
32
|
+
}
|
|
33
|
+
static #schemaCache;
|
|
34
|
+
get SCHEMA() {
|
|
35
|
+
return (PIM.#schemaCache ??= PIM.#buildSchema());
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Bytes the IP layer below says are available to PIM. IPv4 carries a total-length field, so the PIM
|
|
39
|
+
* payload is (total length - IP header length); IPv6 carries the payload length directly (plen).
|
|
40
|
+
* Mirrors the GRE #available() pattern so the body decode is bounded by the real on-wire length
|
|
41
|
+
* rather than reading to the end of the captured frame (which would swallow Ethernet padding / FCS).
|
|
42
|
+
* Returns the captured remainder when neither IP length is present.
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
#available() {
|
|
46
|
+
let available = this.packet.length - this.startPos;
|
|
47
|
+
const prev = this.prevCodecModule;
|
|
48
|
+
if (prev && prev.id === 'ipv4') {
|
|
49
|
+
const ipPayload = prev.instance.length.getValue(0) - prev.length;
|
|
50
|
+
if (ipPayload >= 0 && ipPayload < available)
|
|
51
|
+
available = ipPayload;
|
|
52
|
+
}
|
|
53
|
+
else if (prev && prev.id === 'ipv6') {
|
|
54
|
+
const ipPayload = prev.instance.plen.getValue(0);
|
|
55
|
+
if (ipPayload >= 0 && ipPayload < available)
|
|
56
|
+
available = ipPayload;
|
|
57
|
+
}
|
|
58
|
+
return available < 0 ? 0 : available;
|
|
59
|
+
}
|
|
60
|
+
static #buildSchema() {
|
|
61
|
+
return {
|
|
62
|
+
type: 'object',
|
|
63
|
+
summary: 'PIM v${version} type=${type}',
|
|
64
|
+
properties: {
|
|
65
|
+
//Byte 0: high nibble Version (2 for PIMv2), low nibble Type.
|
|
66
|
+
version: {
|
|
67
|
+
type: 'integer',
|
|
68
|
+
label: 'Version',
|
|
69
|
+
minimum: 0,
|
|
70
|
+
maximum: 15,
|
|
71
|
+
decode: function () {
|
|
72
|
+
this.instance.version.setValue(this.readBits(0, 1, 0, 4));
|
|
73
|
+
},
|
|
74
|
+
encode: function () {
|
|
75
|
+
const value = this.instance.version.getValue(2);
|
|
76
|
+
this.instance.version.setValue(value);
|
|
77
|
+
this.writeBits(0, 1, 0, 4, value);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
type: {
|
|
81
|
+
type: 'integer',
|
|
82
|
+
label: 'Type',
|
|
83
|
+
minimum: 0,
|
|
84
|
+
maximum: 15,
|
|
85
|
+
decode: function () {
|
|
86
|
+
this.instance.type.setValue(this.readBits(0, 1, 4, 4));
|
|
87
|
+
},
|
|
88
|
+
encode: function () {
|
|
89
|
+
const value = this.instance.type.getValue(0);
|
|
90
|
+
this.instance.type.setValue(value);
|
|
91
|
+
this.writeBits(0, 1, 4, 4, value);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
//Byte 1: Reserved (0 on transmit for most types, a flags/subtype byte for a few). Kept
|
|
95
|
+
//verbatim and re-emitted so a non-canonical frame is still byte-perfect.
|
|
96
|
+
reserved: this.fieldHex('reserved', 1, 1, 'Reserved'),
|
|
97
|
+
//Bytes 2-3: Checksum (ones-complement over the PIM message). Honored verbatim, never
|
|
98
|
+
//recomputed, so a captured message round-trips byte-for-byte.
|
|
99
|
+
checksum: this.fieldUInt('checksum', 2, 2, 'Checksum'),
|
|
100
|
+
//The type-specific body after the 4-byte header, kept verbatim. Bounded by the enclosing
|
|
101
|
+
//IP payload (#available) so trailing FCS / pipelined data is left to the codec's recursion.
|
|
102
|
+
body: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
label: 'Body',
|
|
105
|
+
contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
|
|
106
|
+
decode: function () {
|
|
107
|
+
const end = this.#available();
|
|
108
|
+
this.instance.body.setValue(end > 4 ? (0, BufferToHex_1.BufferToHex)(this.readBytes(4, end - 4)) : '');
|
|
109
|
+
},
|
|
110
|
+
encode: function () {
|
|
111
|
+
const body = this.instance.body.getValue('');
|
|
112
|
+
if (body)
|
|
113
|
+
this.writeBytes(4, (0, HexToBuffer_1.HexToBuffer)(body));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
match() {
|
|
120
|
+
//PIM sits directly above IPv4 (protocol field) or IPv6 (next-header field) with protocol 103,
|
|
121
|
+
//and needs at least its 4-byte fixed header within the IP payload.
|
|
122
|
+
if (!this.prevCodecModule)
|
|
123
|
+
return false;
|
|
124
|
+
if (this.prevCodecModule.instance.protocol.getValue() !== 103 && this.prevCodecModule.instance.nxt.getValue() !== 103)
|
|
125
|
+
return false;
|
|
126
|
+
return this.#available() >= 4;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.PIM = PIM;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
2
|
+
import { ProtocolJSONSchema } from '../schema/ProtocolJSONSchema';
|
|
3
|
+
import { DemuxProducer } from '../types/DemuxProducer';
|
|
4
|
+
/**
|
|
5
|
+
* POP3 — the Post Office Protocol version 3 (RFC 1939), carried as US-ASCII text over TCP well-known
|
|
6
|
+
* port 110 (or 995 for the TLS-wrapped POP3S bucket). The control channel is line-based: a client sends
|
|
7
|
+
* commands (`USER alice\r\n`, `PASS x\r\n`, `RETR 1\r\n`, `QUIT\r\n`, …) and a server sends replies whose
|
|
8
|
+
* syntax DIFFERS from FTP/SMTP — instead of a 3-digit code, a POP3 reply is a status indicator:
|
|
9
|
+
* `+OK ...\r\n` (success) or `-ERR ...\r\n` (failure).
|
|
10
|
+
*
|
|
11
|
+
* Like FTP, Syslog, SIP and HTTP, the message is text whose full internal structure (arbitrary arguments,
|
|
12
|
+
* significant whitespace, multi-line RETR/LIST responses) is richer than a form needs. So the ENTIRE raw
|
|
13
|
+
* message is kept verbatim as the authoritative `message` field (hex) and re-emitted untouched; only the
|
|
14
|
+
* first line is parsed on decode into display-only metadata (command/argument for a command,
|
|
15
|
+
* status/replyText for a reply). Encode never reconstructs the message from the parsed fields — it writes
|
|
16
|
+
* `message` back byte-for-byte — so any conformant (or even malformed) POP3 line round-trips exactly.
|
|
17
|
+
*
|
|
18
|
+
* Note: a single TCP segment may carry more than one line or only part of a multi-line response;
|
|
19
|
+
* reassembly across segments is out of scope. This single-segment codec keeps whatever bytes are present
|
|
20
|
+
* verbatim, which is byte-perfect for the single-packet case.
|
|
21
|
+
*/
|
|
22
|
+
export declare class POP3 extends BaseHeader {
|
|
23
|
+
#private;
|
|
24
|
+
get SCHEMA(): ProtocolJSONSchema;
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly nickname: string;
|
|
28
|
+
readonly matchKeys: string[];
|
|
29
|
+
match(): boolean;
|
|
30
|
+
readonly demuxProducers: DemuxProducer[];
|
|
31
|
+
}
|