@cto.af/pcap-ng-parser 3.0.0 → 3.0.1

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/src/linkTypes.ts DELETED
@@ -1,223 +0,0 @@
1
- /**
2
- * This will eventually have come from an IANA registry.
3
- *
4
- * @see https://www.ietf.org/archive/id/draft-ietf-opsawg-pcaplinktype-13.html
5
- */
6
- export const LINK_TYPE_NAMES = new Map([
7
- [0, 'NULL'],
8
- [1, 'ETHERNET'],
9
- [2, 'EXP_ETHERNET'],
10
- [3, 'AX25'],
11
- [4, 'PRONET'],
12
- [5, 'CHAOS'],
13
- [6, 'IEEE802_5'],
14
- [7, 'ARCNET_BSD'],
15
- [8, 'SLIP'],
16
- [9, 'PPP'],
17
- [10, 'FDDI'],
18
- [50, 'PPP_HDLC'],
19
- [51, 'PPP_ETHER'],
20
- [99, 'SYMANTEC_FIREWALL'],
21
- [100, 'ATM_RFC1483'],
22
- [101, 'RAW'],
23
- [102, 'SLIP_BSDOS'],
24
- [103, 'PPP_BSDOS'],
25
- [104, 'C_HDLC'],
26
- [105, 'IEEE802_11'],
27
- [106, 'ATM_CLIP'],
28
- [107, 'FRELAY'],
29
- [108, 'LOOP'],
30
- [109, 'ENC'],
31
- [110, 'LANE8023'],
32
- [111, 'HIPPI'],
33
- [112, 'HDLC'],
34
- [113, 'LINUX_SLL'],
35
- [114, 'LTALK'],
36
- [115, 'ECONET'],
37
- [116, 'IPFILTER'],
38
- [117, 'PFLOG'],
39
- [118, 'CISCO_IOS'],
40
- [119, 'IEEE802_11_PRISM'],
41
- [120, 'IEEE802_11_AIRONET'],
42
- [121, 'HHDLC'],
43
- [122, 'IP_OVER_FC'],
44
- [123, 'SUNATM'],
45
- [124, 'RIO'],
46
- [125, 'PCI_EXP'],
47
- [126, 'AURORA'],
48
- [127, 'IEEE802_11_RADIOTAP'],
49
- [128, 'TZSP'],
50
- [129, 'ARCNET_LINUX'],
51
- [130, 'JUNIPER_MLPPP'],
52
- [131, 'JUNIPER_MLFR'],
53
- [132, 'JUNIPER_ES'],
54
- [133, 'JUNIPER_GGSN'],
55
- [134, 'JUNIPER_MFR'],
56
- [135, 'JUNIPER_ATM2'],
57
- [136, 'JUNIPER_SERVICES'],
58
- [137, 'JUNIPER_ATM1'],
59
- [138, 'APPLE_IP_OVER_IEEE1394'],
60
- [139, 'MTP2_WITH_PHDR'],
61
- [140, 'MTP2'],
62
- [141, 'MTP3'],
63
- [142, 'SCCP'],
64
- [143, 'DOCSIS'],
65
- [144, 'LINUX_IRDA'],
66
- [145, 'IBM_SP'],
67
- [146, 'IBM_SN'],
68
- [147, 'RESERVED_01'],
69
- [148, 'RESERVED_02'],
70
- [149, 'RESERVED_03'],
71
- [150, 'RESERVED_04'],
72
- [151, 'RESERVED_05'],
73
- [152, 'RESERVED_06'],
74
- [153, 'RESERVED_07'],
75
- [154, 'RESERVED_08'],
76
- [155, 'RESERVED_09'],
77
- [156, 'RESERVED_10'],
78
- [157, 'RESERVED_11'],
79
- [158, 'RESERVED_12'],
80
- [159, 'RESERVED_13'],
81
- [160, 'RESERVED_14'],
82
- [161, 'RESERVED_15'],
83
- [162, 'RESERVED_16'],
84
- [163, 'IEEE802_11_AVS'],
85
- [164, 'JUNIPER_MONITOR'],
86
- [165, 'BACNET_MS_TP'],
87
- [166, 'PPP_PPPD'],
88
- [167, 'JUNIPER_PPPOE'],
89
- [168, 'JUNIPER_PPPOE_ATM'],
90
- [169, 'GPRS_LLC'],
91
- [170, 'GPF_T'],
92
- [171, 'GPF_F'],
93
- [172, 'GCOM_T1E1'],
94
- [173, 'GCOM_SERIAL'],
95
- [174, 'JUNIPER_PIC_PEER'],
96
- [175, 'ERF_ETH'],
97
- [176, 'ERF_POS'],
98
- [177, 'LINUX_LAPD'],
99
- [178, 'JUNIPER_ETHER'],
100
- [179, 'JUNIPER_PPP'],
101
- [180, 'JUNIPER_FRELAY'],
102
- [181, 'JUNIPER_CHDLC'],
103
- [182, 'MFR'],
104
- [183, 'JUNIPER_VP'],
105
- [184, 'A429'],
106
- [185, 'A653_ICM'],
107
- [186, 'USB_FREEBSD'],
108
- [187, 'BLUETOOTH_HCI_H4'],
109
- [188, 'IEEE802_16_MAC_CPS'],
110
- [189, 'USB_LINUX'],
111
- [190, 'CAN20B'],
112
- [191, 'IEEE802_15_4_LINUX'],
113
- [192, 'PPI'],
114
- [193, 'IEEE802_16_MAC_CPS_RADIO'],
115
- [194, 'JUNIPER_ISM'],
116
- [195, 'IEEE802_15_4_WITHFCS'],
117
- [196, 'SITA'],
118
- [197, 'ERF'],
119
- [198, 'RAIF1'],
120
- [199, 'IPMB_KONTRON'],
121
- [200, 'JUNIPER_ST'],
122
- [201, 'BLUETOOTH_HCI_H4_WITH_PHDR'],
123
- [202, 'AX25_KISS'],
124
- [203, 'LAPD'],
125
- [204, 'PPP_WITH_DIR'],
126
- [205, 'C_HDLC_WITH_DIR'],
127
- [206, 'FRELAY_WITH_DIR'],
128
- [207, 'LAPB_WITH_DIR'],
129
- [208, 'WillBarker-Proprietary'],
130
- [209, 'I2C_LINUX'],
131
- [210, 'FLEXRAY'],
132
- [211, 'MOST'],
133
- [212, 'LIN'],
134
- [213, 'X2E_SERIAL'],
135
- [214, 'X2E_XORAYA'],
136
- [215, 'IEEE802_15_4_NONASK_PHY'],
137
- [216, 'LINUX_EVDEV'],
138
- [217, 'GSMTAP_UM'],
139
- [218, 'GSMTAP_ABIS'],
140
- [219, 'MPLS'],
141
- [220, 'USB_LINUX_MMAPPED'],
142
- [221, 'DECT'],
143
- [222, 'AOS'],
144
- [223, 'WIHART'],
145
- [224, 'FC_2'],
146
- [225, 'FC_2_WITH_FRAME_DELIMS'],
147
- [226, 'IPNET'],
148
- [227, 'CAN_SOCKETCAN'],
149
- [228, 'IPV4'],
150
- [229, 'IPV6'],
151
- [230, 'IEEE802_15_4_NOFCS'],
152
- [231, 'DBUS'],
153
- [232, 'JUNIPER_VS'],
154
- [233, 'JUNIPER_SRX_E2E'],
155
- [234, 'JUNIPER_FIBRECHANNEL'],
156
- [235, 'DVB_CI'],
157
- [236, 'MUX27010'],
158
- [237, 'STANAG_5066_D_PDU'],
159
- [238, 'JUNIPER_ATM_CEMIC'],
160
- [239, 'NFLOG'],
161
- [240, 'NETANALYZER'],
162
- [241, 'NETANALYZER_TRANSPARENT'],
163
- [242, 'IPOIB'],
164
- [243, 'MPEG_2_TS'],
165
- [244, 'NG40'],
166
- [245, 'NFC_LLCP'],
167
- [246, 'PFSYNC'],
168
- [247, 'INFINIBAND'],
169
- [248, 'SCTP'],
170
- [249, 'USBPCAP'],
171
- [250, 'RTAC_SERIAL'],
172
- [251, 'BLUETOOTH_LE_LL'],
173
- [252, 'WIRESHARK_UPPER_PDU'],
174
- [253, 'NETLINK'],
175
- [254, 'BLUETOOTH_LINUX_MONITOR'],
176
- [255, 'BLUETOOTH_BREDR_BB'],
177
- [256, 'BLUETOOTH_LE_LL_WITH_PHDR'],
178
- [257, 'PROFIBUS_DL'],
179
- [258, 'PKTAP'],
180
- [259, 'EPON'],
181
- [260, 'IPMI_HPM_2'],
182
- [261, 'ZWAVE_R1_R2'],
183
- [262, 'ZWAVE_R3'],
184
- [263, 'WATTSTOPPER_DLM'],
185
- [264, 'ISO_14443'],
186
- [265, 'RDS'],
187
- [266, 'USB_DARWIN'],
188
- [267, 'OPENFLOW'],
189
- [268, 'SDLC'],
190
- [269, 'TI_LLN_SNIFFER'],
191
- [270, 'LORATAP'],
192
- [271, 'VSOCK'],
193
- [272, 'NORDIC_BLE'],
194
- [273, 'DOCSIS31_XRA31'],
195
- [274, 'ETHERNET_MPACKET'],
196
- [275, 'DISPLAYPORT_AUX'],
197
- [276, 'LINUX_SLL2'],
198
- [277, 'SERCOS_MONITOR'],
199
- [278, 'OPENVIZSLA'],
200
- [279, 'EBHSCR'],
201
- [280, 'VPP_DISPATCH'],
202
- [281, 'DSA_TAG_BRCM'],
203
- [282, 'DSA_TAG_BRCM_PREPEND'],
204
- [283, 'IEEE802_15_4_TAP'],
205
- [284, 'DSA_TAG_DSA'],
206
- [285, 'DSA_TAG_EDSA'],
207
- [286, 'ELEE'],
208
- [287, 'Z_WAVE_SERIAL'],
209
- [288, 'USB_2_0'],
210
- [289, 'ATSC_ALP'],
211
- [290, 'ETW'],
212
- [291, 'NETANALYZER_NG'],
213
- [292, 'ZBOSS_NCP'],
214
- [293, 'USB_2_0_LOW_SPEED'],
215
- [294, 'USB_2_0_FULL_SPEED'],
216
- [295, 'USB_2_0_HIGH_SPEED'],
217
- [296, 'AUERSWALD_LOG'],
218
- [297, 'ZWAVE_TAP'],
219
- [298, 'SILABS_DEBUG_CHANNEL'],
220
- [299, 'FIRA_UCI'],
221
- [300, 'MDB'],
222
- [301, 'DECT_NR'],
223
- ]);
package/src/options.ts DELETED
@@ -1,98 +0,0 @@
1
- export const SECTION_HEADER = 0x0A0D0D0A;
2
- export const INTERFACE_DESCRIPTION = 0x1;
3
- export const SIMPLE_PACKET = 0x3;
4
- export const NAME_RESOLUTION = 0x4;
5
- export const INTERFACE_STATISTICS = 0x5;
6
- export const ENHANCED_PACKET = 0x6;
7
- export const DECRYPTION_SECRETS = 0xA;
8
- export const CUSTOM_COPY = 0x00000BAD;
9
- export const CUSTOM_NOCOPY = 0x40000BAD;
10
-
11
- export type OptionType = 'ipv4' | 'ipv6' | 'ipv4mask' | 'ipv6prefix' | 'eui' |
12
- 'u32' | 'u64' | 'timestamp' | 'string' | undefined;
13
-
14
- export type OptionDescription = [name: string, typ?: OptionType, pen?: boolean];
15
-
16
- export type BlockOpts = Map<number, OptionDescription>;
17
-
18
- export const OPTION_NAMES = new Map<number, BlockOpts>([
19
- [SECTION_HEADER, /** @type {BlockOpts} */ (new Map([
20
- [1, ['opt_comment', 'string']],
21
- [2, ['shb_hardware', 'string']],
22
- [3, ['shb_os', 'string']],
23
- [4, ['shb_userappl', 'string']],
24
- [2988, ['opt_custom', 'string', true]],
25
- [2989, ['opt_custom', undefined, true]],
26
- [19372, ['opt_custom', 'string', true]],
27
- [19373, ['opt_custom', undefined, true]],
28
- ]))],
29
- [INTERFACE_DESCRIPTION, /** @type {BlockOpts} */ (new Map([
30
- [1, ['opt_comment', 'string']],
31
- [2, ['if_name', 'string']],
32
- [3, ['if_description', 'string']],
33
- [4, ['if_IPv4addr', 'ipv4mask']],
34
- [5, ['if_IPv6addr', 'ipv6prefix']],
35
- [6, ['if_MACaddr', 'eui']],
36
- [7, ['if_EUIaddr', 'eui']],
37
- [8, ['if_speed']],
38
- [9, ['if_tsresol']],
39
- [10, ['if_tzone']],
40
- [11, ['if_filter']],
41
- [12, ['if_os', 'string']],
42
- [13, ['if_fcslen']],
43
- [14, ['if_tsoffset', 'u64']],
44
- [15, ['if_hardware', 'string']],
45
- [16, ['if_txspeed', 'u64']],
46
- [17, ['if_rxspeed', 'u64']],
47
- [18, ['if_iana_tzname', 'string']],
48
- [2988, ['opt_custom', 'string', true]],
49
- [2989, ['opt_custom', undefined, true]],
50
- [19372, ['opt_custom', 'string', true]],
51
- [19373, ['opt_custom', undefined, true]],
52
- ]))],
53
- [NAME_RESOLUTION, /** @type {BlockOpts} */ (new Map([
54
- [1, ['opt_comment', 'string']],
55
- [2, ['ns_dnsname', 'string']],
56
- [3, ['ns_dnsIP4addr', 'ipv4']],
57
- [4, ['ns_dnsIP6addr', 'ipv6']],
58
- [2988, ['opt_custom', 'string', true]],
59
- [2989, ['opt_custom', undefined, true]],
60
- [19372, ['opt_custom', 'string', true]],
61
- [19373, ['opt_custom', undefined, true]],
62
- ]))],
63
- [INTERFACE_STATISTICS, /** @type {BlockOpts} */ (new Map([
64
- [1, ['opt_comment', 'string']],
65
- [2, ['isb_starttime', 'timestamp']],
66
- [3, ['isb_endtime', 'timestamp']],
67
- [4, ['isb_ifrecv', 'u64']],
68
- [5, ['isb_ifdrop', 'u64']],
69
- [6, ['isb_filteraccept', 'u64']],
70
- [7, ['isb_osdrop', 'u64']],
71
- [8, ['isb_usrdeliv', 'u64']],
72
- [2988, ['opt_custom', 'string', true]],
73
- [2989, ['opt_custom', undefined, true]],
74
- [19372, ['opt_custom', 'string', true]],
75
- [19373, ['opt_custom', undefined, true]],
76
- ]))],
77
- [ENHANCED_PACKET, /** @type {BlockOpts} */ (new Map([
78
- [1, ['opt_comment', 'string']],
79
- [2, ['epb_flags']],
80
- [3, ['epb_hash']],
81
- [4, ['epb_dropcount', 'u64']],
82
- [5, ['epb_packetid', 'u64']],
83
- [6, ['epb_queue', 'u32']],
84
- [7, ['epb_verdict']],
85
- [8, ['epb_processid_threadid']],
86
- [2988, ['opt_custom', 'string', true]],
87
- [2989, ['opt_custom', undefined, true]],
88
- [19372, ['opt_custom', 'string', true]],
89
- [19373, ['opt_custom', undefined, true]],
90
- ]))],
91
- [DECRYPTION_SECRETS, /** @type {BlockOpts} */ (new Map([
92
- [1, ['opt_comment', 'string']],
93
- [2988, ['opt_custom', 'string', true]],
94
- [2989, ['opt_custom', undefined, true]],
95
- [19372, ['opt_custom', 'string', true]],
96
- [19373, ['opt_custom', undefined, true]],
97
- ]))],
98
- ]);
package/src/utils.ts DELETED
@@ -1,21 +0,0 @@
1
- /**
2
- * Return this number padded to the nearest multiple of 4.
3
- *
4
- * @param n Number.
5
- * @returns Padded.
6
- */
7
- export function pad4(n: number): number {
8
- return (Math.ceil(n / 4) * 4) - n;
9
- }
10
-
11
- /**
12
- * Convert buffer to hex string with colon separators (e.g. Ethernet address).
13
- *
14
- * @param buf Buffer.
15
- * @returns Colon-separated string.
16
- */
17
- export function colons(buf: Uint8Array): string {
18
- return Array.from(buf)
19
- .map(x => x.toString(16).padStart(2, '0'))
20
- .join(':');
21
- }