netkitty 0.0.35 → 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 +13 -0
- package/README.md +91 -2
- package/README.zh-CN.md +89 -0
- package/dist/analysis.d.ts +4 -0
- package/dist/{CodecHeaderExports.js → analysis.js} +4 -1
- package/dist/capture.d.ts +5 -0
- package/dist/capture.js +21 -0
- package/dist/codec.d.ts +5 -0
- package/dist/codec.js +21 -0
- package/dist/iface.d.ts +4 -0
- package/dist/iface.js +20 -0
- package/dist/pcap.d.ts +10 -0
- package/dist/pcap.js +27 -0
- package/dist/replay.d.ts +5 -0
- package/dist/replay.js +21 -0
- package/package.json +65 -59
- package/.eslintrc.json +0 -53
- package/.idea/codeStyles/Project.xml +0 -18
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -11
- package/.idea/modules.xml +0 -8
- package/.idea/netkitty.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/assets/NetKitty.png +0 -0
- package/binding.gyp +0 -5
- package/cpp/nodepcap/deps/include/Packet32.h +0 -429
- package/cpp/nodepcap/deps/include/pcap/bluetooth.h +0 -56
- package/cpp/nodepcap/deps/include/pcap/bpf.h +0 -292
- package/cpp/nodepcap/deps/include/pcap/can_socketcan.h +0 -56
- package/cpp/nodepcap/deps/include/pcap/compiler-tests.h +0 -163
- package/cpp/nodepcap/deps/include/pcap/dlt.h +0 -1514
- package/cpp/nodepcap/deps/include/pcap/funcattrs.h +0 -325
- package/cpp/nodepcap/deps/include/pcap/ipnet.h +0 -43
- package/cpp/nodepcap/deps/include/pcap/namedb.h +0 -84
- package/cpp/nodepcap/deps/include/pcap/nflog.h +0 -94
- package/cpp/nodepcap/deps/include/pcap/pcap-inttypes.h +0 -101
- package/cpp/nodepcap/deps/include/pcap/pcap.h +0 -1219
- package/cpp/nodepcap/deps/include/pcap/sll.h +0 -149
- package/cpp/nodepcap/deps/include/pcap/socket.h +0 -84
- package/cpp/nodepcap/deps/include/pcap/usb.h +0 -143
- package/cpp/nodepcap/deps/include/pcap/vlan.h +0 -46
- package/cpp/nodepcap/deps/include/pcap-bpf.h +0 -45
- package/cpp/nodepcap/deps/include/pcap-namedb.h +0 -40
- package/cpp/nodepcap/deps/include/pcap.h +0 -43
- package/cpp/nodepcap/deps/lib/ARM64/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/wpcap.lib +0 -0
- package/cpp/nodepcap/deps/lib/x64/Packet.lib +0 -0
- package/cpp/nodepcap/deps/lib/x64/wpcap.lib +0 -0
- package/cpp/nodepcap/nodepcap.gypi +0 -104
- package/cpp/nodepcap/src/binding.cc +0 -14
- package/cpp/nodepcap/src/capture.cc +0 -400
- package/cpp/nodepcap/src/capture.h +0 -53
- package/cpp/nodepcap/src/utils.cc +0 -218
- package/cpp/nodepcap/src/utils.h +0 -13
- package/dist/CodecExports.d.ts +0 -34
- package/dist/CodecExports.d.ts.map +0 -1
- package/dist/CodecExports.js +0 -23
- package/dist/CodecHeaderExports.d.ts +0 -2
- package/dist/CodecHeaderExports.d.ts.map +0 -1
- package/dist/HelperExports.d.ts +0 -11
- package/dist/HelperExports.d.ts.map +0 -1
- package/dist/HelperExports.js +0 -72
- package/dist/NetworkExports.d.ts +0 -13
- package/dist/NetworkExports.d.ts.map +0 -1
- package/dist/NetworkExports.js +0 -13
- package/dist/PcapExports.d.ts +0 -30
- package/dist/PcapExports.d.ts.map +0 -1
- package/dist/PcapExports.js +0 -33
- package/dist/errors/ActionNotFoundError.d.ts +0 -5
- package/dist/errors/ActionNotFoundError.d.ts.map +0 -1
- package/dist/errors/ActionNotFoundError.js +0 -12
- package/dist/errors/CodecSchemaValidateError.d.ts +0 -5
- package/dist/errors/CodecSchemaValidateError.d.ts.map +0 -1
- package/dist/errors/CodecSchemaValidateError.js +0 -12
- package/dist/errors/DeviceNotFoundError.d.ts +0 -5
- package/dist/errors/DeviceNotFoundError.d.ts.map +0 -1
- package/dist/errors/DeviceNotFoundError.js +0 -12
- package/dist/errors/NoAvailableCodecError.d.ts +0 -5
- package/dist/errors/NoAvailableCodecError.d.ts.map +0 -1
- package/dist/errors/NoAvailableCodecError.js +0 -12
- package/dist/errors/NpcapLoadError.d.ts +0 -5
- package/dist/errors/NpcapLoadError.d.ts.map +0 -1
- package/dist/errors/NpcapLoadError.js +0 -12
- package/dist/errors/SocketDownError.d.ts +0 -5
- package/dist/errors/SocketDownError.d.ts.map +0 -1
- package/dist/errors/SocketDownError.js +0 -12
- package/dist/errors/UnknownPipeMessageTypeError.d.ts +0 -5
- package/dist/errors/UnknownPipeMessageTypeError.d.ts.map +0 -1
- package/dist/errors/UnknownPipeMessageTypeError.js +0 -12
- package/dist/errors/common/ErrorCode.d.ts +0 -31
- package/dist/errors/common/ErrorCode.d.ts.map +0 -1
- package/dist/errors/common/ErrorCode.js +0 -33
- package/dist/lib/GeneratePipeAddress.d.ts +0 -7
- package/dist/lib/GeneratePipeAddress.d.ts.map +0 -1
- package/dist/lib/GeneratePipeAddress.js +0 -23
- package/dist/lib/GetBinding.d.ts +0 -2
- package/dist/lib/GetBinding.d.ts.map +0 -1
- package/dist/lib/GetBinding.js +0 -6
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts +0 -7
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts.map +0 -1
- package/dist/lib/GetCaptureTemporaryDirectory.js +0 -15
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts +0 -8
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts.map +0 -1
- package/dist/lib/GetDeviceCaptureTemporaryFilename.js +0 -18
- package/dist/lib/codec/Codec.d.ts +0 -32
- package/dist/lib/codec/Codec.d.ts.map +0 -1
- package/dist/lib/codec/Codec.js +0 -183
- package/dist/lib/codec/PacketHeaders.d.ts +0 -22
- package/dist/lib/codec/PacketHeaders.d.ts.map +0 -1
- package/dist/lib/codec/PacketHeaders.js +0 -47
- package/dist/lib/codec/abstracts/BaseHeader.d.ts +0 -217
- package/dist/lib/codec/abstracts/BaseHeader.d.ts.map +0 -1
- package/dist/lib/codec/abstracts/BaseHeader.js +0 -356
- package/dist/lib/codec/headers/ARP.d.ts +0 -10
- package/dist/lib/codec/headers/ARP.d.ts.map +0 -1
- package/dist/lib/codec/headers/ARP.js +0 -224
- package/dist/lib/codec/headers/EthernetII.d.ts +0 -10
- package/dist/lib/codec/headers/EthernetII.d.ts.map +0 -1
- package/dist/lib/codec/headers/EthernetII.js +0 -81
- package/dist/lib/codec/headers/Goose.d.ts +0 -104
- package/dist/lib/codec/headers/Goose.d.ts.map +0 -1
- package/dist/lib/codec/headers/Goose.js +0 -1005
- package/dist/lib/codec/headers/ICMP.d.ts +0 -15
- package/dist/lib/codec/headers/ICMP.d.ts.map +0 -1
- package/dist/lib/codec/headers/ICMP.js +0 -147
- package/dist/lib/codec/headers/ICMPv6.d.ts +0 -15
- package/dist/lib/codec/headers/ICMPv6.d.ts.map +0 -1
- package/dist/lib/codec/headers/ICMPv6.js +0 -128
- package/dist/lib/codec/headers/IEC104_I_Frame.d.ts +0 -10
- package/dist/lib/codec/headers/IEC104_I_Frame.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC104_I_Frame.js +0 -6411
- package/dist/lib/codec/headers/IEC104_S_Frame.d.ts +0 -10
- package/dist/lib/codec/headers/IEC104_S_Frame.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC104_S_Frame.js +0 -105
- package/dist/lib/codec/headers/IEC104_U_Frame.d.ts +0 -10
- package/dist/lib/codec/headers/IEC104_U_Frame.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC104_U_Frame.js +0 -155
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts +0 -13
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts.map +0 -1
- package/dist/lib/codec/headers/IEC61850SampledValues.js +0 -370
- package/dist/lib/codec/headers/IPv4.d.ts +0 -16
- package/dist/lib/codec/headers/IPv4.d.ts.map +0 -1
- package/dist/lib/codec/headers/IPv4.js +0 -339
- package/dist/lib/codec/headers/IPv6.d.ts +0 -10
- package/dist/lib/codec/headers/IPv6.d.ts.map +0 -1
- package/dist/lib/codec/headers/IPv6.js +0 -177
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts +0 -71
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts.map +0 -1
- package/dist/lib/codec/headers/IPv6HopByHopOptions.js +0 -517
- package/dist/lib/codec/headers/RawData.d.ts +0 -11
- package/dist/lib/codec/headers/RawData.d.ts.map +0 -1
- package/dist/lib/codec/headers/RawData.js +0 -36
- package/dist/lib/codec/headers/TCP.d.ts +0 -16
- package/dist/lib/codec/headers/TCP.d.ts.map +0 -1
- package/dist/lib/codec/headers/TCP.js +0 -917
- package/dist/lib/codec/headers/TLS_Alert.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_Alert.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_Alert.js +0 -624
- package/dist/lib/codec/headers/TLS_ApplicationData.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_ApplicationData.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_ApplicationData.js +0 -155
- package/dist/lib/codec/headers/TLS_ChangeCipherSpec.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_ChangeCipherSpec.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_ChangeCipherSpec.js +0 -154
- package/dist/lib/codec/headers/TLS_Handshake.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_Handshake.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_Handshake.js +0 -339
- package/dist/lib/codec/headers/TLS_Heartbeat.d.ts +0 -10
- package/dist/lib/codec/headers/TLS_Heartbeat.d.ts.map +0 -1
- package/dist/lib/codec/headers/TLS_Heartbeat.js +0 -206
- package/dist/lib/codec/headers/UDP.d.ts +0 -16
- package/dist/lib/codec/headers/UDP.d.ts.map +0 -1
- package/dist/lib/codec/headers/UDP.js +0 -192
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts +0 -10
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts.map +0 -1
- package/dist/lib/codec/headers/VLAN_802dot1Q.js +0 -82
- package/dist/lib/codec/lib/FlexibleObject.d.ts +0 -28
- package/dist/lib/codec/lib/FlexibleObject.d.ts.map +0 -1
- package/dist/lib/codec/lib/FlexibleObject.js +0 -102
- package/dist/lib/codec/lib/GetBERIntegerLengthFromBuffer.d.ts +0 -7
- package/dist/lib/codec/lib/GetBERIntegerLengthFromBuffer.d.ts.map +0 -1
- package/dist/lib/codec/lib/GetBERIntegerLengthFromBuffer.js +0 -16
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts +0 -14
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts.map +0 -1
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.js +0 -53
- package/dist/lib/codec/lib/SortPostHandlers.d.ts +0 -8
- package/dist/lib/codec/lib/SortPostHandlers.d.ts.map +0 -1
- package/dist/lib/codec/lib/SortPostHandlers.js +0 -11
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts +0 -11
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts.map +0 -1
- package/dist/lib/codec/lib/StringContentEncodingEnum.js +0 -14
- package/dist/lib/codec/types/CodecData.d.ts +0 -7
- package/dist/lib/codec/types/CodecData.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecData.js +0 -2
- package/dist/lib/codec/types/CodecDecodeResult.d.ts +0 -11
- package/dist/lib/codec/types/CodecDecodeResult.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecDecodeResult.js +0 -2
- package/dist/lib/codec/types/CodecEncodeInput.d.ts +0 -9
- package/dist/lib/codec/types/CodecEncodeInput.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecEncodeInput.js +0 -2
- package/dist/lib/codec/types/CodecEncodeResult.d.ts +0 -6
- package/dist/lib/codec/types/CodecEncodeResult.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecEncodeResult.js +0 -2
- package/dist/lib/codec/types/CodecErrorInfo.d.ts +0 -6
- package/dist/lib/codec/types/CodecErrorInfo.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecErrorInfo.js +0 -2
- package/dist/lib/codec/types/CodecModule.d.ts +0 -3
- package/dist/lib/codec/types/CodecModule.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecModule.js +0 -2
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts +0 -3
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecModuleConstructor.js +0 -2
- package/dist/lib/codec/types/CodecSchema.d.ts +0 -7
- package/dist/lib/codec/types/CodecSchema.d.ts.map +0 -1
- package/dist/lib/codec/types/CodecSchema.js +0 -2
- package/dist/lib/codec/types/HeaderTreeNode.d.ts +0 -5
- package/dist/lib/codec/types/HeaderTreeNode.d.ts.map +0 -1
- package/dist/lib/codec/types/HeaderTreeNode.js +0 -2
- package/dist/lib/codec/types/PostHandlerItem.d.ts +0 -5
- package/dist/lib/codec/types/PostHandlerItem.d.ts.map +0 -1
- package/dist/lib/codec/types/PostHandlerItem.js +0 -2
- package/dist/lib/helper/BufferToHex.d.ts +0 -2
- package/dist/lib/helper/BufferToHex.d.ts.map +0 -1
- package/dist/lib/helper/BufferToHex.js +0 -6
- package/dist/lib/helper/BufferToIP.d.ts +0 -13
- package/dist/lib/helper/BufferToIP.d.ts.map +0 -1
- package/dist/lib/helper/BufferToIP.js +0 -21
- package/dist/lib/helper/BufferToNumber.d.ts +0 -10
- package/dist/lib/helper/BufferToNumber.d.ts.map +0 -1
- package/dist/lib/helper/BufferToNumber.js +0 -22
- package/dist/lib/helper/HexToBuffer.d.ts +0 -8
- package/dist/lib/helper/HexToBuffer.d.ts.map +0 -1
- package/dist/lib/helper/HexToBuffer.js +0 -27
- package/dist/lib/helper/HexToNumber.d.ts +0 -10
- package/dist/lib/helper/HexToNumber.d.ts.map +0 -1
- package/dist/lib/helper/HexToNumber.js +0 -39
- package/dist/lib/helper/IPToBuffer.d.ts +0 -13
- package/dist/lib/helper/IPToBuffer.d.ts.map +0 -1
- package/dist/lib/helper/IPToBuffer.js +0 -28
- package/dist/lib/helper/NumberToBERBuffer.d.ts +0 -10
- package/dist/lib/helper/NumberToBERBuffer.d.ts.map +0 -1
- package/dist/lib/helper/NumberToBERBuffer.js +0 -22
- package/dist/lib/helper/NumberToBERHex.d.ts +0 -10
- package/dist/lib/helper/NumberToBERHex.d.ts.map +0 -1
- package/dist/lib/helper/NumberToBERHex.js +0 -27
- package/dist/lib/helper/NumberToBuffer.d.ts +0 -10
- package/dist/lib/helper/NumberToBuffer.d.ts.map +0 -1
- package/dist/lib/helper/NumberToBuffer.js +0 -22
- package/dist/lib/helper/NumberToHex.d.ts +0 -10
- package/dist/lib/helper/NumberToHex.d.ts.map +0 -1
- package/dist/lib/helper/NumberToHex.js +0 -26
- package/dist/lib/nodepcap/Capture.d.ts +0 -81
- package/dist/lib/nodepcap/Capture.d.ts.map +0 -1
- package/dist/lib/nodepcap/Capture.js +0 -323
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts +0 -7
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts.map +0 -1
- package/dist/lib/nodepcap/GetNetworkInterfaces.js +0 -22
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts +0 -16
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/IBindingCapture.js +0 -2
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts +0 -5
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.js +0 -2
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts +0 -23
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.js +0 -2
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts +0 -5
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts.map +0 -1
- package/dist/lib/nodepcap/interfaces/INetworkInterface.js +0 -2
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts +0 -15
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts.map +0 -1
- package/dist/lib/nodepcap/lib/BindingCapture.js +0 -35
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts +0 -2
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts.map +0 -1
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.js +0 -55
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts +0 -3
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts.map +0 -1
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.js +0 -18
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts +0 -2
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts.map +0 -1
- package/dist/lib/nodepcap/workers/CaptureWorker.js +0 -25
- package/dist/lib/pcap/PCAPGenerator.d.ts +0 -34
- package/dist/lib/pcap/PCAPGenerator.d.ts.map +0 -1
- package/dist/lib/pcap/PCAPGenerator.js +0 -101
- package/dist/lib/pcap/PcapParser.d.ts +0 -27
- package/dist/lib/pcap/PcapParser.d.ts.map +0 -1
- package/dist/lib/pcap/PcapParser.js +0 -149
- package/dist/lib/pcap/PcapReader.d.ts +0 -112
- package/dist/lib/pcap/PcapReader.d.ts.map +0 -1
- package/dist/lib/pcap/PcapReader.js +0 -263
- package/dist/lib/pcap/PcapWriter.d.ts +0 -29
- package/dist/lib/pcap/PcapWriter.d.ts.map +0 -1
- package/dist/lib/pcap/PcapWriter.js +0 -86
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts +0 -13
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts.map +0 -1
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.js +0 -2
- package/dist/lib/pipe/PipeClient.d.ts +0 -35
- package/dist/lib/pipe/PipeClient.d.ts.map +0 -1
- package/dist/lib/pipe/PipeClient.js +0 -71
- package/dist/lib/pipe/PipeClientSocket.d.ts +0 -39
- package/dist/lib/pipe/PipeClientSocket.d.ts.map +0 -1
- package/dist/lib/pipe/PipeClientSocket.js +0 -82
- package/dist/lib/pipe/PipeMessage.d.ts +0 -27
- package/dist/lib/pipe/PipeMessage.d.ts.map +0 -1
- package/dist/lib/pipe/PipeMessage.js +0 -61
- package/dist/lib/pipe/PipeMessageHandler.d.ts +0 -16
- package/dist/lib/pipe/PipeMessageHandler.d.ts.map +0 -1
- package/dist/lib/pipe/PipeMessageHandler.js +0 -95
- package/dist/lib/pipe/PipeServer.d.ts +0 -25
- package/dist/lib/pipe/PipeServer.d.ts.map +0 -1
- package/dist/lib/pipe/PipeServer.js +0 -59
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts +0 -36
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts.map +0 -1
- package/dist/lib/schema/ProtocolFieldJSONSchema.js +0 -2
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts +0 -3
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts.map +0 -1
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.js +0 -2
- package/dist/lib/schema/ProtocolJSONSchema.d.ts +0 -32
- package/dist/lib/schema/ProtocolJSONSchema.d.ts.map +0 -1
- package/dist/lib/schema/ProtocolJSONSchema.js +0 -2
- package/dist/tests/Test.spec.d.ts +0 -2
- package/dist/tests/Test.spec.d.ts.map +0 -1
- package/dist/tests/Test.spec.js +0 -25
- package/dist/tests/units/CaptureTest.spec.d.ts +0 -2
- package/dist/tests/units/CaptureTest.spec.d.ts.map +0 -1
- package/dist/tests/units/CaptureTest.spec.js +0 -32
- package/dist/tests/units/Codec.spec.d.ts +0 -2
- package/dist/tests/units/Codec.spec.d.ts.map +0 -1
- package/dist/tests/units/Codec.spec.js +0 -86
- package/dist/tests/units/ReadPCAP.spec.d.ts +0 -2
- package/dist/tests/units/ReadPCAP.spec.d.ts.map +0 -1
- package/dist/tests/units/ReadPCAP.spec.js +0 -14
- package/src/CodecExports.ts +0 -33
- package/src/CodecHeaderExports.ts +0 -1
- package/src/HelperExports.ts +0 -78
- package/src/NetworkExports.ts +0 -12
- package/src/PcapExports.ts +0 -32
- package/src/errors/ActionNotFoundError.ts +0 -6
- package/src/errors/CodecSchemaValidateError.ts +0 -6
- package/src/errors/DeviceNotFoundError.ts +0 -6
- package/src/errors/NoAvailableCodecError.ts +0 -6
- package/src/errors/NpcapLoadError.ts +0 -6
- package/src/errors/SocketDownError.ts +0 -6
- package/src/errors/UnknownPipeMessageTypeError.ts +0 -6
- package/src/errors/common/ErrorCode.ts +0 -30
- package/src/lib/GeneratePipeAddress.ts +0 -17
- package/src/lib/GetBinding.ts +0 -3
- package/src/lib/GetCaptureTemporaryDirectory.ts +0 -12
- package/src/lib/GetDeviceCaptureTemporaryFilename.ts +0 -13
- package/src/lib/codec/Codec.ts +0 -164
- package/src/lib/codec/PacketHeaders.ts +0 -23
- package/src/lib/codec/abstracts/BaseHeader.ts +0 -435
- package/src/lib/codec/headers/ARP.ts +0 -220
- package/src/lib/codec/headers/EthernetII.ts +0 -79
- package/src/lib/codec/headers/Goose.ts +0 -1033
- package/src/lib/codec/headers/ICMP.ts +0 -151
- package/src/lib/codec/headers/ICMPv6.ts +0 -128
- package/src/lib/codec/headers/IEC104_I_Frame.ts +0 -7373
- package/src/lib/codec/headers/IEC104_S_Frame.ts +0 -97
- package/src/lib/codec/headers/IEC104_U_Frame.ts +0 -139
- package/src/lib/codec/headers/IEC61850SampledValues.ts +0 -361
- package/src/lib/codec/headers/IPv4.ts +0 -331
- package/src/lib/codec/headers/IPv6.ts +0 -176
- package/src/lib/codec/headers/IPv6HopByHopOptions.ts +0 -552
- package/src/lib/codec/headers/RawData.ts +0 -38
- package/src/lib/codec/headers/TCP.ts +0 -952
- package/src/lib/codec/headers/TLS_Alert.ts +0 -539
- package/src/lib/codec/headers/TLS_ApplicationData.ts +0 -145
- package/src/lib/codec/headers/TLS_ChangeCipherSpec.ts +0 -146
- package/src/lib/codec/headers/TLS_Handshake.ts +0 -313
- package/src/lib/codec/headers/TLS_Heartbeat.ts +0 -188
- package/src/lib/codec/headers/UDP.ts +0 -182
- package/src/lib/codec/headers/VLAN_802dot1Q.ts +0 -79
- package/src/lib/codec/lib/FlexibleObject.ts +0 -100
- package/src/lib/codec/lib/GetBERIntegerLengthFromBuffer.ts +0 -12
- package/src/lib/codec/lib/ProcessPacketPostHandlers.ts +0 -53
- package/src/lib/codec/lib/SortPostHandlers.ts +0 -10
- package/src/lib/codec/lib/StringContentEncodingEnum.ts +0 -10
- package/src/lib/codec/types/CodecData.ts +0 -7
- package/src/lib/codec/types/CodecDecodeResult.ts +0 -11
- package/src/lib/codec/types/CodecEncodeInput.ts +0 -9
- package/src/lib/codec/types/CodecEncodeResult.ts +0 -6
- package/src/lib/codec/types/CodecErrorInfo.ts +0 -5
- package/src/lib/codec/types/CodecModule.ts +0 -3
- package/src/lib/codec/types/CodecModuleConstructor.ts +0 -3
- package/src/lib/codec/types/CodecSchema.ts +0 -7
- package/src/lib/codec/types/HeaderTreeNode.ts +0 -5
- package/src/lib/codec/types/PostHandlerItem.ts +0 -4
- package/src/lib/helper/BufferToHex.ts +0 -3
- package/src/lib/helper/BufferToIP.ts +0 -19
- package/src/lib/helper/BufferToNumber.ts +0 -31
- package/src/lib/helper/HexToBuffer.ts +0 -22
- package/src/lib/helper/HexToNumber.ts +0 -25
- package/src/lib/helper/IPToBuffer.ts +0 -25
- package/src/lib/helper/NumberToBERBuffer.ts +0 -21
- package/src/lib/helper/NumberToBERHex.ts +0 -17
- package/src/lib/helper/NumberToBuffer.ts +0 -21
- package/src/lib/helper/NumberToHex.ts +0 -15
- package/src/lib/nodepcap/Capture.ts +0 -304
- package/src/lib/nodepcap/GetNetworkInterfaces.ts +0 -18
- package/src/lib/nodepcap/interfaces/IBindingCapture.ts +0 -27
- package/src/lib/nodepcap/interfaces/IBindingCaptureOptions.ts +0 -4
- package/src/lib/nodepcap/interfaces/ICaptureOptions.ts +0 -24
- package/src/lib/nodepcap/interfaces/INetworkInterface.ts +0 -4
- package/src/lib/nodepcap/lib/BindingCapture.ts +0 -46
- package/src/lib/nodepcap/lib/GetNodePcapBinding.ts +0 -17
- package/src/lib/nodepcap/lib/GetNodePcapBindingCapture.ts +0 -15
- package/src/lib/nodepcap/workers/CaptureWorker.ts +0 -30
- package/src/lib/pcap/PCAPGenerator.ts +0 -123
- package/src/lib/pcap/PcapParser.ts +0 -170
- package/src/lib/pcap/PcapReader.ts +0 -306
- package/src/lib/pcap/PcapWriter.ts +0 -98
- package/src/lib/pcap/interfaces/IPcapPacketInfo.ts +0 -12
- package/src/lib/pipe/PipeClient.ts +0 -91
- package/src/lib/pipe/PipeClientSocket.ts +0 -99
- package/src/lib/pipe/PipeMessage.ts +0 -74
- package/src/lib/pipe/PipeMessageHandler.ts +0 -91
- package/src/lib/pipe/PipeServer.ts +0 -74
- package/src/lib/schema/ProtocolFieldJSONSchema.ts +0 -47
- package/src/lib/schema/ProtocolFieldJSONSchemaDefinition.ts +0 -3
- package/src/lib/schema/ProtocolJSONSchema.ts +0 -37
- package/src/tests/Test.spec.ts +0 -22
- package/src/tests/units/CaptureTest.spec.ts +0 -31
- package/src/tests/units/Codec.spec.ts +0 -102
- package/src/tests/units/ReadPCAP.spec.ts +0 -13
- package/test.pcap +0 -0
- package/tsconfig.json +0 -42
|
@@ -1,552 +0,0 @@
|
|
|
1
|
-
import {ProtocolJSONSchema} from '../../schema/ProtocolJSONSchema'
|
|
2
|
-
import {BaseHeader} from '../abstracts/BaseHeader'
|
|
3
|
-
import {BufferToUInt8} from '../../helper/BufferToNumber'
|
|
4
|
-
import {UInt16ToBuffer, UInt32ToBuffer, UInt64ToBuffer, UInt8ToBuffer} from '../../helper/NumberToBuffer'
|
|
5
|
-
import {StringContentEncodingEnum} from '../lib/StringContentEncodingEnum'
|
|
6
|
-
import TLV from 'node-tlv'
|
|
7
|
-
import {HexToUInt16, HexToUInt32, HexToUInt64, HexToUInt8} from '../../helper/HexToNumber'
|
|
8
|
-
|
|
9
|
-
//Type=1 PadN
|
|
10
|
-
//Type=4 Tunnel Encapsulation Limit
|
|
11
|
-
//Type=5 Router Alert
|
|
12
|
-
//Type=7 CALIPSO
|
|
13
|
-
//Type=8 SMF_DPD
|
|
14
|
-
//Type=11 MPL Option
|
|
15
|
-
//Type=12 ILNP Nonce
|
|
16
|
-
//Type=13 Line-Identification Option
|
|
17
|
-
//Type=30 IPv6 DFF Header
|
|
18
|
-
//Type=138 Endpoint Identification
|
|
19
|
-
|
|
20
|
-
enum Type {
|
|
21
|
-
PadN = 'PadN',
|
|
22
|
-
Tunnel_Encapsulation_Limit = 'Tunnel-Encapsulation-Limit',
|
|
23
|
-
Router_Alert = 'Router-Alert',
|
|
24
|
-
CALIPSO = 'CALIPSO',
|
|
25
|
-
SMF_DPD = 'SMF_DPD',
|
|
26
|
-
MPL_Option = 'MPL-Option',
|
|
27
|
-
ILNP_Nonce = 'ILNP-Nonce',
|
|
28
|
-
Line_Identification_Option = 'Line-Identification-Option',
|
|
29
|
-
IPv6_DFF_Header = 'IPv6-DFF-Header',
|
|
30
|
-
Endpoint_Identification = 'Endpoint-Identification'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
type PadN = {
|
|
34
|
-
type: Type.PadN
|
|
35
|
-
n: number
|
|
36
|
-
}
|
|
37
|
-
type Tunnel_Encapsulation_Limit = {
|
|
38
|
-
type: Type.Tunnel_Encapsulation_Limit
|
|
39
|
-
limit: number
|
|
40
|
-
}
|
|
41
|
-
type Router_Alert = {
|
|
42
|
-
type: Type.Router_Alert
|
|
43
|
-
alert: string
|
|
44
|
-
}
|
|
45
|
-
type CALIPSO = {
|
|
46
|
-
type: Type.CALIPSO
|
|
47
|
-
tag: string
|
|
48
|
-
}
|
|
49
|
-
type SMF_DPD = {
|
|
50
|
-
type: Type.SMF_DPD
|
|
51
|
-
hash: string
|
|
52
|
-
}
|
|
53
|
-
type MPL_Option = {
|
|
54
|
-
type: Type.MPL_Option
|
|
55
|
-
value: string
|
|
56
|
-
}
|
|
57
|
-
type ILNP_Nonce = {
|
|
58
|
-
type: Type.ILNP_Nonce
|
|
59
|
-
nonce: string
|
|
60
|
-
}
|
|
61
|
-
type Line_Identification_Option = {
|
|
62
|
-
type: Type.Line_Identification_Option
|
|
63
|
-
id: string
|
|
64
|
-
}
|
|
65
|
-
type IPv6_DFF_Header = {
|
|
66
|
-
type: Type.IPv6_DFF_Header
|
|
67
|
-
message: string
|
|
68
|
-
}
|
|
69
|
-
type Endpoint_Identification = {
|
|
70
|
-
type: Type.Endpoint_Identification
|
|
71
|
-
id: string
|
|
72
|
-
}
|
|
73
|
-
type Custom = {
|
|
74
|
-
type: number
|
|
75
|
-
data: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export class IPv6HopByHopOptions extends BaseHeader {
|
|
79
|
-
|
|
80
|
-
protected itemTLVs: TLV[]
|
|
81
|
-
|
|
82
|
-
protected items: (
|
|
83
|
-
PadN |
|
|
84
|
-
Tunnel_Encapsulation_Limit |
|
|
85
|
-
Router_Alert |
|
|
86
|
-
CALIPSO |
|
|
87
|
-
SMF_DPD |
|
|
88
|
-
MPL_Option |
|
|
89
|
-
ILNP_Nonce |
|
|
90
|
-
Line_Identification_Option |
|
|
91
|
-
IPv6_DFF_Header |
|
|
92
|
-
Endpoint_Identification |
|
|
93
|
-
Custom
|
|
94
|
-
)[] = []
|
|
95
|
-
|
|
96
|
-
public SCHEMA: ProtocolJSONSchema = {
|
|
97
|
-
type: 'object',
|
|
98
|
-
properties: {
|
|
99
|
-
nxt: {
|
|
100
|
-
type: 'integer',
|
|
101
|
-
label: 'Next Header',
|
|
102
|
-
minimum: 0,
|
|
103
|
-
maximum: 255,
|
|
104
|
-
decode: (): void => {
|
|
105
|
-
this.instance.nxt.setValue(BufferToUInt8(this.readBytes(0, 1)))
|
|
106
|
-
},
|
|
107
|
-
encode: (): void => {
|
|
108
|
-
const nxt: number = this.instance.nxt.getValue(0, (nodePath: string): void => this.recordError(nodePath, 'Not Found'))
|
|
109
|
-
this.instance.nxt.setValue(nxt)
|
|
110
|
-
this.writeBytes(0, UInt8ToBuffer(nxt))
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
len: {
|
|
114
|
-
type: 'integer',
|
|
115
|
-
label: 'Length',
|
|
116
|
-
minimum: 0,
|
|
117
|
-
maximum: 255,
|
|
118
|
-
decode: (): void => {
|
|
119
|
-
this.instance.len.setValue(BufferToUInt8(this.readBytes(1, 1)))
|
|
120
|
-
},
|
|
121
|
-
encode: (): void => {
|
|
122
|
-
const len: number = this.instance.len.getValue(0)
|
|
123
|
-
this.instance.len.setValue(len)
|
|
124
|
-
this.writeBytes(1, UInt8ToBuffer(len))
|
|
125
|
-
if (!len) {
|
|
126
|
-
this.addPostSelfEncodeHandler((): void => {
|
|
127
|
-
let rawLength: number = 0
|
|
128
|
-
this.itemTLVs
|
|
129
|
-
.map(tlv => Buffer.from(tlv.getTLV(), 'hex').length)
|
|
130
|
-
.forEach(itemLength => rawLength += itemLength)
|
|
131
|
-
const calcLength: number = Math.floor(rawLength / 8)
|
|
132
|
-
this.instance.len.setValue(calcLength)
|
|
133
|
-
this.writeBytes(1, UInt8ToBuffer(calcLength))
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
items: {
|
|
139
|
-
type: 'array',
|
|
140
|
-
label: 'Option Items',
|
|
141
|
-
items: {
|
|
142
|
-
anyOf: [
|
|
143
|
-
//Type=1 PadN
|
|
144
|
-
{
|
|
145
|
-
type: 'object',
|
|
146
|
-
label: 'PadN',
|
|
147
|
-
properties: {
|
|
148
|
-
type: {
|
|
149
|
-
type: 'string',
|
|
150
|
-
label: 'Type',
|
|
151
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
152
|
-
enum: [Type.PadN],
|
|
153
|
-
const: Type.PadN,
|
|
154
|
-
hidden: true
|
|
155
|
-
},
|
|
156
|
-
n: {
|
|
157
|
-
type: 'integer',
|
|
158
|
-
label: 'N'
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
//Type=4 Tunnel Encapsulation Limit
|
|
163
|
-
{
|
|
164
|
-
type: 'object',
|
|
165
|
-
label: 'Tunnel Encapsulation Limit',
|
|
166
|
-
properties: {
|
|
167
|
-
type: {
|
|
168
|
-
type: 'string',
|
|
169
|
-
label: 'Type',
|
|
170
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
171
|
-
enum: [Type.Tunnel_Encapsulation_Limit],
|
|
172
|
-
const: Type.Tunnel_Encapsulation_Limit,
|
|
173
|
-
hidden: true
|
|
174
|
-
},
|
|
175
|
-
limit: {
|
|
176
|
-
type: 'integer',
|
|
177
|
-
label: 'Limit',
|
|
178
|
-
minimum: 1,
|
|
179
|
-
maximum: 255
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
//Type=5 Router Alert
|
|
184
|
-
{
|
|
185
|
-
type: 'object',
|
|
186
|
-
label: 'Router Alert',
|
|
187
|
-
properties: {
|
|
188
|
-
type: {
|
|
189
|
-
type: 'string',
|
|
190
|
-
label: 'Type',
|
|
191
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
192
|
-
enum: [Type.Router_Alert],
|
|
193
|
-
const: Type.Router_Alert,
|
|
194
|
-
hidden: true
|
|
195
|
-
},
|
|
196
|
-
alert: {
|
|
197
|
-
type: 'string',
|
|
198
|
-
label: 'Router Alert',
|
|
199
|
-
contentEncoding: StringContentEncodingEnum.HEX,
|
|
200
|
-
minLength: 4,
|
|
201
|
-
maxLength: 4
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
//Type=7 CALIPSO
|
|
206
|
-
{
|
|
207
|
-
type: 'object',
|
|
208
|
-
label: 'CALIPSO',
|
|
209
|
-
properties: {
|
|
210
|
-
type: {
|
|
211
|
-
type: 'string',
|
|
212
|
-
label: 'Type',
|
|
213
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
214
|
-
enum: [Type.CALIPSO],
|
|
215
|
-
const: Type.CALIPSO,
|
|
216
|
-
hidden: true
|
|
217
|
-
},
|
|
218
|
-
tag: {
|
|
219
|
-
type: 'string',
|
|
220
|
-
label: 'Tag',
|
|
221
|
-
contentEncoding: StringContentEncodingEnum.HEX,
|
|
222
|
-
minLength: 16,
|
|
223
|
-
maxLength: 16
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
//Type=8 SMF_DPD
|
|
228
|
-
{
|
|
229
|
-
type: 'object',
|
|
230
|
-
label: 'SMF_DPD',
|
|
231
|
-
properties: {
|
|
232
|
-
type: {
|
|
233
|
-
type: 'string',
|
|
234
|
-
label: 'Type',
|
|
235
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
236
|
-
enum: [Type.SMF_DPD],
|
|
237
|
-
const: Type.SMF_DPD,
|
|
238
|
-
hidden: true
|
|
239
|
-
},
|
|
240
|
-
hash: {
|
|
241
|
-
type: 'string',
|
|
242
|
-
label: 'Hash',
|
|
243
|
-
contentEncoding: StringContentEncodingEnum.UTF8
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
//Type=11 MPL Option
|
|
248
|
-
{
|
|
249
|
-
type: 'object',
|
|
250
|
-
label: 'MPL Option',
|
|
251
|
-
properties: {
|
|
252
|
-
type: {
|
|
253
|
-
type: 'string',
|
|
254
|
-
label: 'Type',
|
|
255
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
256
|
-
enum: [Type.MPL_Option],
|
|
257
|
-
const: Type.MPL_Option,
|
|
258
|
-
hidden: true
|
|
259
|
-
},
|
|
260
|
-
value: {
|
|
261
|
-
type: 'string',
|
|
262
|
-
label: 'Value',
|
|
263
|
-
contentEncoding: StringContentEncodingEnum.HEX
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
//Type=12 ILNP Nonce
|
|
268
|
-
{
|
|
269
|
-
type: 'object',
|
|
270
|
-
label: 'ILNP Nonce',
|
|
271
|
-
properties: {
|
|
272
|
-
type: {
|
|
273
|
-
type: 'string',
|
|
274
|
-
label: 'Type',
|
|
275
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
276
|
-
enum: [Type.ILNP_Nonce],
|
|
277
|
-
const: Type.ILNP_Nonce,
|
|
278
|
-
hidden: true
|
|
279
|
-
},
|
|
280
|
-
nonce: {
|
|
281
|
-
type: 'string',
|
|
282
|
-
label: 'Nonce',
|
|
283
|
-
minLength: 12,
|
|
284
|
-
maxLength: 12,
|
|
285
|
-
contentEncoding: StringContentEncodingEnum.HEX
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
//Type=13 Line-Identification Option
|
|
290
|
-
{
|
|
291
|
-
type: 'object',
|
|
292
|
-
label: 'Line-Identification Option',
|
|
293
|
-
properties: {
|
|
294
|
-
type: {
|
|
295
|
-
type: 'string',
|
|
296
|
-
label: 'Type',
|
|
297
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
298
|
-
enum: [Type.Line_Identification_Option],
|
|
299
|
-
const: Type.Line_Identification_Option,
|
|
300
|
-
hidden: true
|
|
301
|
-
},
|
|
302
|
-
id: {
|
|
303
|
-
type: 'string',
|
|
304
|
-
label: 'Identity',
|
|
305
|
-
minLength: 8,
|
|
306
|
-
maxLength: 8,
|
|
307
|
-
contentEncoding: StringContentEncodingEnum.HEX
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
//Type=30 IPv6 DFF Header
|
|
312
|
-
{
|
|
313
|
-
type: 'object',
|
|
314
|
-
label: 'IPv6 DFF Header',
|
|
315
|
-
properties: {
|
|
316
|
-
type: {
|
|
317
|
-
type: 'string',
|
|
318
|
-
label: 'Type',
|
|
319
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
320
|
-
enum: [Type.IPv6_DFF_Header],
|
|
321
|
-
const: Type.IPv6_DFF_Header,
|
|
322
|
-
hidden: true
|
|
323
|
-
},
|
|
324
|
-
message: {
|
|
325
|
-
type: 'string',
|
|
326
|
-
label: 'Message',
|
|
327
|
-
contentEncoding: StringContentEncodingEnum.HEX
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
//Type=138 Endpoint Identification
|
|
332
|
-
{
|
|
333
|
-
type: 'object',
|
|
334
|
-
label: 'Endpoint Identification',
|
|
335
|
-
properties: {
|
|
336
|
-
type: {
|
|
337
|
-
type: 'string',
|
|
338
|
-
label: 'Type',
|
|
339
|
-
contentEncoding: StringContentEncodingEnum.UTF8,
|
|
340
|
-
enum: [Type.Endpoint_Identification],
|
|
341
|
-
const: Type.Endpoint_Identification,
|
|
342
|
-
hidden: true
|
|
343
|
-
},
|
|
344
|
-
id: {
|
|
345
|
-
type: 'string',
|
|
346
|
-
label: 'Identity',
|
|
347
|
-
minLength: 32,
|
|
348
|
-
maxLength: 32,
|
|
349
|
-
contentEncoding: StringContentEncodingEnum.HEX
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
//Custom
|
|
354
|
-
{
|
|
355
|
-
type: 'object',
|
|
356
|
-
label: 'Custom',
|
|
357
|
-
properties: {
|
|
358
|
-
type: {
|
|
359
|
-
type: 'integer',
|
|
360
|
-
label: 'Type'
|
|
361
|
-
},
|
|
362
|
-
data: {
|
|
363
|
-
type: 'string',
|
|
364
|
-
label: 'Data',
|
|
365
|
-
contentEncoding: StringContentEncodingEnum.HEX
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
]
|
|
370
|
-
},
|
|
371
|
-
decode: (): void => {
|
|
372
|
-
let length: number = this.instance.len.getValue(0) * 8 + 7
|
|
373
|
-
while (!this.itemTLVs) {
|
|
374
|
-
try {
|
|
375
|
-
const itemTLVs: TLV[] = TLV.parseList(this.readBytes(2, length, true))
|
|
376
|
-
const joinedHex: string = itemTLVs.map(value => value.getTLV()).join('')
|
|
377
|
-
if (this.readBytes(2, length, true).toString('hex').padStart(length * 2, '0').toUpperCase() !== joinedHex.toUpperCase()) {
|
|
378
|
-
length -= 1
|
|
379
|
-
if (!length) break
|
|
380
|
-
continue
|
|
381
|
-
}
|
|
382
|
-
this.itemTLVs = TLV.parseList(this.readBytes(2, length))
|
|
383
|
-
} catch (e) {
|
|
384
|
-
length -= 1
|
|
385
|
-
if (!length) break
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
this.itemTLVs.forEach((itemTLV: TLV): void => {
|
|
389
|
-
switch (itemTLV.getTag('number')) {
|
|
390
|
-
case 0x01: {
|
|
391
|
-
this.items.push({
|
|
392
|
-
type: Type.PadN,
|
|
393
|
-
n: itemTLV.getLength('number')
|
|
394
|
-
})
|
|
395
|
-
}
|
|
396
|
-
break
|
|
397
|
-
case 0x04: {
|
|
398
|
-
this.items.push({
|
|
399
|
-
type: Type.Tunnel_Encapsulation_Limit,
|
|
400
|
-
limit: HexToUInt8(itemTLV.getValue('hex'))
|
|
401
|
-
})
|
|
402
|
-
}
|
|
403
|
-
break
|
|
404
|
-
case 0x05: {
|
|
405
|
-
this.items.push({
|
|
406
|
-
type: Type.Router_Alert,
|
|
407
|
-
alert: itemTLV.getValue('hex')
|
|
408
|
-
})
|
|
409
|
-
}
|
|
410
|
-
break
|
|
411
|
-
case 0x07: {
|
|
412
|
-
this.items.push({
|
|
413
|
-
type: Type.CALIPSO,
|
|
414
|
-
tag: itemTLV.getValue('hex')
|
|
415
|
-
})
|
|
416
|
-
}
|
|
417
|
-
break
|
|
418
|
-
case 0x08: {
|
|
419
|
-
this.items.push({
|
|
420
|
-
type: Type.SMF_DPD,
|
|
421
|
-
hash: itemTLV.getValue('hex')
|
|
422
|
-
})
|
|
423
|
-
}
|
|
424
|
-
break
|
|
425
|
-
case 0x0B: {
|
|
426
|
-
this.items.push({
|
|
427
|
-
type: Type.MPL_Option,
|
|
428
|
-
value: itemTLV.getValue('hex')
|
|
429
|
-
})
|
|
430
|
-
}
|
|
431
|
-
break
|
|
432
|
-
case 0x0C: {
|
|
433
|
-
this.items.push({
|
|
434
|
-
type: Type.ILNP_Nonce,
|
|
435
|
-
nonce: itemTLV.getValue('hex')
|
|
436
|
-
})
|
|
437
|
-
}
|
|
438
|
-
break
|
|
439
|
-
case 0x0D: {
|
|
440
|
-
this.items.push({
|
|
441
|
-
type: Type.Line_Identification_Option,
|
|
442
|
-
id: itemTLV.getValue('hex')
|
|
443
|
-
})
|
|
444
|
-
}
|
|
445
|
-
break
|
|
446
|
-
case 0x1E: {
|
|
447
|
-
this.items.push({
|
|
448
|
-
type: Type.IPv6_DFF_Header,
|
|
449
|
-
message: itemTLV.getValue('hex')
|
|
450
|
-
})
|
|
451
|
-
}
|
|
452
|
-
break
|
|
453
|
-
case 0x8A: {
|
|
454
|
-
this.items.push({
|
|
455
|
-
type: Type.Endpoint_Identification,
|
|
456
|
-
id: itemTLV.getValue('hex')
|
|
457
|
-
})
|
|
458
|
-
}
|
|
459
|
-
break
|
|
460
|
-
default: {
|
|
461
|
-
this.items.push({
|
|
462
|
-
type: itemTLV.getTag('number'),
|
|
463
|
-
data: itemTLV.getValue('hex')
|
|
464
|
-
})
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
})
|
|
468
|
-
this.instance.items.setValue(this.items.length ? this.items : [])
|
|
469
|
-
},
|
|
470
|
-
encode: (): void => {
|
|
471
|
-
this.items = this.instance.items.getValue([])
|
|
472
|
-
this.itemTLVs = []
|
|
473
|
-
this.items.forEach(item => {
|
|
474
|
-
switch (item.type) {
|
|
475
|
-
case Type.PadN: {
|
|
476
|
-
const typedItem: PadN = {...item}
|
|
477
|
-
this.itemTLVs.push(new TLV(0x01, Buffer.alloc(typedItem.n, 0)))
|
|
478
|
-
}
|
|
479
|
-
break
|
|
480
|
-
case Type.Tunnel_Encapsulation_Limit: {
|
|
481
|
-
const typedItem: Tunnel_Encapsulation_Limit = {...item}
|
|
482
|
-
this.itemTLVs.push(new TLV(0x04, UInt8ToBuffer(typedItem.limit)))
|
|
483
|
-
}
|
|
484
|
-
break
|
|
485
|
-
case Type.Router_Alert: {
|
|
486
|
-
const typedItem: Router_Alert = {...item}
|
|
487
|
-
this.itemTLVs.push(new TLV(0x05, UInt16ToBuffer(HexToUInt16(typedItem.alert))))
|
|
488
|
-
}
|
|
489
|
-
break
|
|
490
|
-
case Type.CALIPSO: {
|
|
491
|
-
const typedItem: CALIPSO = {...item}
|
|
492
|
-
this.itemTLVs.push(new TLV(0x07, UInt64ToBuffer(HexToUInt64(typedItem.tag))))
|
|
493
|
-
}
|
|
494
|
-
break
|
|
495
|
-
case Type.SMF_DPD: {
|
|
496
|
-
const typedItem: SMF_DPD = {...item}
|
|
497
|
-
this.itemTLVs.push(new TLV(0x08, Buffer.from(typedItem.hash, 'hex')))
|
|
498
|
-
}
|
|
499
|
-
break
|
|
500
|
-
case Type.MPL_Option: {
|
|
501
|
-
const typedItem: MPL_Option = {...item}
|
|
502
|
-
this.itemTLVs.push(new TLV(0x0B, Buffer.from(typedItem.value, 'hex')))
|
|
503
|
-
}
|
|
504
|
-
break
|
|
505
|
-
case Type.ILNP_Nonce: {
|
|
506
|
-
const typedItem: ILNP_Nonce = {...item}
|
|
507
|
-
this.itemTLVs.push(new TLV(0x0C, Buffer.from(typedItem.nonce.padStart(12, '0'), 'hex')))
|
|
508
|
-
}
|
|
509
|
-
break
|
|
510
|
-
case Type.Line_Identification_Option: {
|
|
511
|
-
const typedItem: Line_Identification_Option = {...item}
|
|
512
|
-
this.itemTLVs.push(new TLV(0x0D, UInt32ToBuffer(HexToUInt32(typedItem.id))))
|
|
513
|
-
}
|
|
514
|
-
break
|
|
515
|
-
case Type.IPv6_DFF_Header: {
|
|
516
|
-
const typedItem: IPv6_DFF_Header = {...item}
|
|
517
|
-
this.itemTLVs.push(new TLV(0x1E, Buffer.from(typedItem.message, 'hex')))
|
|
518
|
-
}
|
|
519
|
-
break
|
|
520
|
-
case Type.Endpoint_Identification: {
|
|
521
|
-
const typedItem: Endpoint_Identification = {...item}
|
|
522
|
-
this.itemTLVs.push(new TLV(0x0C, Buffer.from(typedItem.id.padStart(32, '0'), 'hex')))
|
|
523
|
-
}
|
|
524
|
-
break
|
|
525
|
-
default: {
|
|
526
|
-
if (typeof item.type !== 'number') return
|
|
527
|
-
const customItem: Custom = {...item}
|
|
528
|
-
this.itemTLVs.push(new TLV(customItem.type, Buffer.from(customItem.data, 'hex')))
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
})
|
|
532
|
-
const itemsBuffer: Buffer = Buffer.from(this.itemTLVs.map(value => value.getTLV()).join(''), 'hex')
|
|
533
|
-
this.writeBytes(2, itemsBuffer)
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
public id: string = 'ipv6-hopopt'
|
|
540
|
-
|
|
541
|
-
public name: string = 'IPv6 Hop-by-Hop Option'
|
|
542
|
-
|
|
543
|
-
public nickname: string = 'HopOpt'
|
|
544
|
-
|
|
545
|
-
public readonly isProtocol: boolean = false
|
|
546
|
-
|
|
547
|
-
public match(): boolean {
|
|
548
|
-
if (!this.prevCodecModule || this.prevCodecModule.id !== 'ipv6') return false
|
|
549
|
-
return this.prevCodecModule.instance.nxt.getValue() === 0x00
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {ProtocolJSONSchema} from '../../schema/ProtocolJSONSchema'
|
|
2
|
-
import {BaseHeader} from '../abstracts/BaseHeader'
|
|
3
|
-
import {StringContentEncodingEnum} from '../lib/StringContentEncodingEnum'
|
|
4
|
-
import {BufferToHex} from '../../helper/BufferToHex'
|
|
5
|
-
|
|
6
|
-
export class RawData extends BaseHeader {
|
|
7
|
-
|
|
8
|
-
public readonly SCHEMA: ProtocolJSONSchema = {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
data: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
label: 'Raw',
|
|
14
|
-
contentEncoding: StringContentEncodingEnum.HEX,
|
|
15
|
-
decode: (): void => {
|
|
16
|
-
const dataLength: number = this.packet.length - this.startPos
|
|
17
|
-
this.instance.data.setValue(BufferToHex(this.readBytes(0, dataLength)))
|
|
18
|
-
},
|
|
19
|
-
encode: (): void => {
|
|
20
|
-
this.writeBytes(0, Buffer.from(this.instance.data.getValue().toString(), 'hex'))
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public readonly id: string = 'raw'
|
|
27
|
-
|
|
28
|
-
public readonly name: string = 'Raw Data'
|
|
29
|
-
|
|
30
|
-
public readonly nickname: string = 'Raw'
|
|
31
|
-
|
|
32
|
-
public readonly isProtocol: boolean = false
|
|
33
|
-
|
|
34
|
-
public match(): boolean {
|
|
35
|
-
return !!this.prevCodecModule
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|