netkitty 0.0.35 → 1.1.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 +31 -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,10 +0,0 @@
|
|
|
1
|
-
import { ProtocolJSONSchema } from '../../schema/ProtocolJSONSchema';
|
|
2
|
-
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
-
export declare class TLS_Heartbeat extends BaseHeader {
|
|
4
|
-
SCHEMA: ProtocolJSONSchema;
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
nickname: string;
|
|
8
|
-
match(): boolean;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=TLS_Heartbeat.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TLS_Heartbeat.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/headers/TLS_Heartbeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAclD,qBAAa,aAAc,SAAQ,UAAU;IAClC,MAAM,EAAE,kBAAkB,CA+JhC;IACM,EAAE,EAAE,MAAM,CAAkB;IAC5B,IAAI,EAAE,MAAM,CAAiD;IAC7D,QAAQ,EAAE,MAAM,CAAkB;IAElC,KAAK,IAAI,OAAO;CAO1B"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TLS_Heartbeat = void 0;
|
|
4
|
-
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
5
|
-
const BufferToNumber_1 = require("../../helper/BufferToNumber");
|
|
6
|
-
const HexToBuffer_1 = require("../../helper/HexToBuffer");
|
|
7
|
-
const BufferToHex_1 = require("../../helper/BufferToHex");
|
|
8
|
-
const NumberToBuffer_1 = require("../../helper/NumberToBuffer");
|
|
9
|
-
var TLSver;
|
|
10
|
-
(function (TLSver) {
|
|
11
|
-
TLSver["SSL_3_0"] = "SSL3.0";
|
|
12
|
-
TLSver["TLS_1_0"] = "TLS1.0";
|
|
13
|
-
TLSver["TLS_1_1"] = "TLS1.1";
|
|
14
|
-
TLSver["TLS_1_2"] = "TLS1.2";
|
|
15
|
-
TLSver["TLS_1_3"] = "TLS1.3";
|
|
16
|
-
})(TLSver || (TLSver = {}));
|
|
17
|
-
class TLS_Heartbeat extends BaseHeader_1.BaseHeader {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.SCHEMA = {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
contentType: {
|
|
24
|
-
type: 'integer',
|
|
25
|
-
label: 'Content Type',
|
|
26
|
-
minimum: 0,
|
|
27
|
-
maximum: 255,
|
|
28
|
-
decode: () => {
|
|
29
|
-
this.instance.contentType.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(0, 1)));
|
|
30
|
-
},
|
|
31
|
-
encode: () => {
|
|
32
|
-
const contentType = this.instance.contentType.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
33
|
-
this.writeBytes(0, (0, NumberToBuffer_1.UInt8ToBuffer)(contentType));
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
version: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
label: 'Version',
|
|
39
|
-
minimum: 0,
|
|
40
|
-
maximum: 65535,
|
|
41
|
-
decode: () => {
|
|
42
|
-
const version = (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(1, 2));
|
|
43
|
-
switch (version) {
|
|
44
|
-
case 768:
|
|
45
|
-
{
|
|
46
|
-
this.instance.version.setValue(TLSver.SSL_3_0);
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
case 769:
|
|
50
|
-
{
|
|
51
|
-
this.instance.version.setValue(TLSver.TLS_1_0);
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
|
-
case 770:
|
|
55
|
-
{
|
|
56
|
-
this.instance.version.setValue(TLSver.TLS_1_1);
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
case 771:
|
|
60
|
-
{
|
|
61
|
-
this.instance.version.setValue(TLSver.TLS_1_2);
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
case 772:
|
|
65
|
-
{
|
|
66
|
-
this.instance.version.setValue(TLSver.TLS_1_3);
|
|
67
|
-
}
|
|
68
|
-
break;
|
|
69
|
-
default: {
|
|
70
|
-
this.instance.version.setValue(0);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
encode: () => {
|
|
75
|
-
const version = this.instance.version.getValue('0', (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
76
|
-
switch (version) {
|
|
77
|
-
case TLSver.SSL_3_0:
|
|
78
|
-
{
|
|
79
|
-
this.writeBytes(1, (0, NumberToBuffer_1.UInt16ToBuffer)(768));
|
|
80
|
-
}
|
|
81
|
-
break;
|
|
82
|
-
case TLSver.TLS_1_0:
|
|
83
|
-
{
|
|
84
|
-
this.writeBytes(1, (0, NumberToBuffer_1.UInt16ToBuffer)(769));
|
|
85
|
-
}
|
|
86
|
-
break;
|
|
87
|
-
case TLSver.TLS_1_1:
|
|
88
|
-
{
|
|
89
|
-
this.writeBytes(1, (0, NumberToBuffer_1.UInt16ToBuffer)(770));
|
|
90
|
-
}
|
|
91
|
-
break;
|
|
92
|
-
case TLSver.TLS_1_2:
|
|
93
|
-
{
|
|
94
|
-
this.writeBytes(1, (0, NumberToBuffer_1.UInt16ToBuffer)(771));
|
|
95
|
-
}
|
|
96
|
-
break;
|
|
97
|
-
case TLSver.TLS_1_3:
|
|
98
|
-
{
|
|
99
|
-
this.writeBytes(1, (0, NumberToBuffer_1.UInt16ToBuffer)(772));
|
|
100
|
-
}
|
|
101
|
-
break;
|
|
102
|
-
default: {
|
|
103
|
-
this.writeBytes(1, (0, NumberToBuffer_1.UInt16ToBuffer)(0));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
length: {
|
|
109
|
-
type: 'integer',
|
|
110
|
-
label: 'Length',
|
|
111
|
-
minimum: 0,
|
|
112
|
-
maximum: 65535,
|
|
113
|
-
decode: () => {
|
|
114
|
-
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(3, 2)));
|
|
115
|
-
},
|
|
116
|
-
encode: () => {
|
|
117
|
-
const length = this.instance.length.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
118
|
-
this.writeBytes(3, (0, NumberToBuffer_1.UInt16ToBuffer)(length));
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
heartbeatType: {
|
|
122
|
-
type: 'string',
|
|
123
|
-
label: 'Heartbeat Type',
|
|
124
|
-
minimum: 0,
|
|
125
|
-
maximum: 255,
|
|
126
|
-
decode: () => {
|
|
127
|
-
const heartbeatType = (0, BufferToNumber_1.BufferToUInt8)(this.readBytes(5, 1));
|
|
128
|
-
switch (heartbeatType) {
|
|
129
|
-
case 1:
|
|
130
|
-
{
|
|
131
|
-
this.instance.heartbeatType.setValue('HeartbeatRequest');
|
|
132
|
-
}
|
|
133
|
-
break;
|
|
134
|
-
case 2:
|
|
135
|
-
{
|
|
136
|
-
this.instance.heartbeatType.setValue('HeartbeatResponse');
|
|
137
|
-
}
|
|
138
|
-
break;
|
|
139
|
-
default: {
|
|
140
|
-
this.instance.heartbeatType.setValue(heartbeatType);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
encode: () => {
|
|
145
|
-
const heartbeatType = this.instance.heartbeatType.getValue('0', (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
146
|
-
switch (heartbeatType) {
|
|
147
|
-
case 'HeartbeatRequest':
|
|
148
|
-
{
|
|
149
|
-
this.writeBytes(5, (0, NumberToBuffer_1.UInt8ToBuffer)(1));
|
|
150
|
-
}
|
|
151
|
-
break;
|
|
152
|
-
case 'HeartbeatResponse':
|
|
153
|
-
{
|
|
154
|
-
this.writeBytes(5, (0, NumberToBuffer_1.UInt8ToBuffer)(2));
|
|
155
|
-
}
|
|
156
|
-
break;
|
|
157
|
-
default: {
|
|
158
|
-
const heartbeatType1 = parseInt(heartbeatType);
|
|
159
|
-
this.writeBytes(5, (0, NumberToBuffer_1.UInt8ToBuffer)(heartbeatType1));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
payloadLength: {
|
|
165
|
-
type: 'integer',
|
|
166
|
-
label: 'Payload Length',
|
|
167
|
-
minimum: 0,
|
|
168
|
-
maximum: 65535,
|
|
169
|
-
decode: () => {
|
|
170
|
-
this.instance.payloadLength.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(6, 2)));
|
|
171
|
-
},
|
|
172
|
-
encode: () => {
|
|
173
|
-
const payloadLength = this.instance.payloadLength.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
174
|
-
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(payloadLength));
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
payloadMessage: {
|
|
178
|
-
type: 'string',
|
|
179
|
-
label: 'Payload Message',
|
|
180
|
-
decode: () => {
|
|
181
|
-
const payloadLength = this.instance.payloadLength.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
182
|
-
const payloadMessage = (0, BufferToHex_1.BufferToHex)(this.readBytes(8, payloadLength));
|
|
183
|
-
this.instance.payloadMessage.setValue(payloadMessage);
|
|
184
|
-
},
|
|
185
|
-
encode: () => {
|
|
186
|
-
const payloadMessage = this.instance.payloadMessage.getValue('0', (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
187
|
-
this.writeBytes(8, (0, HexToBuffer_1.HexToBuffer)(payloadMessage));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
this.id = 'tls-heartbeat';
|
|
193
|
-
this.name = 'Transport Layer Security(Heartbeat Protocol)';
|
|
194
|
-
this.nickname = 'TLS-Heartbeat';
|
|
195
|
-
}
|
|
196
|
-
match() {
|
|
197
|
-
if (!this.prevCodecModule)
|
|
198
|
-
return false;
|
|
199
|
-
if ((0, BufferToHex_1.BufferToHex)(this.readBytes(0, 1)) != '18')
|
|
200
|
-
return false;
|
|
201
|
-
const version = (0, BufferToNumber_1.BufferToUInt16)(this.readBytes(1, 2));
|
|
202
|
-
const validVersions = [768, 769, 770, 771, 772];
|
|
203
|
-
return validVersions.includes(version);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
exports.TLS_Heartbeat = TLS_Heartbeat;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ProtocolJSONSchema } from '../../schema/ProtocolJSONSchema';
|
|
2
|
-
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
-
export declare class UDP extends BaseHeader {
|
|
4
|
-
/**
|
|
5
|
-
* Calculate UDP Checksum
|
|
6
|
-
* @protected
|
|
7
|
-
* @param udpHeaderBuffer
|
|
8
|
-
*/
|
|
9
|
-
protected calculateUDPChecksum(udpHeaderBuffer: Buffer): number;
|
|
10
|
-
SCHEMA: ProtocolJSONSchema;
|
|
11
|
-
readonly id: string;
|
|
12
|
-
readonly name: string;
|
|
13
|
-
readonly nickname: string;
|
|
14
|
-
match(): boolean;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=UDP.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UDP.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/headers/UDP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAMlD,qBAAa,GAAI,SAAQ,UAAU;IAE/B;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IA8CxD,MAAM,EAAE,kBAAkB,CA2GhC;IAED,SAAgB,EAAE,EAAE,MAAM,CAAQ;IAElC,SAAgB,IAAI,EAAE,MAAM,CAA2B;IAEvD,SAAgB,QAAQ,EAAE,MAAM,CAAQ;IAEjC,KAAK,IAAI,OAAO;CAM1B"}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UDP = void 0;
|
|
4
|
-
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
5
|
-
const BufferToNumber_1 = require("../../helper/BufferToNumber");
|
|
6
|
-
const NumberToBuffer_1 = require("../../helper/NumberToBuffer");
|
|
7
|
-
const IPToBuffer_1 = require("../../helper/IPToBuffer");
|
|
8
|
-
class UDP extends BaseHeader_1.BaseHeader {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.SCHEMA = {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
srcport: {
|
|
15
|
-
type: 'integer',
|
|
16
|
-
label: 'Source Port',
|
|
17
|
-
minimum: 0,
|
|
18
|
-
maximum: 65535,
|
|
19
|
-
decode: () => {
|
|
20
|
-
this.instance.srcport.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(0, 2)));
|
|
21
|
-
},
|
|
22
|
-
encode: () => {
|
|
23
|
-
let srcport = this.instance.srcport.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
24
|
-
if (srcport > 65535) {
|
|
25
|
-
this.recordError(this.instance.srcport.getPath(), 'Maximum value is 65535');
|
|
26
|
-
srcport = 65535;
|
|
27
|
-
}
|
|
28
|
-
if (srcport < 0) {
|
|
29
|
-
this.recordError(this.instance.srcport.getPath(), 'Minimum value is 0');
|
|
30
|
-
srcport = 0;
|
|
31
|
-
}
|
|
32
|
-
this.instance.srcport.setValue(srcport);
|
|
33
|
-
this.writeBytes(0, (0, NumberToBuffer_1.UInt16ToBuffer)(srcport));
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
dstport: {
|
|
37
|
-
type: 'integer',
|
|
38
|
-
label: 'Destination Port',
|
|
39
|
-
minimum: 0,
|
|
40
|
-
maximum: 65535,
|
|
41
|
-
decode: () => {
|
|
42
|
-
this.instance.dstport.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(2, 2)));
|
|
43
|
-
},
|
|
44
|
-
encode: () => {
|
|
45
|
-
let dstport = this.instance.dstport.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
46
|
-
if (dstport > 65535) {
|
|
47
|
-
this.recordError(this.instance.dstport.getPath(), 'Maximum value is 65535');
|
|
48
|
-
dstport = 65535;
|
|
49
|
-
}
|
|
50
|
-
if (dstport < 0) {
|
|
51
|
-
this.recordError(this.instance.dstport.getPath(), 'Minimum value is 0');
|
|
52
|
-
dstport = 0;
|
|
53
|
-
}
|
|
54
|
-
this.instance.dstport.setValue(dstport);
|
|
55
|
-
this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(dstport));
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
length: {
|
|
59
|
-
type: 'integer',
|
|
60
|
-
label: 'Length',
|
|
61
|
-
minimum: 0,
|
|
62
|
-
maximum: 65535,
|
|
63
|
-
decode: () => {
|
|
64
|
-
this.instance.length.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(4, 2)));
|
|
65
|
-
},
|
|
66
|
-
encode: () => {
|
|
67
|
-
let length = this.instance.length.getValue(0);
|
|
68
|
-
if (length) {
|
|
69
|
-
this.instance.length.setValue(length);
|
|
70
|
-
this.writeBytes(4, (0, NumberToBuffer_1.UInt16ToBuffer)(length));
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.instance.length.setValue(length);
|
|
74
|
-
this.writeBytes(4, (0, NumberToBuffer_1.UInt16ToBuffer)(length));
|
|
75
|
-
this.addPostPacketEncodeHandler(() => {
|
|
76
|
-
let startCount = false;
|
|
77
|
-
let udpLength = 0;
|
|
78
|
-
this.codecModules.forEach((codecModule) => {
|
|
79
|
-
if (codecModule === this)
|
|
80
|
-
startCount = true;
|
|
81
|
-
if (startCount)
|
|
82
|
-
udpLength += codecModule.length;
|
|
83
|
-
});
|
|
84
|
-
this.instance.length.setValue(udpLength);
|
|
85
|
-
this.writeBytes(4, (0, NumberToBuffer_1.UInt16ToBuffer)(udpLength));
|
|
86
|
-
}, 1);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
checksum: {
|
|
91
|
-
type: 'integer',
|
|
92
|
-
label: 'Checksum',
|
|
93
|
-
minimum: 0,
|
|
94
|
-
maximum: 65535,
|
|
95
|
-
decode: () => {
|
|
96
|
-
this.instance.checksum.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(6, 2)));
|
|
97
|
-
},
|
|
98
|
-
encode: () => {
|
|
99
|
-
const checksum = this.instance.checksum.getValue(0);
|
|
100
|
-
if (checksum) {
|
|
101
|
-
this.instance.checksum.setValue(checksum);
|
|
102
|
-
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
|
|
106
|
-
this.instance.checksum.setValue(checksum);
|
|
107
|
-
this.addPostPacketEncodeHandler(() => {
|
|
108
|
-
let startCount = false;
|
|
109
|
-
let udpHeaderWithDataLength = 0;
|
|
110
|
-
this.codecModules.forEach((codecModule) => {
|
|
111
|
-
if (codecModule === this)
|
|
112
|
-
startCount = true;
|
|
113
|
-
if (startCount)
|
|
114
|
-
udpHeaderWithDataLength += codecModule.length;
|
|
115
|
-
});
|
|
116
|
-
const calcChecksum = this.calculateUDPChecksum(this.packet.subarray(this.startPos, this.startPos + udpHeaderWithDataLength));
|
|
117
|
-
this.instance.checksum.setValue(calcChecksum);
|
|
118
|
-
this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(calcChecksum));
|
|
119
|
-
}, 2);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
this.id = 'udp';
|
|
126
|
-
this.name = 'User Datagram Protocol';
|
|
127
|
-
this.nickname = 'UDP';
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Calculate UDP Checksum
|
|
131
|
-
* @protected
|
|
132
|
-
* @param udpHeaderBuffer
|
|
133
|
-
*/
|
|
134
|
-
calculateUDPChecksum(udpHeaderBuffer) {
|
|
135
|
-
const udpHeaderLength = udpHeaderBuffer.length;
|
|
136
|
-
const ipVersion = this.prevCodecModule.instance.version.getValue();
|
|
137
|
-
let pseudoHeaderBuffer = Buffer.from([]);
|
|
138
|
-
const sourceIp = this.prevCodecModule.instance.sip.getValue();
|
|
139
|
-
const destinationIp = this.prevCodecModule.instance.dip.getValue();
|
|
140
|
-
if (ipVersion === 4) {
|
|
141
|
-
//4 Bytes
|
|
142
|
-
const sourceIPv4Buffer = Buffer.from(sourceIp.split('.').map((value) => parseInt(value)));
|
|
143
|
-
const destinationIPv4Buffer = Buffer.from(destinationIp.split('.').map((value) => parseInt(value)));
|
|
144
|
-
//IPv4 Pseudo header
|
|
145
|
-
pseudoHeaderBuffer = Buffer.concat([
|
|
146
|
-
sourceIPv4Buffer,
|
|
147
|
-
destinationIPv4Buffer,
|
|
148
|
-
(0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
|
|
149
|
-
(0, NumberToBuffer_1.UInt8ToBuffer)(17), //Protocol type (UDP = 17)
|
|
150
|
-
Buffer.from([(udpHeaderLength >> 8) & 0xFF]),
|
|
151
|
-
Buffer.from([udpHeaderLength & 0xFF])
|
|
152
|
-
]);
|
|
153
|
-
}
|
|
154
|
-
else if (ipVersion === 6) {
|
|
155
|
-
//16 Bytes
|
|
156
|
-
const sourceIPv6Buffer = (0, IPToBuffer_1.IPv6ToBuffer)(sourceIp);
|
|
157
|
-
const destinationIPv6Buffer = (0, IPToBuffer_1.IPv6ToBuffer)(destinationIp);
|
|
158
|
-
//IPv6 Pseudo header
|
|
159
|
-
pseudoHeaderBuffer = Buffer.concat([
|
|
160
|
-
sourceIPv6Buffer,
|
|
161
|
-
destinationIPv6Buffer,
|
|
162
|
-
(0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
|
|
163
|
-
(0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
|
|
164
|
-
(0, NumberToBuffer_1.UInt8ToBuffer)(0), //Reserved field
|
|
165
|
-
(0, NumberToBuffer_1.UInt8ToBuffer)(17), //Protocol type (UDP = 17)
|
|
166
|
-
Buffer.from([(udpHeaderLength >> 8) & 0xFF]),
|
|
167
|
-
Buffer.from([udpHeaderLength & 0xFF])
|
|
168
|
-
]);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
return 0;
|
|
172
|
-
}
|
|
173
|
-
let dataBuffer = Buffer.concat([pseudoHeaderBuffer, udpHeaderBuffer]);
|
|
174
|
-
if (dataBuffer.length % 2)
|
|
175
|
-
dataBuffer = Buffer.concat([dataBuffer, Buffer.from('00', 'hex')]);
|
|
176
|
-
const data = Uint8Array.from(dataBuffer);
|
|
177
|
-
let sum = 0;
|
|
178
|
-
for (let i = 0; i < data.length; i += 2)
|
|
179
|
-
sum += (data[i] << 8) + (data[i + 1] || 0);
|
|
180
|
-
while (sum > 0xFFFF)
|
|
181
|
-
sum = (sum & 0xFFFF) + (sum >>> 16);
|
|
182
|
-
return (~sum) & 0xFFFF;
|
|
183
|
-
}
|
|
184
|
-
match() {
|
|
185
|
-
if (!this.prevCodecModule)
|
|
186
|
-
return false;
|
|
187
|
-
if (this.prevCodecModule.instance.protocol.getValue() === 0x11)
|
|
188
|
-
return true;
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
exports.UDP = UDP;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ProtocolJSONSchema } from '../../schema/ProtocolJSONSchema';
|
|
2
|
-
import { BaseHeader } from '../abstracts/BaseHeader';
|
|
3
|
-
export declare class VLAN_802dot1Q extends BaseHeader {
|
|
4
|
-
SCHEMA: ProtocolJSONSchema;
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly nickname: string;
|
|
8
|
-
match(): boolean;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=VLAN_802dot1Q.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VLAN_802dot1Q.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/headers/VLAN_802dot1Q.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAIlD,qBAAa,aAAc,SAAQ,UAAU;IAClC,MAAM,EAAE,kBAAkB,CA4DhC;IAED,SAAgB,EAAE,EAAE,MAAM,CAAS;IAEnC,SAAgB,IAAI,EAAE,MAAM,CAAuB;IAEnD,SAAgB,QAAQ,EAAE,MAAM,CAAS;IAElC,KAAK,IAAI,OAAO;CAI1B"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VLAN_802dot1Q = void 0;
|
|
4
|
-
const BaseHeader_1 = require("../abstracts/BaseHeader");
|
|
5
|
-
const NumberToHex_1 = require("../../helper/NumberToHex");
|
|
6
|
-
const BufferToHex_1 = require("../../helper/BufferToHex");
|
|
7
|
-
class VLAN_802dot1Q extends BaseHeader_1.BaseHeader {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...arguments);
|
|
10
|
-
this.SCHEMA = {
|
|
11
|
-
type: 'object',
|
|
12
|
-
properties: {
|
|
13
|
-
priority: {
|
|
14
|
-
type: 'integer',
|
|
15
|
-
minimum: 0,
|
|
16
|
-
maximum: 7,
|
|
17
|
-
default: 0,
|
|
18
|
-
label: 'Priority',
|
|
19
|
-
decode: () => {
|
|
20
|
-
this.instance.priority.setValue(this.readBits(0, 2, 0, 3));
|
|
21
|
-
},
|
|
22
|
-
encode: () => {
|
|
23
|
-
const priorityValue = this.instance.priority.getValue(0);
|
|
24
|
-
this.instance.priority.setValue(priorityValue);
|
|
25
|
-
this.writeBits(0, 2, 0, 3, priorityValue);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
dei: {
|
|
29
|
-
type: 'boolean',
|
|
30
|
-
label: 'DEI',
|
|
31
|
-
decode: () => {
|
|
32
|
-
this.instance.dei.setValue(!!this.readBits(0, 2, 3, 1));
|
|
33
|
-
},
|
|
34
|
-
encode: () => {
|
|
35
|
-
const dei = !!this.instance.dei.getValue();
|
|
36
|
-
this.instance.dei.setValue(dei);
|
|
37
|
-
this.writeBits(0, 2, 3, 1, dei ? 1 : 0);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
id: {
|
|
41
|
-
type: 'integer',
|
|
42
|
-
minimum: 0,
|
|
43
|
-
maximum: 4095,
|
|
44
|
-
label: 'ID',
|
|
45
|
-
decode: () => {
|
|
46
|
-
this.instance.id.setValue(this.readBits(0, 2, 4, 12));
|
|
47
|
-
},
|
|
48
|
-
encode: () => {
|
|
49
|
-
const vlanId = this.instance.id.getValue(0);
|
|
50
|
-
this.instance.id.setValue(vlanId);
|
|
51
|
-
this.writeBits(0, 2, 4, 12, vlanId);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
etherType: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
minLength: 4,
|
|
57
|
-
maxLength: 4,
|
|
58
|
-
label: 'EtherType',
|
|
59
|
-
decode: () => {
|
|
60
|
-
this.instance.etherType.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(2, 2)));
|
|
61
|
-
},
|
|
62
|
-
encode: () => {
|
|
63
|
-
const etherType = this.instance.etherType.getValue((0, NumberToHex_1.UInt16ToHex)(0x0000), (nodePath) => this.recordError(nodePath, 'Not Found'));
|
|
64
|
-
const typeBuffer = Buffer.from(etherType, 'hex');
|
|
65
|
-
if (typeBuffer.length < 2)
|
|
66
|
-
typeBuffer.fill(0, 0, 1);
|
|
67
|
-
this.writeBytes(2, typeBuffer.subarray(0, 2));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
this.id = 'vlan';
|
|
73
|
-
this.name = '802.1Q Virtual LAN';
|
|
74
|
-
this.nickname = 'VLAN';
|
|
75
|
-
}
|
|
76
|
-
match() {
|
|
77
|
-
if (!this.prevCodecModule)
|
|
78
|
-
return false;
|
|
79
|
-
return this.prevCodecModule.instance.etherType.getValue() === (0, NumberToHex_1.UInt16ToHex)(0x8100);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.VLAN_802dot1Q = VLAN_802dot1Q;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare class FlexibleObject {
|
|
2
|
-
#private;
|
|
3
|
-
constructor(data?: object, parent?: FlexibleObject, paths?: string[]);
|
|
4
|
-
/**
|
|
5
|
-
* Set object node value
|
|
6
|
-
* @param value
|
|
7
|
-
*/
|
|
8
|
-
setValue(value: any): void;
|
|
9
|
-
/**
|
|
10
|
-
* Get object node value
|
|
11
|
-
* @param defaultValue
|
|
12
|
-
* @param onUndefinedCallback
|
|
13
|
-
* @param getPathIndex
|
|
14
|
-
*/
|
|
15
|
-
getValue<T = any>(defaultValue?: T, onUndefinedCallback?: (nodePath: string) => void, getPathIndex?: number): T;
|
|
16
|
-
/**
|
|
17
|
-
* Is current object's value undefined
|
|
18
|
-
*/
|
|
19
|
-
isUndefined(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get current object path
|
|
22
|
-
* The index parameter indicates array item if this object is an array
|
|
23
|
-
* @param index
|
|
24
|
-
*/
|
|
25
|
-
getPath(index?: number): string;
|
|
26
|
-
[p: string]: FlexibleObject;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=FlexibleObject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlexibleObject.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/lib/FlexibleObject.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;;gBAgBX,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE;IAiBpE;;;OAGG;IAEI,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAYjC;;;;;OAKG;IAEI,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,YAAY,CAAC,EAAE,CAAC,EAAE,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC;IAqBtH;;OAEG;IAEI,WAAW,IAAI,OAAO;IAI7B;;;;OAIG;IAEI,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAMtC,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAAA;CAC9B"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FlexibleObject = void 0;
|
|
4
|
-
class FlexibleObject {
|
|
5
|
-
#parent;
|
|
6
|
-
#paths;
|
|
7
|
-
#data;
|
|
8
|
-
#undefined = true;
|
|
9
|
-
#markFlexibleObjectDefined() {
|
|
10
|
-
if (!this.#undefined)
|
|
11
|
-
return;
|
|
12
|
-
this.#undefined = false;
|
|
13
|
-
if (this.#parent)
|
|
14
|
-
this.#parent.#markFlexibleObjectDefined();
|
|
15
|
-
}
|
|
16
|
-
constructor(data, parent, paths) {
|
|
17
|
-
this.#parent = parent;
|
|
18
|
-
this.#data = {};
|
|
19
|
-
this.#paths = paths ? paths : [];
|
|
20
|
-
if (data !== undefined)
|
|
21
|
-
this.setValue(data);
|
|
22
|
-
return new Proxy(this, {
|
|
23
|
-
get: (target, p) => {
|
|
24
|
-
if (this[p])
|
|
25
|
-
return (...args) => this[p](...args);
|
|
26
|
-
if (target.#data[p] === undefined)
|
|
27
|
-
target.#data[p] = new FlexibleObject(target.#data[p], this, [...this.#paths, p]);
|
|
28
|
-
return target.#data[p];
|
|
29
|
-
},
|
|
30
|
-
set: (target, p, newValue) => {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Set object node value
|
|
37
|
-
* @param value
|
|
38
|
-
*/
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
setValue(value) {
|
|
41
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
42
|
-
Object.keys(value).forEach(key => {
|
|
43
|
-
this.#data[key] = new FlexibleObject(this.#data[key], this, [...this.#paths, key]);
|
|
44
|
-
this.#data[key].setValue(value[key]);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
this.#data = value;
|
|
49
|
-
}
|
|
50
|
-
this.#markFlexibleObjectDefined();
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get object node value
|
|
54
|
-
* @param defaultValue
|
|
55
|
-
* @param onUndefinedCallback
|
|
56
|
-
* @param getPathIndex
|
|
57
|
-
*/
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
getValue(defaultValue, onUndefinedCallback, getPathIndex) {
|
|
60
|
-
if (this.#undefined) {
|
|
61
|
-
if (onUndefinedCallback)
|
|
62
|
-
onUndefinedCallback(this.getPath(getPathIndex));
|
|
63
|
-
if (defaultValue !== undefined) {
|
|
64
|
-
return defaultValue;
|
|
65
|
-
}
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
if (typeof this.#data === 'object' && !Array.isArray(this.#data)) {
|
|
69
|
-
const dumpObject = {};
|
|
70
|
-
Object.keys(this.#data).forEach((key) => {
|
|
71
|
-
const dumpResult = this.#data[key].getValue();
|
|
72
|
-
if (dumpResult === undefined)
|
|
73
|
-
return;
|
|
74
|
-
dumpObject[key] = dumpResult;
|
|
75
|
-
});
|
|
76
|
-
return dumpObject;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
return this.#undefined ? undefined : this.#data;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Is current object's value undefined
|
|
84
|
-
*/
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
isUndefined() {
|
|
87
|
-
return this.#undefined;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Get current object path
|
|
91
|
-
* The index parameter indicates array item if this object is an array
|
|
92
|
-
* @param index
|
|
93
|
-
*/
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
getPath(index) {
|
|
96
|
-
const objPath = this.#paths.join('.');
|
|
97
|
-
if (index === undefined)
|
|
98
|
-
return objPath;
|
|
99
|
-
return `${objPath}[${index}]`;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.FlexibleObject = FlexibleObject;
|