netkitty 0.0.17 → 0.0.19
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/dist/CodecExports.d.ts +33 -0
- package/dist/CodecExports.d.ts.map +1 -0
- package/dist/CodecExports.js +23 -0
- package/dist/CodecHeaderExports.d.ts +2 -0
- package/dist/CodecHeaderExports.d.ts.map +1 -0
- package/dist/CodecHeaderExports.js +17 -0
- package/dist/HelperExports.d.ts +11 -0
- package/dist/HelperExports.d.ts.map +1 -0
- package/dist/HelperExports.js +72 -0
- package/dist/NetKitty.d.ts +1 -0
- package/dist/NetKitty.d.ts.map +1 -0
- package/dist/NetKitty.js +90 -0
- package/dist/NetworkExports.d.ts +13 -0
- package/dist/NetworkExports.d.ts.map +1 -0
- package/dist/NetworkExports.js +13 -0
- package/dist/PcapExports.d.ts +17 -0
- package/dist/PcapExports.d.ts.map +1 -0
- package/dist/PcapExports.js +18 -0
- package/dist/errors/ActionNotFoundError.d.ts +5 -0
- package/dist/errors/ActionNotFoundError.d.ts.map +1 -0
- package/dist/errors/ActionNotFoundError.js +12 -0
- package/dist/errors/CodecSchemaValidateError.d.ts +5 -0
- package/dist/errors/CodecSchemaValidateError.d.ts.map +1 -0
- package/dist/errors/CodecSchemaValidateError.js +12 -0
- package/dist/errors/DeviceNotFoundError.d.ts +5 -0
- package/dist/errors/DeviceNotFoundError.d.ts.map +1 -0
- package/dist/errors/DeviceNotFoundError.js +12 -0
- package/dist/errors/NoAvailableCodecError.d.ts +5 -0
- package/dist/errors/NoAvailableCodecError.d.ts.map +1 -0
- package/dist/errors/NoAvailableCodecError.js +12 -0
- package/dist/errors/NpcapLoadError.d.ts +5 -0
- package/dist/errors/NpcapLoadError.d.ts.map +1 -0
- package/dist/errors/NpcapLoadError.js +12 -0
- package/dist/errors/SocketDownError.d.ts +5 -0
- package/dist/errors/SocketDownError.d.ts.map +1 -0
- package/dist/errors/SocketDownError.js +12 -0
- package/dist/errors/UnknownPipeMessageTypeError.d.ts +5 -0
- package/dist/errors/UnknownPipeMessageTypeError.d.ts.map +1 -0
- package/dist/errors/UnknownPipeMessageTypeError.js +12 -0
- package/dist/errors/common/ErrorCode.d.ts +31 -0
- package/dist/errors/common/ErrorCode.d.ts.map +1 -0
- package/dist/errors/common/ErrorCode.js +33 -0
- package/dist/lib/GeneratePipeAddress.d.ts +7 -0
- package/dist/lib/GeneratePipeAddress.d.ts.map +1 -0
- package/dist/lib/GeneratePipeAddress.js +23 -0
- package/dist/lib/GetBinding.d.ts +2 -0
- package/dist/lib/GetBinding.d.ts.map +1 -0
- package/dist/lib/GetBinding.js +6 -0
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts +7 -0
- package/dist/lib/GetCaptureTemporaryDirectory.d.ts.map +1 -0
- package/dist/lib/GetCaptureTemporaryDirectory.js +15 -0
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts +8 -0
- package/dist/lib/GetDeviceCaptureTemporaryFilename.d.ts.map +1 -0
- package/dist/lib/GetDeviceCaptureTemporaryFilename.js +18 -0
- package/dist/lib/codec/Codec.d.ts +32 -0
- package/dist/lib/codec/Codec.d.ts.map +1 -0
- package/dist/lib/codec/Codec.js +183 -0
- package/dist/lib/codec/PacketHeaders.d.ts +14 -0
- package/dist/lib/codec/PacketHeaders.d.ts.map +1 -0
- package/dist/lib/codec/PacketHeaders.js +29 -0
- package/dist/lib/codec/abstracts/BaseHeader.d.ts +217 -0
- package/dist/lib/codec/abstracts/BaseHeader.d.ts.map +1 -0
- package/dist/lib/codec/abstracts/BaseHeader.js +356 -0
- package/dist/lib/codec/headers/ARP.d.ts +10 -0
- package/dist/lib/codec/headers/ARP.d.ts.map +1 -0
- package/dist/lib/codec/headers/ARP.js +224 -0
- package/dist/lib/codec/headers/EthernetII.d.ts +10 -0
- package/dist/lib/codec/headers/EthernetII.d.ts.map +1 -0
- package/dist/lib/codec/headers/EthernetII.js +81 -0
- package/dist/lib/codec/headers/Goose.d.ts +13 -0
- package/dist/lib/codec/headers/Goose.d.ts.map +1 -0
- package/dist/lib/codec/headers/Goose.js +720 -0
- package/dist/lib/codec/headers/ICMP.d.ts +15 -0
- package/dist/lib/codec/headers/ICMP.d.ts.map +1 -0
- package/dist/lib/codec/headers/ICMP.js +147 -0
- package/dist/lib/codec/headers/ICMPv6.d.ts +15 -0
- package/dist/lib/codec/headers/ICMPv6.d.ts.map +1 -0
- package/dist/lib/codec/headers/ICMPv6.js +128 -0
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts +13 -0
- package/dist/lib/codec/headers/IEC61850SampledValues.d.ts.map +1 -0
- package/dist/lib/codec/headers/IEC61850SampledValues.js +370 -0
- package/dist/lib/codec/headers/IPv4.d.ts +16 -0
- package/dist/lib/codec/headers/IPv4.d.ts.map +1 -0
- package/dist/lib/codec/headers/IPv4.js +339 -0
- package/dist/lib/codec/headers/IPv6.d.ts +10 -0
- package/dist/lib/codec/headers/IPv6.d.ts.map +1 -0
- package/dist/lib/codec/headers/IPv6.js +177 -0
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts +71 -0
- package/dist/lib/codec/headers/IPv6HopByHopOptions.d.ts.map +1 -0
- package/dist/lib/codec/headers/IPv6HopByHopOptions.js +497 -0
- package/dist/lib/codec/headers/RawData.d.ts +11 -0
- package/dist/lib/codec/headers/RawData.d.ts.map +1 -0
- package/dist/lib/codec/headers/RawData.js +36 -0
- package/dist/lib/codec/headers/TCP.d.ts +16 -0
- package/dist/lib/codec/headers/TCP.d.ts.map +1 -0
- package/dist/lib/codec/headers/TCP.js +899 -0
- package/dist/lib/codec/headers/UDP.d.ts +16 -0
- package/dist/lib/codec/headers/UDP.d.ts.map +1 -0
- package/dist/lib/codec/headers/UDP.js +192 -0
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts +10 -0
- package/dist/lib/codec/headers/VLAN_802dot1Q.d.ts.map +1 -0
- package/dist/lib/codec/headers/VLAN_802dot1Q.js +78 -0
- package/dist/lib/codec/lib/FlexibleObject.d.ts +28 -0
- package/dist/lib/codec/lib/FlexibleObject.d.ts.map +1 -0
- package/dist/lib/codec/lib/FlexibleObject.js +102 -0
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts +14 -0
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.d.ts.map +1 -0
- package/dist/lib/codec/lib/ProcessPacketPostHandlers.js +53 -0
- package/dist/lib/codec/lib/SortPostHandlers.d.ts +8 -0
- package/dist/lib/codec/lib/SortPostHandlers.d.ts.map +1 -0
- package/dist/lib/codec/lib/SortPostHandlers.js +11 -0
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts +11 -0
- package/dist/lib/codec/lib/StringContentEncodingEnum.d.ts.map +1 -0
- package/dist/lib/codec/lib/StringContentEncodingEnum.js +14 -0
- package/dist/lib/codec/types/CodecData.d.ts +7 -0
- package/dist/lib/codec/types/CodecData.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecData.js +2 -0
- package/dist/lib/codec/types/CodecDecodeResult.d.ts +11 -0
- package/dist/lib/codec/types/CodecDecodeResult.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecDecodeResult.js +2 -0
- package/dist/lib/codec/types/CodecEncodeInput.d.ts +9 -0
- package/dist/lib/codec/types/CodecEncodeInput.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecEncodeInput.js +2 -0
- package/dist/lib/codec/types/CodecEncodeResult.d.ts +6 -0
- package/dist/lib/codec/types/CodecEncodeResult.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecEncodeResult.js +2 -0
- package/dist/lib/codec/types/CodecErrorInfo.d.ts +6 -0
- package/dist/lib/codec/types/CodecErrorInfo.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecErrorInfo.js +2 -0
- package/dist/lib/codec/types/CodecModule.d.ts +3 -0
- package/dist/lib/codec/types/CodecModule.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecModule.js +2 -0
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts +3 -0
- package/dist/lib/codec/types/CodecModuleConstructor.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecModuleConstructor.js +2 -0
- package/dist/lib/codec/types/CodecSchema.d.ts +7 -0
- package/dist/lib/codec/types/CodecSchema.d.ts.map +1 -0
- package/dist/lib/codec/types/CodecSchema.js +2 -0
- package/dist/lib/codec/types/HeaderTreeNode.d.ts +5 -0
- package/dist/lib/codec/types/HeaderTreeNode.d.ts.map +1 -0
- package/dist/lib/codec/types/HeaderTreeNode.js +2 -0
- package/dist/lib/codec/types/PostHandlerItem.d.ts +5 -0
- package/dist/lib/codec/types/PostHandlerItem.d.ts.map +1 -0
- package/dist/lib/codec/types/PostHandlerItem.js +2 -0
- package/dist/lib/helper/BufferToHex.d.ts +2 -0
- package/dist/lib/helper/BufferToHex.d.ts.map +1 -0
- package/dist/lib/helper/BufferToHex.js +6 -0
- package/dist/lib/helper/BufferToIP.d.ts +13 -0
- package/dist/lib/helper/BufferToIP.d.ts.map +1 -0
- package/dist/lib/helper/BufferToIP.js +21 -0
- package/dist/lib/helper/BufferToNumber.d.ts +10 -0
- package/dist/lib/helper/BufferToNumber.d.ts.map +1 -0
- package/dist/lib/helper/BufferToNumber.js +22 -0
- package/dist/lib/helper/HexToBuffer.d.ts +8 -0
- package/dist/lib/helper/HexToBuffer.d.ts.map +1 -0
- package/dist/lib/helper/HexToBuffer.js +27 -0
- package/dist/lib/helper/HexToNumber.d.ts +10 -0
- package/dist/lib/helper/HexToNumber.d.ts.map +1 -0
- package/dist/lib/helper/HexToNumber.js +39 -0
- package/dist/lib/helper/IPToBuffer.d.ts +13 -0
- package/dist/lib/helper/IPToBuffer.d.ts.map +1 -0
- package/dist/lib/helper/IPToBuffer.js +28 -0
- package/dist/lib/helper/NumberToBERBuffer.d.ts +9 -0
- package/dist/lib/helper/NumberToBERBuffer.d.ts.map +1 -0
- package/dist/lib/helper/NumberToBERBuffer.js +20 -0
- package/dist/lib/helper/NumberToBERHex.d.ts +9 -0
- package/dist/lib/helper/NumberToBERHex.d.ts.map +1 -0
- package/dist/lib/helper/NumberToBERHex.js +23 -0
- package/dist/lib/helper/NumberToBuffer.d.ts +10 -0
- package/dist/lib/helper/NumberToBuffer.d.ts.map +1 -0
- package/dist/lib/helper/NumberToBuffer.js +22 -0
- package/dist/lib/helper/NumberToHex.d.ts +10 -0
- package/dist/lib/helper/NumberToHex.d.ts.map +1 -0
- package/dist/lib/helper/NumberToHex.js +26 -0
- package/dist/lib/nodepcap/Capture.d.ts +75 -0
- package/dist/lib/nodepcap/Capture.d.ts.map +1 -0
- package/dist/lib/nodepcap/Capture.js +309 -0
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts +7 -0
- package/dist/lib/nodepcap/GetNetworkInterfaces.d.ts.map +1 -0
- package/dist/lib/nodepcap/GetNetworkInterfaces.js +22 -0
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts +16 -0
- package/dist/lib/nodepcap/interfaces/IBindingCapture.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/IBindingCapture.js +2 -0
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts +5 -0
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/IBindingCaptureOptions.js +2 -0
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts +19 -0
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/ICaptureOptions.js +2 -0
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts +5 -0
- package/dist/lib/nodepcap/interfaces/INetworkInterface.d.ts.map +1 -0
- package/dist/lib/nodepcap/interfaces/INetworkInterface.js +2 -0
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts +15 -0
- package/dist/lib/nodepcap/lib/BindingCapture.d.ts.map +1 -0
- package/dist/lib/nodepcap/lib/BindingCapture.js +35 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts +2 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.d.ts.map +1 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBinding.js +55 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts +3 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.d.ts.map +1 -0
- package/dist/lib/nodepcap/lib/GetNodePcapBindingCapture.js +18 -0
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts +2 -0
- package/dist/lib/nodepcap/workers/CaptureWorker.d.ts.map +1 -0
- package/dist/lib/nodepcap/workers/CaptureWorker.js +25 -0
- package/dist/lib/pcap/PCAPGenerator.d.ts +34 -0
- package/dist/lib/pcap/PCAPGenerator.d.ts.map +1 -0
- package/dist/lib/pcap/PCAPGenerator.js +95 -0
- package/dist/lib/pcap/PcapParser.d.ts +27 -0
- package/dist/lib/pcap/PcapParser.d.ts.map +1 -0
- package/dist/lib/pcap/PcapParser.js +149 -0
- package/dist/lib/pcap/PcapReader.d.ts +89 -0
- package/dist/lib/pcap/PcapReader.d.ts.map +1 -0
- package/dist/lib/pcap/PcapReader.js +209 -0
- package/dist/lib/pcap/PcapWriter.d.ts +29 -0
- package/dist/lib/pcap/PcapWriter.d.ts.map +1 -0
- package/dist/lib/pcap/PcapWriter.js +80 -0
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts +13 -0
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.d.ts.map +1 -0
- package/dist/lib/pcap/interfaces/IPcapPacketInfo.js +2 -0
- package/dist/lib/pipe/PipeClient.d.ts +35 -0
- package/dist/lib/pipe/PipeClient.d.ts.map +1 -0
- package/dist/lib/pipe/PipeClient.js +71 -0
- package/dist/lib/pipe/PipeClientSocket.d.ts +39 -0
- package/dist/lib/pipe/PipeClientSocket.d.ts.map +1 -0
- package/dist/lib/pipe/PipeClientSocket.js +82 -0
- package/dist/lib/pipe/PipeMessage.d.ts +27 -0
- package/dist/lib/pipe/PipeMessage.d.ts.map +1 -0
- package/dist/lib/pipe/PipeMessage.js +61 -0
- package/dist/lib/pipe/PipeMessageHandler.d.ts +16 -0
- package/dist/lib/pipe/PipeMessageHandler.d.ts.map +1 -0
- package/dist/lib/pipe/PipeMessageHandler.js +95 -0
- package/dist/lib/pipe/PipeServer.d.ts +25 -0
- package/dist/lib/pipe/PipeServer.d.ts.map +1 -0
- package/dist/lib/pipe/PipeServer.js +59 -0
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts +35 -0
- package/dist/lib/schema/ProtocolFieldJSONSchema.d.ts.map +1 -0
- package/dist/lib/schema/ProtocolFieldJSONSchema.js +2 -0
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts +3 -0
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.d.ts.map +1 -0
- package/dist/lib/schema/ProtocolFieldJSONSchemaDefinition.js +2 -0
- package/dist/lib/schema/ProtocolJSONSchema.d.ts +32 -0
- package/dist/lib/schema/ProtocolJSONSchema.d.ts.map +1 -0
- package/dist/lib/schema/ProtocolJSONSchema.js +2 -0
- package/dist/tests/Test.spec.d.ts +2 -0
- package/dist/tests/Test.spec.d.ts.map +1 -0
- package/dist/tests/Test.spec.js +25 -0
- package/dist/tests/units/CaptureTest.spec.d.ts +2 -0
- package/dist/tests/units/CaptureTest.spec.d.ts.map +1 -0
- package/dist/tests/units/CaptureTest.spec.js +31 -0
- package/dist/tests/units/Codec.spec.d.ts +2 -0
- package/dist/tests/units/Codec.spec.d.ts.map +1 -0
- package/dist/tests/units/Codec.spec.js +73 -0
- package/dist/tests/units/ReadPCAP.spec.d.ts +2 -0
- package/dist/tests/units/ReadPCAP.spec.d.ts.map +1 -0
- package/dist/tests/units/ReadPCAP.spec.js +14 -0
- package/package.json +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodecModule.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/types/CodecModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAElD,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodecModuleConstructor.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/types/CodecModuleConstructor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAElD,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,OAAO,UAAU,GAAG,OAAO,UAAU,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodecSchema.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/types/CodecSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAElE,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;CACtC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeaderTreeNode.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/types/HeaderTreeNode.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc,CAAA;AAE5E,MAAM,MAAM,cAAc,GAAG;IACzB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,CAAA;CAC/D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostHandlerItem.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/types/PostHandlerItem.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BufferToHex.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/BufferToHex.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert Buffer to IPv4 string
|
|
3
|
+
* @param buffer
|
|
4
|
+
* @constructor
|
|
5
|
+
*/
|
|
6
|
+
export declare function BufferToIPv4(buffer: Buffer): string;
|
|
7
|
+
/**
|
|
8
|
+
* Convert Buffer to IPv6 string
|
|
9
|
+
* @param buffer
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
export declare function BufferToIPv6(buffer: Buffer): string;
|
|
13
|
+
//# sourceMappingURL=BufferToIP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BufferToIP.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/BufferToIP.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BufferToIPv4 = BufferToIPv4;
|
|
4
|
+
exports.BufferToIPv6 = BufferToIPv6;
|
|
5
|
+
const ip_address_1 = require("ip-address");
|
|
6
|
+
/**
|
|
7
|
+
* Convert Buffer to IPv4 string
|
|
8
|
+
* @param buffer
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
function BufferToIPv4(buffer) {
|
|
12
|
+
return ip_address_1.Address4.fromBigInt(BigInt(`0x${Buffer.alloc(4, buffer).toString('hex').padStart(8, '0')}`)).address;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert Buffer to IPv6 string
|
|
16
|
+
* @param buffer
|
|
17
|
+
* @constructor
|
|
18
|
+
*/
|
|
19
|
+
function BufferToIPv6(buffer) {
|
|
20
|
+
return ip_address_1.Address6.fromBigInt(BigInt(`0x${Buffer.alloc(16, buffer).toString('hex').padStart(32, '0')}`)).address;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const BufferToInt8: (buffer: Buffer) => number;
|
|
2
|
+
export declare const BufferToInt16: (buffer: Buffer) => number;
|
|
3
|
+
export declare const BufferToInt32: (buffer: Buffer) => number;
|
|
4
|
+
export declare const BufferToInt64: (buffer: Buffer) => bigint;
|
|
5
|
+
export declare const BufferToUInt8: (buffer: Buffer) => number;
|
|
6
|
+
export declare const BufferToUInt16: (buffer: Buffer) => number;
|
|
7
|
+
export declare const BufferToUInt32: (buffer: Buffer) => number;
|
|
8
|
+
export declare const BufferToUInt64: (buffer: Buffer) => bigint;
|
|
9
|
+
export declare const BufferToFloat32: (buffer: Buffer) => number;
|
|
10
|
+
//# sourceMappingURL=BufferToNumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BufferToNumber.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/BufferToNumber.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAsE,CAAA;AACrH,eAAO,MAAM,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAuE,CAAA;AACvH,eAAO,MAAM,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAuE,CAAA;AACvH,eAAO,MAAM,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAuE,CAAA;AACvH,eAAO,MAAM,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAuE,CAAA;AACvH,eAAO,MAAM,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAwE,CAAA;AACzH,eAAO,MAAM,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAwE,CAAA;AACzH,eAAO,MAAM,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAwE,CAAA;AACzH,eAAO,MAAM,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAyE,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BufferToFloat32 = exports.BufferToUInt64 = exports.BufferToUInt32 = exports.BufferToUInt16 = exports.BufferToUInt8 = exports.BufferToInt64 = exports.BufferToInt32 = exports.BufferToInt16 = exports.BufferToInt8 = void 0;
|
|
4
|
+
const HexToNumber_1 = require("./HexToNumber");
|
|
5
|
+
const BufferToInt8 = (buffer) => (0, HexToNumber_1.HexToInt8)(buffer.toString('hex'));
|
|
6
|
+
exports.BufferToInt8 = BufferToInt8;
|
|
7
|
+
const BufferToInt16 = (buffer) => (0, HexToNumber_1.HexToInt16)(buffer.toString('hex'));
|
|
8
|
+
exports.BufferToInt16 = BufferToInt16;
|
|
9
|
+
const BufferToInt32 = (buffer) => (0, HexToNumber_1.HexToInt32)(buffer.toString('hex'));
|
|
10
|
+
exports.BufferToInt32 = BufferToInt32;
|
|
11
|
+
const BufferToInt64 = (buffer) => (0, HexToNumber_1.HexToInt64)(buffer.toString('hex'));
|
|
12
|
+
exports.BufferToInt64 = BufferToInt64;
|
|
13
|
+
const BufferToUInt8 = (buffer) => (0, HexToNumber_1.HexToUInt8)(buffer.toString('hex'));
|
|
14
|
+
exports.BufferToUInt8 = BufferToUInt8;
|
|
15
|
+
const BufferToUInt16 = (buffer) => (0, HexToNumber_1.HexToUInt16)(buffer.toString('hex'));
|
|
16
|
+
exports.BufferToUInt16 = BufferToUInt16;
|
|
17
|
+
const BufferToUInt32 = (buffer) => (0, HexToNumber_1.HexToUInt32)(buffer.toString('hex'));
|
|
18
|
+
exports.BufferToUInt32 = BufferToUInt32;
|
|
19
|
+
const BufferToUInt64 = (buffer) => (0, HexToNumber_1.HexToUInt64)(buffer.toString('hex'));
|
|
20
|
+
exports.BufferToUInt64 = BufferToUInt64;
|
|
21
|
+
const BufferToFloat32 = (buffer) => (0, HexToNumber_1.HexToFloat32)(buffer.toString('hex'));
|
|
22
|
+
exports.BufferToFloat32 = BufferToFloat32;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HexToBuffer.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/HexToBuffer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAetE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HexToBuffer = HexToBuffer;
|
|
4
|
+
/**
|
|
5
|
+
* Convert hex to buffer
|
|
6
|
+
* @param hex
|
|
7
|
+
* @param bufferLength
|
|
8
|
+
* @constructor
|
|
9
|
+
*/
|
|
10
|
+
function HexToBuffer(hex, bufferLength) {
|
|
11
|
+
if (!hex)
|
|
12
|
+
return Buffer.alloc(0);
|
|
13
|
+
const inputHex = hex.length % 2 ? hex.padStart(hex.length + 1, '0') : hex;
|
|
14
|
+
const outputBufferLength = bufferLength ? bufferLength : inputHex.length / 2;
|
|
15
|
+
let buffer = Buffer.from(inputHex, 'hex');
|
|
16
|
+
if (buffer.length > outputBufferLength) {
|
|
17
|
+
buffer.subarray(0, outputBufferLength);
|
|
18
|
+
}
|
|
19
|
+
else if (buffer.length < outputBufferLength) {
|
|
20
|
+
const paddingLength = outputBufferLength - buffer.length;
|
|
21
|
+
buffer = Buffer.concat([
|
|
22
|
+
Buffer.alloc(paddingLength, 0x00),
|
|
23
|
+
buffer
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
return buffer;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const HexToInt8: (hex: string) => number;
|
|
2
|
+
export declare const HexToInt16: (hex: string) => number;
|
|
3
|
+
export declare const HexToInt32: (hex: string) => number;
|
|
4
|
+
export declare const HexToInt64: (hex: string) => bigint;
|
|
5
|
+
export declare const HexToUInt8: (hex: string) => number;
|
|
6
|
+
export declare const HexToUInt16: (hex: string) => number;
|
|
7
|
+
export declare const HexToUInt32: (hex: string) => number;
|
|
8
|
+
export declare const HexToUInt64: (hex: string) => bigint;
|
|
9
|
+
export declare const HexToFloat32: (hex: string) => number;
|
|
10
|
+
//# sourceMappingURL=HexToNumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HexToNumber.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/HexToNumber.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAwE,CAAA;AACjH,eAAO,MAAM,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAyE,CAAA;AACnH,eAAO,MAAM,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAyE,CAAA;AACnH,eAAO,MAAM,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAMzC,CAAA;AACD,eAAO,MAAM,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAyE,CAAA;AACnH,eAAO,MAAM,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAA0E,CAAA;AACrH,eAAO,MAAM,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAA0E,CAAA;AACrH,eAAO,MAAM,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAK1C,CAAA;AACD,eAAO,MAAM,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAK3C,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HexToFloat32 = exports.HexToUInt64 = exports.HexToUInt32 = exports.HexToUInt16 = exports.HexToUInt8 = exports.HexToInt64 = exports.HexToInt32 = exports.HexToInt16 = exports.HexToInt8 = void 0;
|
|
4
|
+
const HexToInt8 = (hex) => Int8Array.from([parseInt(hex, 16)])[0];
|
|
5
|
+
exports.HexToInt8 = HexToInt8;
|
|
6
|
+
const HexToInt16 = (hex) => Int16Array.from([parseInt(hex, 16)])[0];
|
|
7
|
+
exports.HexToInt16 = HexToInt16;
|
|
8
|
+
const HexToInt32 = (hex) => Int32Array.from([parseInt(hex, 16)])[0];
|
|
9
|
+
exports.HexToInt32 = HexToInt32;
|
|
10
|
+
const HexToInt64 = (hex) => {
|
|
11
|
+
const INT64_MAX = BigInt('9223372036854775807');
|
|
12
|
+
const INT64_MIN = BigInt('-9223372036854775808');
|
|
13
|
+
const bigIntValue = BigInt(`0x${hex}`);
|
|
14
|
+
if (bigIntValue < INT64_MIN || bigIntValue > INT64_MAX)
|
|
15
|
+
return INT64_MAX;
|
|
16
|
+
return bigIntValue;
|
|
17
|
+
};
|
|
18
|
+
exports.HexToInt64 = HexToInt64;
|
|
19
|
+
const HexToUInt8 = (hex) => Uint8Array.from([parseInt(hex, 16)])[0];
|
|
20
|
+
exports.HexToUInt8 = HexToUInt8;
|
|
21
|
+
const HexToUInt16 = (hex) => Uint16Array.from([parseInt(hex, 16)])[0];
|
|
22
|
+
exports.HexToUInt16 = HexToUInt16;
|
|
23
|
+
const HexToUInt32 = (hex) => Uint32Array.from([parseInt(hex, 16)])[0];
|
|
24
|
+
exports.HexToUInt32 = HexToUInt32;
|
|
25
|
+
const HexToUInt64 = (hex) => {
|
|
26
|
+
const INT64_MAX = BigInt('18446744073709551615');
|
|
27
|
+
const bigIntValue = BigInt(`0x${hex}`);
|
|
28
|
+
if (bigIntValue < 0n || bigIntValue > INT64_MAX)
|
|
29
|
+
return INT64_MAX;
|
|
30
|
+
return bigIntValue;
|
|
31
|
+
};
|
|
32
|
+
exports.HexToUInt64 = HexToUInt64;
|
|
33
|
+
const HexToFloat32 = (hex) => {
|
|
34
|
+
const buffer = new ArrayBuffer(4);
|
|
35
|
+
const dataView = new DataView(buffer);
|
|
36
|
+
dataView.setUint32(0, parseInt(hex, 16), false);
|
|
37
|
+
return dataView.getFloat32(0, false);
|
|
38
|
+
};
|
|
39
|
+
exports.HexToFloat32 = HexToFloat32;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert IPv4 string to Buffer
|
|
3
|
+
* @param ipv4
|
|
4
|
+
* @constructor
|
|
5
|
+
*/
|
|
6
|
+
export declare function IPv4ToBuffer(ipv4: string): Buffer;
|
|
7
|
+
/**
|
|
8
|
+
* Convert IPv6 string to Buffer
|
|
9
|
+
* @param ipv6
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
export declare function IPv6ToBuffer(ipv6: string): Buffer;
|
|
13
|
+
//# sourceMappingURL=IPToBuffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPToBuffer.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/IPToBuffer.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IPv4ToBuffer = IPv4ToBuffer;
|
|
4
|
+
exports.IPv6ToBuffer = IPv6ToBuffer;
|
|
5
|
+
const ip_address_1 = require("ip-address");
|
|
6
|
+
const NumberToBuffer_1 = require("./NumberToBuffer");
|
|
7
|
+
/**
|
|
8
|
+
* Convert IPv4 string to Buffer
|
|
9
|
+
* @param ipv4
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
function IPv4ToBuffer(ipv4) {
|
|
13
|
+
const numArr = ipv4.split('.').map((value) => parseInt(value)).map((value) => value ? value : 0);
|
|
14
|
+
return (0, NumberToBuffer_1.UInt32ToBuffer)(parseInt(Buffer.from(numArr).toString('hex'), 16));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Convert IPv6 string to Buffer
|
|
18
|
+
* @param ipv6
|
|
19
|
+
* @constructor
|
|
20
|
+
*/
|
|
21
|
+
function IPv6ToBuffer(ipv6) {
|
|
22
|
+
try {
|
|
23
|
+
return Buffer.from(new ip_address_1.Address6(ipv6).toByteArray());
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
return Buffer.alloc(16, 0);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Int8ToBERBuffer: (value: number) => Buffer;
|
|
2
|
+
export declare const Int16ToBERBuffer: (value: number) => Buffer;
|
|
3
|
+
export declare const Int32ToBERBuffer: (value: number) => Buffer;
|
|
4
|
+
export declare const Int64ToBERBuffer: (value: bigint) => Buffer;
|
|
5
|
+
export declare const UInt8ToBERBuffer: (value: number) => Buffer;
|
|
6
|
+
export declare const UInt16ToBERBuffer: (value: number) => Buffer;
|
|
7
|
+
export declare const UInt32ToBERBuffer: (value: number) => Buffer;
|
|
8
|
+
export declare const UInt64ToBERBuffer: (value: bigint) => Buffer;
|
|
9
|
+
//# sourceMappingURL=NumberToBERBuffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberToBERBuffer.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/NumberToBERBuffer.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA2E,CAAA;AAC5H,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA4E,CAAA;AAC9H,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA4E,CAAA;AAC9H,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA4E,CAAA;AAC9H,eAAO,MAAM,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA4E,CAAA;AAC9H,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA6E,CAAA;AAChI,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA6E,CAAA;AAChI,eAAO,MAAM,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA6E,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UInt64ToBERBuffer = exports.UInt32ToBERBuffer = exports.UInt16ToBERBuffer = exports.UInt8ToBERBuffer = exports.Int64ToBERBuffer = exports.Int32ToBERBuffer = exports.Int16ToBERBuffer = exports.Int8ToBERBuffer = void 0;
|
|
4
|
+
const NumberToBERHex_1 = require("./NumberToBERHex");
|
|
5
|
+
const Int8ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.Int8ToBERHex)(value), 'hex');
|
|
6
|
+
exports.Int8ToBERBuffer = Int8ToBERBuffer;
|
|
7
|
+
const Int16ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.Int16ToBERHex)(value), 'hex');
|
|
8
|
+
exports.Int16ToBERBuffer = Int16ToBERBuffer;
|
|
9
|
+
const Int32ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.Int32ToBERHex)(value), 'hex');
|
|
10
|
+
exports.Int32ToBERBuffer = Int32ToBERBuffer;
|
|
11
|
+
const Int64ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.Int64ToBERHex)(value), 'hex');
|
|
12
|
+
exports.Int64ToBERBuffer = Int64ToBERBuffer;
|
|
13
|
+
const UInt8ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.UInt8ToBERHex)(value), 'hex');
|
|
14
|
+
exports.UInt8ToBERBuffer = UInt8ToBERBuffer;
|
|
15
|
+
const UInt16ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.UInt16ToBERHex)(value), 'hex');
|
|
16
|
+
exports.UInt16ToBERBuffer = UInt16ToBERBuffer;
|
|
17
|
+
const UInt32ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.UInt32ToBERHex)(value), 'hex');
|
|
18
|
+
exports.UInt32ToBERBuffer = UInt32ToBERBuffer;
|
|
19
|
+
const UInt64ToBERBuffer = (value) => Buffer.from((0, NumberToBERHex_1.UInt64ToBERHex)(value), 'hex');
|
|
20
|
+
exports.UInt64ToBERBuffer = UInt64ToBERBuffer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Int8ToBERHex: (value: number) => string;
|
|
2
|
+
export declare const Int16ToBERHex: (value: number) => string;
|
|
3
|
+
export declare const Int32ToBERHex: (value: number) => string;
|
|
4
|
+
export declare const Int64ToBERHex: (value: bigint) => string;
|
|
5
|
+
export declare const UInt8ToBERHex: (value: number) => string;
|
|
6
|
+
export declare const UInt16ToBERHex: (value: number) => string;
|
|
7
|
+
export declare const UInt32ToBERHex: (value: number) => string;
|
|
8
|
+
export declare const UInt64ToBERHex: (value: bigint) => string;
|
|
9
|
+
//# sourceMappingURL=NumberToBERHex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberToBERHex.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/NumberToBERHex.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA4G,CAAA;AAC1J,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA8G,CAAA;AAC7J,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA8G,CAAA;AAC7J,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAwE,CAAA;AACvH,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAgE,CAAA;AAC/G,eAAO,MAAM,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAgE,CAAA;AAChH,eAAO,MAAM,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAgE,CAAA;AAChH,eAAO,MAAM,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAwE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UInt64ToBERHex = exports.UInt32ToBERHex = exports.UInt16ToBERHex = exports.UInt8ToBERHex = exports.Int64ToBERHex = exports.Int32ToBERHex = exports.Int16ToBERHex = exports.Int8ToBERHex = void 0;
|
|
4
|
+
function toBERHex(rawHex) {
|
|
5
|
+
const hex = rawHex.padStart(rawHex.length + rawHex.length % 2, '0');
|
|
6
|
+
return Buffer.from(hex, 'hex')[0].toString(2).padStart(8, '0').startsWith('1') ? `00${hex}` : hex;
|
|
7
|
+
}
|
|
8
|
+
const Int8ToBERHex = (value) => toBERHex(new Uint8Array(Int8Array.from([value]).buffer)[0].toString(16));
|
|
9
|
+
exports.Int8ToBERHex = Int8ToBERHex;
|
|
10
|
+
const Int16ToBERHex = (value) => toBERHex(new Uint16Array(Int16Array.from([value]).buffer)[0].toString(16));
|
|
11
|
+
exports.Int16ToBERHex = Int16ToBERHex;
|
|
12
|
+
const Int32ToBERHex = (value) => toBERHex(new Uint32Array(Int32Array.from([value]).buffer)[0].toString(16));
|
|
13
|
+
exports.Int32ToBERHex = Int32ToBERHex;
|
|
14
|
+
const Int64ToBERHex = (value) => toBERHex(BigInt(value).toString(16));
|
|
15
|
+
exports.Int64ToBERHex = Int64ToBERHex;
|
|
16
|
+
const UInt8ToBERHex = (value) => toBERHex(value.toString(16));
|
|
17
|
+
exports.UInt8ToBERHex = UInt8ToBERHex;
|
|
18
|
+
const UInt16ToBERHex = (value) => toBERHex(value.toString(16));
|
|
19
|
+
exports.UInt16ToBERHex = UInt16ToBERHex;
|
|
20
|
+
const UInt32ToBERHex = (value) => toBERHex(value.toString(16));
|
|
21
|
+
exports.UInt32ToBERHex = UInt32ToBERHex;
|
|
22
|
+
const UInt64ToBERHex = (value) => toBERHex(BigInt(value).toString(16));
|
|
23
|
+
exports.UInt64ToBERHex = UInt64ToBERHex;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const Int8ToBuffer: (value: number) => Buffer;
|
|
2
|
+
export declare const Int16ToBuffer: (value: number) => Buffer;
|
|
3
|
+
export declare const Int32ToBuffer: (value: number) => Buffer;
|
|
4
|
+
export declare const Int64ToBuffer: (value: bigint) => Buffer;
|
|
5
|
+
export declare const UInt8ToBuffer: (value: number) => Buffer;
|
|
6
|
+
export declare const UInt16ToBuffer: (value: number) => Buffer;
|
|
7
|
+
export declare const UInt32ToBuffer: (value: number) => Buffer;
|
|
8
|
+
export declare const UInt64ToBuffer: (value: bigint) => Buffer;
|
|
9
|
+
export declare const Float32ToBuffer: (value: number) => Buffer;
|
|
10
|
+
//# sourceMappingURL=NumberToBuffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberToBuffer.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/NumberToBuffer.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAwE,CAAA;AACtH,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyE,CAAA;AACxH,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyE,CAAA;AACxH,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyE,CAAA;AACxH,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyE,CAAA;AACxH,eAAO,MAAM,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA0E,CAAA;AAC1H,eAAO,MAAM,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA0E,CAAA;AAC1H,eAAO,MAAM,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA0E,CAAA;AAC1H,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAA2E,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Float32ToBuffer = exports.UInt64ToBuffer = exports.UInt32ToBuffer = exports.UInt16ToBuffer = exports.UInt8ToBuffer = exports.Int64ToBuffer = exports.Int32ToBuffer = exports.Int16ToBuffer = exports.Int8ToBuffer = void 0;
|
|
4
|
+
const NumberToHex_1 = require("./NumberToHex");
|
|
5
|
+
const Int8ToBuffer = (value) => Buffer.from((0, NumberToHex_1.Int8ToHex)(value), 'hex');
|
|
6
|
+
exports.Int8ToBuffer = Int8ToBuffer;
|
|
7
|
+
const Int16ToBuffer = (value) => Buffer.from((0, NumberToHex_1.Int16ToHex)(value), 'hex');
|
|
8
|
+
exports.Int16ToBuffer = Int16ToBuffer;
|
|
9
|
+
const Int32ToBuffer = (value) => Buffer.from((0, NumberToHex_1.Int32ToHex)(value), 'hex');
|
|
10
|
+
exports.Int32ToBuffer = Int32ToBuffer;
|
|
11
|
+
const Int64ToBuffer = (value) => Buffer.from((0, NumberToHex_1.Int64ToHex)(value), 'hex');
|
|
12
|
+
exports.Int64ToBuffer = Int64ToBuffer;
|
|
13
|
+
const UInt8ToBuffer = (value) => Buffer.from((0, NumberToHex_1.UInt8ToHex)(value), 'hex');
|
|
14
|
+
exports.UInt8ToBuffer = UInt8ToBuffer;
|
|
15
|
+
const UInt16ToBuffer = (value) => Buffer.from((0, NumberToHex_1.UInt16ToHex)(value), 'hex');
|
|
16
|
+
exports.UInt16ToBuffer = UInt16ToBuffer;
|
|
17
|
+
const UInt32ToBuffer = (value) => Buffer.from((0, NumberToHex_1.UInt32ToHex)(value), 'hex');
|
|
18
|
+
exports.UInt32ToBuffer = UInt32ToBuffer;
|
|
19
|
+
const UInt64ToBuffer = (value) => Buffer.from((0, NumberToHex_1.UInt64ToHex)(value), 'hex');
|
|
20
|
+
exports.UInt64ToBuffer = UInt64ToBuffer;
|
|
21
|
+
const Float32ToBuffer = (value) => Buffer.from((0, NumberToHex_1.Float32ToHex)(value), 'hex');
|
|
22
|
+
exports.Float32ToBuffer = Float32ToBuffer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const Int8ToHex: (value: number) => string;
|
|
2
|
+
export declare const Int16ToHex: (value: number) => string;
|
|
3
|
+
export declare const Int32ToHex: (value: number) => string;
|
|
4
|
+
export declare const Int64ToHex: (value: bigint) => string;
|
|
5
|
+
export declare const UInt8ToHex: (value: number) => string;
|
|
6
|
+
export declare const UInt16ToHex: (value: number) => string;
|
|
7
|
+
export declare const UInt32ToHex: (value: number) => string;
|
|
8
|
+
export declare const UInt64ToHex: (value: bigint) => string;
|
|
9
|
+
export declare const Float32ToHex: (value: number) => string;
|
|
10
|
+
//# sourceMappingURL=NumberToHex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberToHex.d.ts","sourceRoot":"","sources":["../../../src/lib/helper/NumberToHex.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAmH,CAAA;AAC9J,eAAO,MAAM,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAqH,CAAA;AACjK,eAAO,MAAM,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAqH,CAAA;AACjK,eAAO,MAAM,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAgF,CAAA;AAC5H,eAAO,MAAM,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAuE,CAAA;AACnH,eAAO,MAAM,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAuE,CAAA;AACpH,eAAO,MAAM,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAuE,CAAA;AACpH,eAAO,MAAM,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAgF,CAAA;AAE7H,eAAO,MAAM,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAK7C,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Float32ToHex = exports.UInt64ToHex = exports.UInt32ToHex = exports.UInt16ToHex = exports.UInt8ToHex = exports.Int64ToHex = exports.Int32ToHex = exports.Int16ToHex = exports.Int8ToHex = void 0;
|
|
4
|
+
const Int8ToHex = (value) => new Uint8Array(Int8Array.from([value]).buffer)[0].toString(16).padStart(2, '0');
|
|
5
|
+
exports.Int8ToHex = Int8ToHex;
|
|
6
|
+
const Int16ToHex = (value) => new Uint16Array(Int16Array.from([value]).buffer)[0].toString(16).padStart(4, '0');
|
|
7
|
+
exports.Int16ToHex = Int16ToHex;
|
|
8
|
+
const Int32ToHex = (value) => new Uint32Array(Int32Array.from([value]).buffer)[0].toString(16).padStart(8, '0');
|
|
9
|
+
exports.Int32ToHex = Int32ToHex;
|
|
10
|
+
const Int64ToHex = (value) => BigInt(value).toString(16).padStart(16, '0');
|
|
11
|
+
exports.Int64ToHex = Int64ToHex;
|
|
12
|
+
const UInt8ToHex = (value) => value.toString(16).padStart(2, '0');
|
|
13
|
+
exports.UInt8ToHex = UInt8ToHex;
|
|
14
|
+
const UInt16ToHex = (value) => value.toString(16).padStart(4, '0');
|
|
15
|
+
exports.UInt16ToHex = UInt16ToHex;
|
|
16
|
+
const UInt32ToHex = (value) => value.toString(16).padStart(8, '0');
|
|
17
|
+
exports.UInt32ToHex = UInt32ToHex;
|
|
18
|
+
const UInt64ToHex = (value) => BigInt(value).toString(16).padStart(16, '0');
|
|
19
|
+
exports.UInt64ToHex = UInt64ToHex;
|
|
20
|
+
const Float32ToHex = (value) => {
|
|
21
|
+
const buffer = new ArrayBuffer(4);
|
|
22
|
+
const dataView = new DataView(buffer);
|
|
23
|
+
dataView.setFloat32(0, value, false);
|
|
24
|
+
return dataView.getUint32(0, false).toString(16).padStart(8, '0');
|
|
25
|
+
};
|
|
26
|
+
exports.Float32ToHex = Float32ToHex;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ICaptureOptions } from './interfaces/ICaptureOptions';
|
|
2
|
+
import { PipeClientSocket } from '../pipe/PipeClientSocket';
|
|
3
|
+
import EventEmitter from 'events';
|
|
4
|
+
import { IPcapPacketInfo } from '../pcap/interfaces/IPcapPacketInfo';
|
|
5
|
+
export declare class Capture extends EventEmitter {
|
|
6
|
+
#private;
|
|
7
|
+
get filter(): string;
|
|
8
|
+
get temporaryFilename(): string;
|
|
9
|
+
get count(): number;
|
|
10
|
+
/**
|
|
11
|
+
* Constructor
|
|
12
|
+
* @param options
|
|
13
|
+
*/
|
|
14
|
+
constructor(options: ICaptureOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Create and initialize capture worker
|
|
17
|
+
* @protected
|
|
18
|
+
*/
|
|
19
|
+
protected createCaptureWorker(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Destroy capture worker
|
|
22
|
+
* @protected
|
|
23
|
+
*/
|
|
24
|
+
protected destroyCaptureWorker(): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Get worker socket
|
|
27
|
+
* @protected
|
|
28
|
+
*/
|
|
29
|
+
protected getWorkerSocket(): Promise<PipeClientSocket>;
|
|
30
|
+
/**
|
|
31
|
+
* Clean resources before start capture
|
|
32
|
+
* @protected
|
|
33
|
+
*/
|
|
34
|
+
protected cleanResources(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Wait other operation done
|
|
37
|
+
* @protected
|
|
38
|
+
*/
|
|
39
|
+
protected waitOperationDone(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Start capture packets
|
|
42
|
+
*/
|
|
43
|
+
start(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Stop capture packets
|
|
46
|
+
*/
|
|
47
|
+
stop(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Pause capture packets
|
|
50
|
+
*/
|
|
51
|
+
pause(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Resume capture packets
|
|
54
|
+
*/
|
|
55
|
+
resume(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Set capture filter
|
|
58
|
+
* @param filter
|
|
59
|
+
*/
|
|
60
|
+
setFilter(filter: string): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Save captured pcap to destination
|
|
63
|
+
* @param destination
|
|
64
|
+
*/
|
|
65
|
+
saveTo(destination: string): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Dispose capture
|
|
68
|
+
*/
|
|
69
|
+
dispose(): Promise<void>;
|
|
70
|
+
on(eventName: 'packet', listener: (pcapPacketInfo: IPcapPacketInfo) => void): this;
|
|
71
|
+
on(eventName: 'rawPacket', listener: (index: number, packet: string, seconds: number, microseconds: number) => void): this;
|
|
72
|
+
once(eventName: 'packet', listener: (pcapPacketInfo: IPcapPacketInfo) => void): this;
|
|
73
|
+
once(eventName: 'rawPacket', listener: (index: number, packet: string, seconds: number, microseconds: number) => void): this;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=Capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Capture.d.ts","sourceRoot":"","sources":["../../../src/lib/nodepcap/Capture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAA;AAS5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAA;AAGzD,OAAO,YAAY,MAAM,QAAQ,CAAA;AAGjC,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAA;AAElE,qBAAa,OAAQ,SAAQ,YAAY;;IAgCrC,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,iBAAiB,IAAI,MAAM,CAErC;IAED,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED;;;OAGG;gBACS,OAAO,EAAE,eAAe;IAcpC;;;OAGG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAsBrC;;;OAGG;cACa,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BrD;;;OAGG;cACa,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAa5D;;;OAGG;cACa,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/C;;;OAGG;cACa,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlD;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBnC;;OAEG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAalC;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAanC;;OAEG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAYpC;;;OAGG;IACU,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrD;;;OAGG;IACU,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD;;OAEG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,eAAe,KAAK,IAAI,GAAG,IAAI;IAClF,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAM1H,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,cAAc,EAAE,eAAe,KAAK,IAAI,GAAG,IAAI;IACpF,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;CAKtI"}
|