netkitty 0.0.15 → 0.0.16

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.
@@ -3,7 +3,7 @@
3
3
  <option name="myName" value="Project Default" />
4
4
  <inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
5
5
  <Languages>
6
- <language minSize="114" name="TypeScript" />
6
+ <language minSize="249" name="TypeScript" />
7
7
  </Languages>
8
8
  </inspection_tool>
9
9
  </profile>
@@ -1,3 +1,15 @@
1
+ export { BufferToHex } from './lib/codec/lib/BufferToHex';
2
+ export { BufferToIPv4, BufferToIPv6 } from './lib/codec/lib/BufferToIP';
3
+ export { BufferToFloat32, BufferToInt16, BufferToInt32, BufferToInt64, BufferToInt8, BufferToUInt16, BufferToUInt32, BufferToUInt64, BufferToUInt8 } from './lib/codec/lib/BufferToNumber';
4
+ export { FixHexString } from './lib/codec/lib/FixHexString';
5
+ export { FlexibleObject } from './lib/codec/lib/FlexibleObject';
6
+ export { HexToFloat32, HexToInt16, HexToInt32, HexToInt64, HexToInt8, HexToUInt16, HexToUInt32, HexToUInt64, HexToUInt8 } from './lib/codec/lib/HexToNumber';
7
+ export { IPv4ToBuffer, IPv6ToBuffer } from './lib/codec/lib/IPToBuffer';
8
+ export { Int16ToBERBuffer, Int32ToBERBuffer, Int64ToBERBuffer, Int8ToBERBuffer, UInt16ToBERBuffer, UInt32ToBERBuffer, UInt64ToBERBuffer, UInt8ToBERBuffer } from './lib/codec/lib/NumberToBERBuffer';
9
+ export { Int16ToBERHex, Int32ToBERHex, Int64ToBERHex, Int8ToBERHex, UInt16ToBERHex, UInt32ToBERHex, UInt64ToBERHex, UInt8ToBERHex } from './lib/codec/lib/NumberToBERHex';
10
+ export { Float32ToBuffer, Int16ToBuffer, Int32ToBuffer, Int64ToBuffer, Int8ToBuffer, UInt16ToBuffer, UInt32ToBuffer, UInt64ToBuffer, UInt8ToBuffer } from './lib/codec/lib/NumberToBuffer';
11
+ export { Float32ToHex, Int16ToHex, Int32ToHex, Int64ToHex, Int8ToHex, UInt16ToHex, UInt32ToHex, UInt64ToHex, UInt8ToHex } from './lib/codec/lib/NumberToHex';
12
+ export { StringContentEncodingEnum } from './lib/codec/lib/StringContentEncodingEnum';
1
13
  export { type INetworkInterface } from './lib/nodepcap/interfaces/INetworkInterface';
2
14
  export { type CodecEncodeResult } from './lib/codec/types/CodecEncodeResult';
3
15
  export { type CodecEncodeInput } from './lib/codec/types/CodecEncodeInput';
@@ -1 +1 @@
1
- {"version":3,"file":"NetKitty.d.ts","sourceRoot":"","sources":["../src/NetKitty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,6CAA6C,CAAA;AAClF,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAC,KAAK,gBAAgB,EAAC,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAC,KAAK,cAAc,EAAC,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,uCAAuC,CAAA;AAC1E;;GAEG;AACH,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAA;AAChD;;GAEG;AACH,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAA;AAChD;;GAEG;AACH,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAA;AAChD;;GAEG;AACH,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AACxE;;GAEG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAA;AAC9C;;GAEG;AACH,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"NetK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nF,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,6CAA6C,CAAA;AAClF,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAC,KAAK,gBAAgB,EAAC,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAC,KAAK,iBAAiB,EAAC,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAC,KAAK,cAAc,EAAC,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,uCAAuC,CAAA;AAC1E;;GAEG;AACH,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAA;AAChD;;GAEG;AACH,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAA;AAChD;;GAEG;AACH,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAA;AAChD;;GAEG;AACH,OAAO,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AACxE;;GAEG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAA;AAC9C;;GAEG;AACH,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAA"}
package/dist/NetKitty.js CHANGED
@@ -1,6 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Headers = exports.Codec = exports.Capture = exports.GetNetworkInterfaces = exports.PcapParser = exports.PcapWriter = exports.PcapReader = void 0;
3
+ exports.UInt8ToBuffer = exports.UInt64ToBuffer = exports.UInt32ToBuffer = exports.UInt16ToBuffer = exports.Int8ToBuffer = exports.Int64ToBuffer = exports.Int32ToBuffer = exports.Int16ToBuffer = exports.Float32ToBuffer = exports.UInt8ToBERHex = exports.UInt64ToBERHex = exports.UInt32ToBERHex = exports.UInt16ToBERHex = exports.Int8ToBERHex = exports.Int64ToBERHex = exports.Int32ToBERHex = exports.Int16ToBERHex = exports.UInt8ToBERBuffer = exports.UInt64ToBERBuffer = exports.UInt32ToBERBuffer = exports.UInt16ToBERBuffer = exports.Int8ToBERBuffer = exports.Int64ToBERBuffer = exports.Int32ToBERBuffer = exports.Int16ToBERBuffer = exports.IPv6ToBuffer = exports.IPv4ToBuffer = exports.HexToUInt8 = exports.HexToUInt64 = exports.HexToUInt32 = exports.HexToUInt16 = exports.HexToInt8 = exports.HexToInt64 = exports.HexToInt32 = exports.HexToInt16 = exports.HexToFloat32 = exports.FlexibleObject = exports.FixHexString = exports.BufferToUInt8 = exports.BufferToUInt64 = exports.BufferToUInt32 = exports.BufferToUInt16 = exports.BufferToInt8 = exports.BufferToInt64 = exports.BufferToInt32 = exports.BufferToInt16 = exports.BufferToFloat32 = exports.BufferToIPv6 = exports.BufferToIPv4 = exports.BufferToHex = void 0;
4
+ exports.Headers = exports.Codec = exports.Capture = exports.GetNetworkInterfaces = exports.PcapParser = exports.PcapWriter = exports.PcapReader = exports.StringContentEncodingEnum = exports.UInt8ToHex = exports.UInt64ToHex = exports.UInt32ToHex = exports.UInt16ToHex = exports.Int8ToHex = exports.Int64ToHex = exports.Int32ToHex = exports.Int16ToHex = exports.Float32ToHex = void 0;
5
+ var BufferToHex_1 = require("./lib/codec/lib/BufferToHex");
6
+ Object.defineProperty(exports, "BufferToHex", { enumerable: true, get: function () { return BufferToHex_1.BufferToHex; } });
7
+ var BufferToIP_1 = require("./lib/codec/lib/BufferToIP");
8
+ Object.defineProperty(exports, "BufferToIPv4", { enumerable: true, get: function () { return BufferToIP_1.BufferToIPv4; } });
9
+ Object.defineProperty(exports, "BufferToIPv6", { enumerable: true, get: function () { return BufferToIP_1.BufferToIPv6; } });
10
+ var BufferToNumber_1 = require("./lib/codec/lib/BufferToNumber");
11
+ Object.defineProperty(exports, "BufferToFloat32", { enumerable: true, get: function () { return BufferToNumber_1.BufferToFloat32; } });
12
+ Object.defineProperty(exports, "BufferToInt16", { enumerable: true, get: function () { return BufferToNumber_1.BufferToInt16; } });
13
+ Object.defineProperty(exports, "BufferToInt32", { enumerable: true, get: function () { return BufferToNumber_1.BufferToInt32; } });
14
+ Object.defineProperty(exports, "BufferToInt64", { enumerable: true, get: function () { return BufferToNumber_1.BufferToInt64; } });
15
+ Object.defineProperty(exports, "BufferToInt8", { enumerable: true, get: function () { return BufferToNumber_1.BufferToInt8; } });
16
+ Object.defineProperty(exports, "BufferToUInt16", { enumerable: true, get: function () { return BufferToNumber_1.BufferToUInt16; } });
17
+ Object.defineProperty(exports, "BufferToUInt32", { enumerable: true, get: function () { return BufferToNumber_1.BufferToUInt32; } });
18
+ Object.defineProperty(exports, "BufferToUInt64", { enumerable: true, get: function () { return BufferToNumber_1.BufferToUInt64; } });
19
+ Object.defineProperty(exports, "BufferToUInt8", { enumerable: true, get: function () { return BufferToNumber_1.BufferToUInt8; } });
20
+ var FixHexString_1 = require("./lib/codec/lib/FixHexString");
21
+ Object.defineProperty(exports, "FixHexString", { enumerable: true, get: function () { return FixHexString_1.FixHexString; } });
22
+ var FlexibleObject_1 = require("./lib/codec/lib/FlexibleObject");
23
+ Object.defineProperty(exports, "FlexibleObject", { enumerable: true, get: function () { return FlexibleObject_1.FlexibleObject; } });
24
+ var HexToNumber_1 = require("./lib/codec/lib/HexToNumber");
25
+ Object.defineProperty(exports, "HexToFloat32", { enumerable: true, get: function () { return HexToNumber_1.HexToFloat32; } });
26
+ Object.defineProperty(exports, "HexToInt16", { enumerable: true, get: function () { return HexToNumber_1.HexToInt16; } });
27
+ Object.defineProperty(exports, "HexToInt32", { enumerable: true, get: function () { return HexToNumber_1.HexToInt32; } });
28
+ Object.defineProperty(exports, "HexToInt64", { enumerable: true, get: function () { return HexToNumber_1.HexToInt64; } });
29
+ Object.defineProperty(exports, "HexToInt8", { enumerable: true, get: function () { return HexToNumber_1.HexToInt8; } });
30
+ Object.defineProperty(exports, "HexToUInt16", { enumerable: true, get: function () { return HexToNumber_1.HexToUInt16; } });
31
+ Object.defineProperty(exports, "HexToUInt32", { enumerable: true, get: function () { return HexToNumber_1.HexToUInt32; } });
32
+ Object.defineProperty(exports, "HexToUInt64", { enumerable: true, get: function () { return HexToNumber_1.HexToUInt64; } });
33
+ Object.defineProperty(exports, "HexToUInt8", { enumerable: true, get: function () { return HexToNumber_1.HexToUInt8; } });
34
+ var IPToBuffer_1 = require("./lib/codec/lib/IPToBuffer");
35
+ Object.defineProperty(exports, "IPv4ToBuffer", { enumerable: true, get: function () { return IPToBuffer_1.IPv4ToBuffer; } });
36
+ Object.defineProperty(exports, "IPv6ToBuffer", { enumerable: true, get: function () { return IPToBuffer_1.IPv6ToBuffer; } });
37
+ var NumberToBERBuffer_1 = require("./lib/codec/lib/NumberToBERBuffer");
38
+ Object.defineProperty(exports, "Int16ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.Int16ToBERBuffer; } });
39
+ Object.defineProperty(exports, "Int32ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.Int32ToBERBuffer; } });
40
+ Object.defineProperty(exports, "Int64ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.Int64ToBERBuffer; } });
41
+ Object.defineProperty(exports, "Int8ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.Int8ToBERBuffer; } });
42
+ Object.defineProperty(exports, "UInt16ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.UInt16ToBERBuffer; } });
43
+ Object.defineProperty(exports, "UInt32ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.UInt32ToBERBuffer; } });
44
+ Object.defineProperty(exports, "UInt64ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.UInt64ToBERBuffer; } });
45
+ Object.defineProperty(exports, "UInt8ToBERBuffer", { enumerable: true, get: function () { return NumberToBERBuffer_1.UInt8ToBERBuffer; } });
46
+ var NumberToBERHex_1 = require("./lib/codec/lib/NumberToBERHex");
47
+ Object.defineProperty(exports, "Int16ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.Int16ToBERHex; } });
48
+ Object.defineProperty(exports, "Int32ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.Int32ToBERHex; } });
49
+ Object.defineProperty(exports, "Int64ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.Int64ToBERHex; } });
50
+ Object.defineProperty(exports, "Int8ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.Int8ToBERHex; } });
51
+ Object.defineProperty(exports, "UInt16ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.UInt16ToBERHex; } });
52
+ Object.defineProperty(exports, "UInt32ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.UInt32ToBERHex; } });
53
+ Object.defineProperty(exports, "UInt64ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.UInt64ToBERHex; } });
54
+ Object.defineProperty(exports, "UInt8ToBERHex", { enumerable: true, get: function () { return NumberToBERHex_1.UInt8ToBERHex; } });
55
+ var NumberToBuffer_1 = require("./lib/codec/lib/NumberToBuffer");
56
+ Object.defineProperty(exports, "Float32ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.Float32ToBuffer; } });
57
+ Object.defineProperty(exports, "Int16ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.Int16ToBuffer; } });
58
+ Object.defineProperty(exports, "Int32ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.Int32ToBuffer; } });
59
+ Object.defineProperty(exports, "Int64ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.Int64ToBuffer; } });
60
+ Object.defineProperty(exports, "Int8ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.Int8ToBuffer; } });
61
+ Object.defineProperty(exports, "UInt16ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.UInt16ToBuffer; } });
62
+ Object.defineProperty(exports, "UInt32ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.UInt32ToBuffer; } });
63
+ Object.defineProperty(exports, "UInt64ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.UInt64ToBuffer; } });
64
+ Object.defineProperty(exports, "UInt8ToBuffer", { enumerable: true, get: function () { return NumberToBuffer_1.UInt8ToBuffer; } });
65
+ var NumberToHex_1 = require("./lib/codec/lib/NumberToHex");
66
+ Object.defineProperty(exports, "Float32ToHex", { enumerable: true, get: function () { return NumberToHex_1.Float32ToHex; } });
67
+ Object.defineProperty(exports, "Int16ToHex", { enumerable: true, get: function () { return NumberToHex_1.Int16ToHex; } });
68
+ Object.defineProperty(exports, "Int32ToHex", { enumerable: true, get: function () { return NumberToHex_1.Int32ToHex; } });
69
+ Object.defineProperty(exports, "Int64ToHex", { enumerable: true, get: function () { return NumberToHex_1.Int64ToHex; } });
70
+ Object.defineProperty(exports, "Int8ToHex", { enumerable: true, get: function () { return NumberToHex_1.Int8ToHex; } });
71
+ Object.defineProperty(exports, "UInt16ToHex", { enumerable: true, get: function () { return NumberToHex_1.UInt16ToHex; } });
72
+ Object.defineProperty(exports, "UInt32ToHex", { enumerable: true, get: function () { return NumberToHex_1.UInt32ToHex; } });
73
+ Object.defineProperty(exports, "UInt64ToHex", { enumerable: true, get: function () { return NumberToHex_1.UInt64ToHex; } });
74
+ Object.defineProperty(exports, "UInt8ToHex", { enumerable: true, get: function () { return NumberToHex_1.UInt8ToHex; } });
75
+ var StringContentEncodingEnum_1 = require("./lib/codec/lib/StringContentEncodingEnum");
76
+ Object.defineProperty(exports, "StringContentEncodingEnum", { enumerable: true, get: function () { return StringContentEncodingEnum_1.StringContentEncodingEnum; } });
4
77
  /**
5
78
  * PCAP reader
6
79
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Codec.d.ts","sourceRoot":"","sources":["../../../src/lib/codec/Codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAA;AAErE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAC,gBAAgB,EAAC,M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AI,WAAW,EAAE;IAQ3C;;;OAGG;IACH,SAAS,CAAC,gBAAgB,IAAI,sBAAsB,EAAE;IAoDtD;;;OAGG;IACU,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAwBjE;;;OAGG;IACU,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAc9E"}
@@ -13,12 +13,20 @@ const RawData_1 = require("./headers/RawData");
13
13
  const TCP_1 = require("./headers/TCP");
14
14
  const UDP_1 = require("./headers/UDP");
15
15
  const VLAN_802dot1Q_1 = require("./headers/VLAN_802dot1Q");
16
+ const IPv6_1 = require("./headers/IPv6");
17
+ const IPv6HopByHopOptions_1 = require("./headers/IPv6HopByHopOptions");
18
+ const ICMPv6_1 = require("./headers/ICMPv6");
19
+ const ICMP_1 = require("./headers/ICMP");
16
20
  exports.Headers = [
17
21
  ARP_1.ARP,
18
22
  EthernetII_1.EthernetII,
19
23
  Goose_1.Goose,
20
24
  IEC61850SampledValues_1.IEC61850SampledValues,
25
+ ICMP_1.ICMP,
21
26
  IPv4_1.IPv4,
27
+ IPv6_1.IPv6,
28
+ IPv6HopByHopOptions_1.IPv6HopByHopOptions,
29
+ ICMPv6_1.ICMPv6,
22
30
  RawData_1.RawData,
23
31
  TCP_1.TCP,
24
32
  UDP_1.UDP,
@@ -0,0 +1,15 @@
1
+ import { ProtocolJSONSchema } from '../../schema/ProtocolJSONSchema';
2
+ import { BaseHeader } from '../abstracts/BaseHeader';
3
+ export declare class ICMP extends BaseHeader {
4
+ /**
5
+ * Calculate ICMPv4 checksum
6
+ * @protected
7
+ */
8
+ protected calculateIcmpChecksum(): number;
9
+ SCHEMA: ProtocolJSONSchema;
10
+ id: string;
11
+ name: string;
12
+ nickname: string;
13
+ match(): boolean;
14
+ }
15
+ //# sourceMappingURL=ICMP.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICMP.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/headers/ICMP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAMlD,qBAAa,IAAK,SAAQ,UAAU;IAEhC;;;OAGG;IACH,SAAS,CAAC,qBAAqB,IAAI,MAAM;IA+BlC,MAAM,EAAE,kBAAkB,CA6FhC;IAEM,EAAE,EAAE,MAAM,CAAS;IAEnB,IAAI,EAAE,MAAM,CAAsC;IAElD,QAAQ,EAAE,MAAM,CAAS;IAEzB,KAAK,IAAI,OAAO;CAK1B"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICMP = void 0;
4
+ const BaseHeader_1 = require("../abstracts/BaseHeader");
5
+ const BufferToNumber_1 = require("../lib/BufferToNumber");
6
+ const NumberToBuffer_1 = require("../lib/NumberToBuffer");
7
+ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
8
+ const BufferToHex_1 = require("../lib/BufferToHex");
9
+ class ICMP extends BaseHeader_1.BaseHeader {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.SCHEMA = {
13
+ type: 'object',
14
+ properties: {
15
+ type: {
16
+ type: 'integer',
17
+ label: 'Type',
18
+ minimum: 0,
19
+ maximum: 255,
20
+ decode: () => {
21
+ this.instance.type.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(0, 1)));
22
+ },
23
+ encode: () => {
24
+ const type = this.instance.type.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
25
+ this.instance.type.setValue(type);
26
+ this.writeBytes(0, (0, NumberToBuffer_1.UInt8ToBuffer)(type));
27
+ }
28
+ },
29
+ code: {
30
+ type: 'integer',
31
+ label: 'Code',
32
+ minimum: 0,
33
+ maximum: 255,
34
+ decode: () => {
35
+ this.instance.code.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(1, 1)));
36
+ },
37
+ encode: () => {
38
+ const code = this.instance.code.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
39
+ this.instance.code.setValue(code);
40
+ this.writeBytes(1, (0, NumberToBuffer_1.UInt8ToBuffer)(code));
41
+ }
42
+ },
43
+ checksum: {
44
+ type: 'integer',
45
+ label: 'Checksum',
46
+ minimum: 0,
47
+ maximum: 65535,
48
+ decode: () => {
49
+ this.instance.checksum.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(2, 2)));
50
+ },
51
+ encode: () => {
52
+ let checksum = this.instance.checksum.getValue(0);
53
+ this.instance.checksum.setValue(checksum);
54
+ this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
55
+ if (!checksum) {
56
+ checksum = this.calculateIcmpChecksum();
57
+ this.instance.checksum.setValue(checksum);
58
+ this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
59
+ }
60
+ }
61
+ },
62
+ ident: {
63
+ type: 'number',
64
+ label: 'Identifier (BE)',
65
+ minimum: 0,
66
+ maximum: 65535,
67
+ decode: () => {
68
+ this.instance.ident.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(4, 2)));
69
+ },
70
+ encode: () => {
71
+ const ident = this.instance.ident.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
72
+ this.instance.ident.setValue(ident);
73
+ this.writeBytes(4, (0, NumberToBuffer_1.UInt16ToBuffer)(ident));
74
+ }
75
+ },
76
+ seq: {
77
+ type: 'number',
78
+ label: 'Sequence Number (BE)',
79
+ minimum: 0,
80
+ maximum: 65535,
81
+ decode: () => {
82
+ this.instance.seq.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(6, 2)));
83
+ },
84
+ encode: () => {
85
+ const seq = this.instance.seq.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
86
+ this.instance.seq.setValue(seq);
87
+ this.writeBytes(6, (0, NumberToBuffer_1.UInt16ToBuffer)(seq));
88
+ }
89
+ },
90
+ message: {
91
+ type: 'string',
92
+ label: 'Message Body',
93
+ contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
94
+ decode: () => {
95
+ const messageDataLength = this.packet.length - this.startPos - 8;
96
+ this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(8, messageDataLength)));
97
+ },
98
+ encode: () => {
99
+ const messageHex = this.instance.message.getValue('');
100
+ this.instance.message.setValue(messageHex);
101
+ this.writeBytes(8, Buffer.from(messageHex, 'hex'));
102
+ }
103
+ }
104
+ }
105
+ };
106
+ this.id = 'icmp';
107
+ this.name = 'Internet Control Message Protocol';
108
+ this.nickname = 'ICMP';
109
+ }
110
+ /**
111
+ * Calculate ICMPv4 checksum
112
+ * @protected
113
+ */
114
+ calculateIcmpChecksum() {
115
+ const icmpHeader = Buffer.concat([
116
+ (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.type.getValue(0)),
117
+ (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.code.getValue(0)),
118
+ (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.checksum.getValue(0)),
119
+ (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.ident.getValue(0)),
120
+ (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.seq.getValue(0)),
121
+ Buffer.from(this.instance.message.getValue(''), 'hex')
122
+ ]);
123
+ const paddedBuffer = icmpHeader.length % 2 === 1 ?
124
+ Buffer.concat([
125
+ icmpHeader,
126
+ (0, NumberToBuffer_1.UInt8ToBuffer)(0)
127
+ ]) : icmpHeader;
128
+ // 4. 计算 checksum
129
+ let checksum = 0;
130
+ for (let i = 0; i < paddedBuffer.length; i += 2) {
131
+ const word = (paddedBuffer[i] << 8) | (paddedBuffer[i + 1] || 0);
132
+ checksum += word;
133
+ // 处理溢出
134
+ if (checksum > 0xFFFF) {
135
+ checksum = (checksum & 0xFFFF) + 1;
136
+ }
137
+ }
138
+ // 取反得到最终 checksum
139
+ return (~checksum) & 0xFFFF;
140
+ }
141
+ match() {
142
+ if (!this.prevCodecModule)
143
+ return false;
144
+ return this.prevCodecModule.instance.protocol.getValue() === 0x01;
145
+ }
146
+ }
147
+ exports.ICMP = ICMP;
@@ -0,0 +1,15 @@
1
+ import { ProtocolJSONSchema } from '../../schema/ProtocolJSONSchema';
2
+ import { BaseHeader } from '../abstracts/BaseHeader';
3
+ export declare class ICMPv6 extends BaseHeader {
4
+ /**
5
+ * Calculate ICMPv6 checksum
6
+ * @protected
7
+ */
8
+ protected calculateIcmpv6Checksum(): number;
9
+ SCHEMA: ProtocolJSONSchema;
10
+ id: string;
11
+ name: string;
12
+ nickname: string;
13
+ match(): boolean;
14
+ }
15
+ //# sourceMappingURL=ICMPv6.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICMPv6.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/headers/ICMPv6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAQlD,qBAAa,MAAO,SAAQ,UAAU;IAElC;;;OAGG;IACH,SAAS,CAAC,uBAAuB,IAAI,MAAM;IAmCpC,MAAM,EAAE,kBAAkB,CAiEhC;IAEM,EAAE,EAAE,MAAM,CAAW;IAErB,IAAI,EAAE,MAAM,CAAyC;IAErD,QAAQ,EAAE,MAAM,CAAW;IAE3B,KAAK,IAAI,OAAO;CAI1B"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ICMPv6 = void 0;
4
+ const BaseHeader_1 = require("../abstracts/BaseHeader");
5
+ const StringContentEncodingEnum_1 = require("../lib/StringContentEncodingEnum");
6
+ const BufferToNumber_1 = require("../lib/BufferToNumber");
7
+ const NumberToBuffer_1 = require("../lib/NumberToBuffer");
8
+ const BufferToHex_1 = require("../lib/BufferToHex");
9
+ const IPToBuffer_1 = require("../lib/IPToBuffer");
10
+ class ICMPv6 extends BaseHeader_1.BaseHeader {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.SCHEMA = {
14
+ type: 'object',
15
+ properties: {
16
+ type: {
17
+ type: 'integer',
18
+ label: 'Type',
19
+ minimum: 0,
20
+ maximum: 255,
21
+ decode: () => {
22
+ this.instance.type.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(0, 1)));
23
+ },
24
+ encode: () => {
25
+ const type = this.instance.type.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
26
+ this.instance.type.setValue(type);
27
+ this.writeBytes(0, (0, NumberToBuffer_1.UInt8ToBuffer)(type));
28
+ }
29
+ },
30
+ code: {
31
+ type: 'integer',
32
+ label: 'Code',
33
+ minimum: 0,
34
+ maximum: 255,
35
+ decode: () => {
36
+ this.instance.code.setValue((0, BufferToNumber_1.BufferToUInt8)(this.readBytes(1, 1)));
37
+ },
38
+ encode: () => {
39
+ const code = this.instance.code.getValue(0, (nodePath) => this.recordError(nodePath, 'Not Found'));
40
+ this.instance.code.setValue(code);
41
+ this.writeBytes(1, (0, NumberToBuffer_1.UInt8ToBuffer)(code));
42
+ }
43
+ },
44
+ checksum: {
45
+ type: 'integer',
46
+ label: 'Checksum',
47
+ minimum: 0,
48
+ maximum: 65535,
49
+ decode: () => {
50
+ this.instance.checksum.setValue((0, BufferToNumber_1.BufferToUInt16)(this.readBytes(2, 2)));
51
+ },
52
+ encode: () => {
53
+ let checksum = this.instance.checksum.getValue(0);
54
+ this.instance.checksum.setValue(checksum);
55
+ this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
56
+ if (!checksum) {
57
+ checksum = this.calculateIcmpv6Checksum();
58
+ this.instance.checksum.setValue(checksum);
59
+ this.writeBytes(2, (0, NumberToBuffer_1.UInt16ToBuffer)(checksum));
60
+ }
61
+ }
62
+ },
63
+ message: {
64
+ type: 'string',
65
+ label: 'Message Body',
66
+ contentEncoding: StringContentEncodingEnum_1.StringContentEncodingEnum.HEX,
67
+ decode: () => {
68
+ const messageDataLength = this.packet.length - this.startPos - 4;
69
+ this.instance.message.setValue((0, BufferToHex_1.BufferToHex)(this.readBytes(4, messageDataLength)));
70
+ },
71
+ encode: () => {
72
+ const messageHex = this.instance.message.getValue('');
73
+ this.instance.message.setValue(messageHex);
74
+ this.writeBytes(4, Buffer.from(messageHex, 'hex'));
75
+ }
76
+ }
77
+ }
78
+ };
79
+ this.id = 'icmpv6';
80
+ this.name = 'Internet Control Message Protocol v6';
81
+ this.nickname = 'ICMPv6';
82
+ }
83
+ /**
84
+ * Calculate ICMPv6 checksum
85
+ * @protected
86
+ */
87
+ calculateIcmpv6Checksum() {
88
+ const ipv6Header = this.prevCodecModules.find((prevCodecModule) => prevCodecModule.id === 'ipv6');
89
+ if (!ipv6Header)
90
+ return 0;
91
+ const messageBody = Buffer.from(this.instance.message.getValue(''), 'hex');
92
+ const sip = ipv6Header.instance.sip.getValue('0000:0000:0000:0000:0000:0000:0000:0000');
93
+ const dip = ipv6Header.instance.dip.getValue('0000:0000:0000:0000:0000:0000:0000:0000');
94
+ const pseudoHeader = Buffer.concat([
95
+ (0, IPToBuffer_1.IPv6ToBuffer)(sip),
96
+ (0, IPToBuffer_1.IPv6ToBuffer)(dip),
97
+ (0, NumberToBuffer_1.UInt32ToBuffer)(messageBody.length + 4),
98
+ (0, NumberToBuffer_1.UInt8ToBuffer)(0x00),
99
+ (0, NumberToBuffer_1.UInt8ToBuffer)(0x00),
100
+ (0, NumberToBuffer_1.UInt8ToBuffer)(0x00),
101
+ (0, NumberToBuffer_1.UInt8ToBuffer)(0x3a)
102
+ ]);
103
+ const icmpHeader = Buffer.concat([
104
+ (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.type.getValue(0)),
105
+ (0, NumberToBuffer_1.UInt8ToBuffer)(this.instance.code.getValue(0)),
106
+ (0, NumberToBuffer_1.UInt16ToBuffer)(this.instance.checksum.getValue(0))
107
+ ]);
108
+ const buffer = Buffer.concat([
109
+ pseudoHeader,
110
+ icmpHeader,
111
+ messageBody
112
+ ]);
113
+ const paddedBuffer = buffer.length % 2 === 1 ? Buffer.concat([buffer, (0, NumberToBuffer_1.UInt8ToBuffer)(0)]) : buffer;
114
+ let checksum = 0;
115
+ for (let i = 0; i < paddedBuffer.length; i += 2) {
116
+ checksum += (paddedBuffer[i] << 8) | (paddedBuffer[i + 1] || 0);
117
+ if (checksum > 0xFFFF)
118
+ checksum = (checksum & 0xFFFF) + 1;
119
+ }
120
+ return (~checksum) & 0xFFFF;
121
+ }
122
+ match() {
123
+ if (!this.prevCodecModule)
124
+ return false;
125
+ return this.prevCodecModule.instance.nxt.getValue() === 0x3a;
126
+ }
127
+ }
128
+ exports.ICMPv6 = ICMPv6;
@@ -0,0 +1,10 @@
1
+ import { ProtocolJSONSchema } from '../../schema/ProtocolJSONSchema';
2
+ import { BaseHeader } from '../abstracts/BaseHeader';
3
+ export declare class IPv6 extends BaseHeader {
4
+ SCHEMA: ProtocolJSONSchema;
5
+ id: string;
6
+ name: string;
7
+ nickname: string;
8
+ match(): boolean;
9
+ }
10
+ //# sourceMappingURL=IPv6.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IPv6.d.ts","sourceRoot":"","sources":["../../../../src/lib/codec/headers/IPv6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AASlD,qBAAa,IAAK,SAAQ,UAAU;IAEzB,MAAM,EAAE,kBAAkB,CAsJhC;IAEM,EAAE,EAAE,MAAM,CAAS;IAEnB,IAAI,EAAE,MAAM,CAAgC;IAE5C,QAAQ,EAAE,MAAM,CAAS;IAEzB,KAAK,IAAI,OAAO;CAK1B"}