pingman 2.0.0 → 2.2.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/LICENSE +21 -21
- package/README.md +211 -192
- package/dist/src/builder/builder.d.ts +3 -3
- package/dist/src/builder/builder.js +31 -30
- package/dist/src/builder/builder.js.map +1 -0
- package/dist/src/builder/linux.d.ts +3 -3
- package/dist/src/builder/linux.js +83 -82
- package/dist/src/builder/linux.js.map +1 -0
- package/dist/src/builder/mac.d.ts +3 -3
- package/dist/src/builder/mac.js +89 -88
- package/dist/src/builder/mac.js.map +1 -0
- package/dist/src/builder/windows.d.ts +3 -3
- package/dist/src/builder/windows.js +94 -93
- package/dist/src/builder/windows.js.map +1 -0
- package/dist/src/errors.d.ts +10 -10
- package/dist/src/errors.js +26 -25
- package/dist/src/errors.js.map +1 -0
- package/dist/src/helper.d.ts +2 -2
- package/dist/src/helper.js +34 -33
- package/dist/src/helper.js.map +1 -0
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +57 -56
- package/dist/src/index.js.map +1 -0
- package/dist/src/log.d.ts +7 -7
- package/dist/src/log.js +26 -25
- package/dist/src/log.js.map +1 -0
- package/dist/src/messages.d.ts +9 -9
- package/dist/src/messages.js +13 -12
- package/dist/src/messages.js.map +1 -0
- package/dist/src/parser/clonePingResponse.d.ts +3 -0
- package/dist/src/parser/clonePingResponse.js +21 -0
- package/dist/src/parser/clonePingResponse.js.map +1 -0
- package/dist/src/parser/linux.d.ts +7 -7
- package/dist/src/parser/linux.js +31 -30
- package/dist/src/parser/linux.js.map +1 -0
- package/dist/src/parser/mac.d.ts +11 -11
- package/dist/src/parser/mac.js +47 -46
- package/dist/src/parser/mac.js.map +1 -0
- package/dist/src/parser/parser.interface.d.ts +8 -8
- package/dist/src/parser/parser.interface.js +3 -2
- package/dist/src/parser/parser.interface.js.map +1 -0
- package/dist/src/parser/parserFactory.d.ts +3 -3
- package/dist/src/parser/parserFactory.js +125 -122
- package/dist/src/parser/parserFactory.js.map +1 -0
- package/dist/src/parser/windows.d.ts +13 -13
- package/dist/src/parser/windows.js +111 -110
- package/dist/src/parser/windows.js.map +1 -0
- package/dist/src/ping.d.ts +3 -3
- package/dist/src/ping.js +23 -22
- package/dist/src/ping.js.map +1 -0
- package/dist/src/types.d.ts +44 -44
- package/dist/src/types.js +3 -2
- package/dist/src/types.js.map +1 -0
- package/package.json +58 -58
|
@@ -1,82 +1,83 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const messages_1 = require("../messages");
|
|
4
|
-
const process_1 = require("process");
|
|
5
|
-
const linux = (ip, options) => {
|
|
6
|
-
let defaultNumberOfEchoes = '4';
|
|
7
|
-
let args = [];
|
|
8
|
-
let buildCommand = {
|
|
9
|
-
command: 'ping',
|
|
10
|
-
arguments: args
|
|
11
|
-
};
|
|
12
|
-
//NO Allowing Unsanitized user input into spawn.Checking each param and assigning
|
|
13
|
-
if (!options) {
|
|
14
|
-
buildCommand.arguments.push('-c', defaultNumberOfEchoes);
|
|
15
|
-
args.push(ip);
|
|
16
|
-
return buildCommand;
|
|
17
|
-
}
|
|
18
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.numberOfEchos) === 'number') {
|
|
19
|
-
args.push('-c', options.numberOfEchos.toString());
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
args.push('-c', defaultNumberOfEchoes);
|
|
23
|
-
}
|
|
24
|
-
if (options === null || options === void 0 ? void 0 : options.soDebugOption) {
|
|
25
|
-
args.push('-d');
|
|
26
|
-
}
|
|
27
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
28
|
-
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
29
|
-
args.push('-f');
|
|
30
|
-
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning'); //Catch the warning and process it
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
37
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
38
|
-
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
39
|
-
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning');
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
args.push('-f');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.interfaceAddress) === 'string') {
|
|
46
|
-
args.push('-I', options.interfaceAddress);
|
|
47
|
-
}
|
|
48
|
-
if (options === null || options === void 0 ? void 0 : options.suppressLoopback) {
|
|
49
|
-
args.push('-L');
|
|
50
|
-
}
|
|
51
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.TTL) === 'number') {
|
|
52
|
-
args.push('-t', options.TTL.toString());
|
|
53
|
-
}
|
|
54
|
-
if (options === null || options === void 0 ? void 0 : options.numeric) {
|
|
55
|
-
args.push('-n');
|
|
56
|
-
}
|
|
57
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.pattern) === 'string') {
|
|
58
|
-
args.push('-p', options.pattern);
|
|
59
|
-
}
|
|
60
|
-
if (options === null || options === void 0 ? void 0 : options.quiet) {
|
|
61
|
-
args.push('-q');
|
|
62
|
-
}
|
|
63
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.bufferSize) === 'number') {
|
|
64
|
-
args.push('-s', options.bufferSize.toString());
|
|
65
|
-
}
|
|
66
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.timeBeforeExit) === 'number') {
|
|
67
|
-
args.push('-W', options.timeBeforeExit.toString());
|
|
68
|
-
}
|
|
69
|
-
if (options === null || options === void 0 ? void 0 : options.verboseOutput) {
|
|
70
|
-
args.push('-v');
|
|
71
|
-
}
|
|
72
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.timeout) === 'number') {
|
|
73
|
-
args.push('-w', options.timeout.toString());
|
|
74
|
-
}
|
|
75
|
-
if (options === null || options === void 0 ? void 0 : options.IPV6) {
|
|
76
|
-
buildCommand.command = 'ping6';
|
|
77
|
-
}
|
|
78
|
-
args.push(ip);
|
|
79
|
-
buildCommand.arguments = args;
|
|
80
|
-
return buildCommand;
|
|
81
|
-
};
|
|
82
|
-
exports.default = linux;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const messages_1 = require("../messages");
|
|
4
|
+
const process_1 = require("process");
|
|
5
|
+
const linux = (ip, options) => {
|
|
6
|
+
let defaultNumberOfEchoes = '4';
|
|
7
|
+
let args = [];
|
|
8
|
+
let buildCommand = {
|
|
9
|
+
command: 'ping',
|
|
10
|
+
arguments: args
|
|
11
|
+
};
|
|
12
|
+
//NO Allowing Unsanitized user input into spawn.Checking each param and assigning
|
|
13
|
+
if (!options) {
|
|
14
|
+
buildCommand.arguments.push('-c', defaultNumberOfEchoes);
|
|
15
|
+
args.push(ip);
|
|
16
|
+
return buildCommand;
|
|
17
|
+
}
|
|
18
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.numberOfEchos) === 'number') {
|
|
19
|
+
args.push('-c', options.numberOfEchos.toString());
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
args.push('-c', defaultNumberOfEchoes);
|
|
23
|
+
}
|
|
24
|
+
if (options === null || options === void 0 ? void 0 : options.soDebugOption) {
|
|
25
|
+
args.push('-d');
|
|
26
|
+
}
|
|
27
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
28
|
+
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
29
|
+
args.push('-f');
|
|
30
|
+
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning'); //Catch the warning and process it
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
37
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
38
|
+
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
39
|
+
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning');
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
args.push('-f');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.interfaceAddress) === 'string') {
|
|
46
|
+
args.push('-I', options.interfaceAddress);
|
|
47
|
+
}
|
|
48
|
+
if (options === null || options === void 0 ? void 0 : options.suppressLoopback) {
|
|
49
|
+
args.push('-L');
|
|
50
|
+
}
|
|
51
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.TTL) === 'number') {
|
|
52
|
+
args.push('-t', options.TTL.toString());
|
|
53
|
+
}
|
|
54
|
+
if (options === null || options === void 0 ? void 0 : options.numeric) {
|
|
55
|
+
args.push('-n');
|
|
56
|
+
}
|
|
57
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.pattern) === 'string') {
|
|
58
|
+
args.push('-p', options.pattern);
|
|
59
|
+
}
|
|
60
|
+
if (options === null || options === void 0 ? void 0 : options.quiet) {
|
|
61
|
+
args.push('-q');
|
|
62
|
+
}
|
|
63
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.bufferSize) === 'number') {
|
|
64
|
+
args.push('-s', options.bufferSize.toString());
|
|
65
|
+
}
|
|
66
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.timeBeforeExit) === 'number') {
|
|
67
|
+
args.push('-W', options.timeBeforeExit.toString());
|
|
68
|
+
}
|
|
69
|
+
if (options === null || options === void 0 ? void 0 : options.verboseOutput) {
|
|
70
|
+
args.push('-v');
|
|
71
|
+
}
|
|
72
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.timeout) === 'number') {
|
|
73
|
+
args.push('-w', options.timeout.toString());
|
|
74
|
+
}
|
|
75
|
+
if (options === null || options === void 0 ? void 0 : options.IPV6) {
|
|
76
|
+
buildCommand.command = 'ping6';
|
|
77
|
+
}
|
|
78
|
+
args.push(ip);
|
|
79
|
+
buildCommand.arguments = args;
|
|
80
|
+
return buildCommand;
|
|
81
|
+
};
|
|
82
|
+
exports.default = linux;
|
|
83
|
+
//# sourceMappingURL=linux.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linux.js","sourceRoot":"","sources":["../../../src/builder/linux.ts"],"names":[],"mappings":";;AACA,0CAA6C;AAC7C,qCAAsC;AAEtC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,OAA6B,EAAkB,EAAE;IACzE,IAAI,qBAAqB,GAAG,GAAG,CAAC;IAChC,IAAI,IAAI,GAAkB,EAAE,CAAC;IAC7B,IAAI,YAAY,GAAmB;QAChC,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,IAAI;KACjB,CAAC;IACF,iFAAiF;IACjF,IAAI,CAAC,OAAO,EAAE;QACX,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACd,OAAO,YAAY,CAAC;KACtB;IACD,IAAI,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAA,KAAK,QAAQ,EAAE;QAC7C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;KACpD;SAAM;QACJ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAq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,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IACD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;QAChB,YAAY,CAAC,OAAO,GAAG,OAAO,CAAA;KAChC;IACD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,YAAY,CAAC,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,YAAY,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,KAAK,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { commandBuilder, extendedPingOptions } from '../types';
|
|
2
|
-
declare const mac: (ip: string, options?: extendedPingOptions) => commandBuilder;
|
|
3
|
-
export default mac;
|
|
1
|
+
import { commandBuilder, extendedPingOptions } from '../types';
|
|
2
|
+
declare const mac: (ip: string, options?: extendedPingOptions) => commandBuilder;
|
|
3
|
+
export default mac;
|
package/dist/src/builder/mac.js
CHANGED
|
@@ -1,88 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const process_1 = require("process");
|
|
4
|
-
const messages_1 = require("../messages");
|
|
5
|
-
const mac = (ip, options) => {
|
|
6
|
-
let defaultNumberOfEchoes = '4'; //default needed because mac by default has continous ping till we cancel
|
|
7
|
-
let args = [];
|
|
8
|
-
let buildCommand = {
|
|
9
|
-
command: '/sbin/ping',
|
|
10
|
-
arguments: args
|
|
11
|
-
};
|
|
12
|
-
//NO Allowing Unsanitized user input into spawn.Checking each param and assigning
|
|
13
|
-
if (!options) {
|
|
14
|
-
buildCommand.arguments.push('-c', defaultNumberOfEchoes);
|
|
15
|
-
args.push(ip);
|
|
16
|
-
return buildCommand;
|
|
17
|
-
}
|
|
18
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.numberOfEchos) === 'number') {
|
|
19
|
-
args.push('-c', options.numberOfEchos.toString());
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
args.push('-c', defaultNumberOfEchoes);
|
|
23
|
-
}
|
|
24
|
-
if (options === null || options === void 0 ? void 0 : options.soDebugOption) {
|
|
25
|
-
args.push('-d');
|
|
26
|
-
}
|
|
27
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
28
|
-
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
29
|
-
args.push('-f');
|
|
30
|
-
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning');
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
37
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
38
|
-
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
args.push('-f');
|
|
42
|
-
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.interfaceAddress) === 'string') {
|
|
46
|
-
args.push('-I', options.interfaceAddress);
|
|
47
|
-
}
|
|
48
|
-
if (options === null || options === void 0 ? void 0 : options.suppressLoopback) {
|
|
49
|
-
args.push('-L');
|
|
50
|
-
}
|
|
51
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.TTL) === 'number') {
|
|
52
|
-
args.push('-m', options.TTL.toString()); //change to -t for linux
|
|
53
|
-
}
|
|
54
|
-
if (options.doNotFragment) {
|
|
55
|
-
args.push('-D');
|
|
56
|
-
}
|
|
57
|
-
if (options === null || options === void 0 ? void 0 : options.numeric) {
|
|
58
|
-
args.push('-n');
|
|
59
|
-
}
|
|
60
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.pattern) === 'string') {
|
|
61
|
-
args.push('-p', options.pattern);
|
|
62
|
-
}
|
|
63
|
-
if (options === null || options === void 0 ? void 0 : options.quiet) {
|
|
64
|
-
args.push('-q');
|
|
65
|
-
}
|
|
66
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.srcAddr) === 'string') {
|
|
67
|
-
args.push('-S', options.srcAddr); //Delete for Linux
|
|
68
|
-
}
|
|
69
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.bufferSize) === 'number') {
|
|
70
|
-
args.push('-s', options.bufferSize.toString());
|
|
71
|
-
}
|
|
72
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.timeBeforeExit) === 'number') {
|
|
73
|
-
args.push('-t', options.timeBeforeExit.toString()); //change to -w for linux
|
|
74
|
-
}
|
|
75
|
-
if (options === null || options === void 0 ? void 0 : options.verboseOutput) {
|
|
76
|
-
args.push('-v');
|
|
77
|
-
}
|
|
78
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.timeout) === 'number') {
|
|
79
|
-
args.push('-W', (options.timeout * 1000).toString());
|
|
80
|
-
}
|
|
81
|
-
if (options === null || options === void 0 ? void 0 : options.IPV6) {
|
|
82
|
-
buildCommand.command = '/sbin/ping6';
|
|
83
|
-
}
|
|
84
|
-
args.push(ip);
|
|
85
|
-
buildCommand.arguments = args;
|
|
86
|
-
return buildCommand;
|
|
87
|
-
};
|
|
88
|
-
exports.default = mac;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const process_1 = require("process");
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const mac = (ip, options) => {
|
|
6
|
+
let defaultNumberOfEchoes = '4'; //default needed because mac by default has continous ping till we cancel
|
|
7
|
+
let args = [];
|
|
8
|
+
let buildCommand = {
|
|
9
|
+
command: '/sbin/ping',
|
|
10
|
+
arguments: args
|
|
11
|
+
};
|
|
12
|
+
//NO Allowing Unsanitized user input into spawn.Checking each param and assigning
|
|
13
|
+
if (!options) {
|
|
14
|
+
buildCommand.arguments.push('-c', defaultNumberOfEchoes);
|
|
15
|
+
args.push(ip);
|
|
16
|
+
return buildCommand;
|
|
17
|
+
}
|
|
18
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.numberOfEchos) === 'number') {
|
|
19
|
+
args.push('-c', options.numberOfEchos.toString());
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
args.push('-c', defaultNumberOfEchoes);
|
|
23
|
+
}
|
|
24
|
+
if (options === null || options === void 0 ? void 0 : options.soDebugOption) {
|
|
25
|
+
args.push('-d');
|
|
26
|
+
}
|
|
27
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
28
|
+
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
29
|
+
args.push('-f');
|
|
30
|
+
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (options === null || options === void 0 ? void 0 : options.floodPing) {
|
|
37
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.interval) === 'number') {
|
|
38
|
+
args.push('-i', options === null || options === void 0 ? void 0 : options.interval.toString());
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
args.push('-f');
|
|
42
|
+
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.FLOOD_AND_INTERVAL_ARGS, 'argumentWarning');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.interfaceAddress) === 'string') {
|
|
46
|
+
args.push('-I', options.interfaceAddress);
|
|
47
|
+
}
|
|
48
|
+
if (options === null || options === void 0 ? void 0 : options.suppressLoopback) {
|
|
49
|
+
args.push('-L');
|
|
50
|
+
}
|
|
51
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.TTL) === 'number') {
|
|
52
|
+
args.push('-m', options.TTL.toString()); //change to -t for linux
|
|
53
|
+
}
|
|
54
|
+
if (options.doNotFragment) {
|
|
55
|
+
args.push('-D');
|
|
56
|
+
}
|
|
57
|
+
if (options === null || options === void 0 ? void 0 : options.numeric) {
|
|
58
|
+
args.push('-n');
|
|
59
|
+
}
|
|
60
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.pattern) === 'string') {
|
|
61
|
+
args.push('-p', options.pattern);
|
|
62
|
+
}
|
|
63
|
+
if (options === null || options === void 0 ? void 0 : options.quiet) {
|
|
64
|
+
args.push('-q');
|
|
65
|
+
}
|
|
66
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.srcAddr) === 'string') {
|
|
67
|
+
args.push('-S', options.srcAddr); //Delete for Linux
|
|
68
|
+
}
|
|
69
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.bufferSize) === 'number') {
|
|
70
|
+
args.push('-s', options.bufferSize.toString());
|
|
71
|
+
}
|
|
72
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.timeBeforeExit) === 'number') {
|
|
73
|
+
args.push('-t', options.timeBeforeExit.toString()); //change to -w for linux
|
|
74
|
+
}
|
|
75
|
+
if (options === null || options === void 0 ? void 0 : options.verboseOutput) {
|
|
76
|
+
args.push('-v');
|
|
77
|
+
}
|
|
78
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.timeout) === 'number') {
|
|
79
|
+
args.push('-W', (options.timeout * 1000).toString());
|
|
80
|
+
}
|
|
81
|
+
if (options === null || options === void 0 ? void 0 : options.IPV6) {
|
|
82
|
+
buildCommand.command = '/sbin/ping6';
|
|
83
|
+
}
|
|
84
|
+
args.push(ip);
|
|
85
|
+
buildCommand.arguments = args;
|
|
86
|
+
return buildCommand;
|
|
87
|
+
};
|
|
88
|
+
exports.default = mac;
|
|
89
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D;IACD,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;QACf,YAAY,CAAC,OAAO,GAAG,aAAa,CAAA;KACvC;IACD,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,YAAY,CAAC,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,YAAY,CAAC;AACxB,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { commandBuilder, extendedPingOptions } from '../types';
|
|
2
|
-
declare const windows: (ip: string, options?: extendedPingOptions) => commandBuilder;
|
|
3
|
-
export default windows;
|
|
1
|
+
import { commandBuilder, extendedPingOptions } from '../types';
|
|
2
|
+
declare const windows: (ip: string, options?: extendedPingOptions) => commandBuilder;
|
|
3
|
+
export default windows;
|
|
@@ -1,93 +1,94 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const process_1 = require("process");
|
|
4
|
-
const messages_1 = require("../messages");
|
|
5
|
-
const windows = (ip, options) => {
|
|
6
|
-
let args = [];
|
|
7
|
-
const windowsRootPath = process.env.SystemRoot + '/system32/ping.exe';
|
|
8
|
-
//NO Allowing Unsanitized user input into spawn.Checking each param and assigning
|
|
9
|
-
if (!options) {
|
|
10
|
-
args.push(ip);
|
|
11
|
-
return {
|
|
12
|
-
command: windowsRootPath,
|
|
13
|
-
arguments: args
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
if (options === null || options === void 0 ? void 0 : options.numeric) {
|
|
18
|
-
args.push('-a');
|
|
19
|
-
}
|
|
20
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.numberOfEchos) === 'number') {
|
|
21
|
-
args.push('-n', options.numberOfEchos.toString());
|
|
22
|
-
}
|
|
23
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.bufferSize) === 'number') {
|
|
24
|
-
args.push('-l', options.bufferSize.toString());
|
|
25
|
-
}
|
|
26
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.TTL) === 'number') {
|
|
27
|
-
args.push('-i', options.TTL.toString());
|
|
28
|
-
}
|
|
29
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.timeout) === 'number') {
|
|
30
|
-
args.push('-w', (options.timeout * 1000).toString());
|
|
31
|
-
}
|
|
32
|
-
args.push(...(checkForIpV4SpecificFields(options)));
|
|
33
|
-
args.push(...(checkForIpV6SpecificFields(options)));
|
|
34
|
-
args.push(ip);
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
command: windowsRootPath,
|
|
38
|
-
arguments: args
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
//Checking for windows IPV4 fields as per official documentation
|
|
42
|
-
function checkForIpV4SpecificFields(options) {
|
|
43
|
-
let optionsUsed = "";
|
|
44
|
-
let args = [];
|
|
45
|
-
if (options === null || options === void 0 ? void 0 : options.IPV4) {
|
|
46
|
-
args.push('-4');
|
|
47
|
-
if (options.doNotFragment) {
|
|
48
|
-
args.push('-f');
|
|
49
|
-
}
|
|
50
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.recordRouteHops) === 'number') {
|
|
51
|
-
args.push('-r', options.recordRouteHops.toString());
|
|
52
|
-
}
|
|
53
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.hopTimestamp) === 'number') {
|
|
54
|
-
args.push('-s', options.hopTimestamp.toString());
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
if (options.doNotFragment) {
|
|
59
|
-
optionsUsed = optionsUsed.concat(',', options.doNotFragment.toString());
|
|
60
|
-
}
|
|
61
|
-
if (options.recordRouteHops) {
|
|
62
|
-
optionsUsed = optionsUsed.concat(',', options.recordRouteHops.toString());
|
|
63
|
-
}
|
|
64
|
-
if (options.hopTimestamp) {
|
|
65
|
-
optionsUsed = optionsUsed.concat(',', options.hopTimestamp.toString());
|
|
66
|
-
}
|
|
67
|
-
if (optionsUsed.length > 0) {
|
|
68
|
-
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.ENABLE_IPV4_EXPLICIT.replace('commands', optionsUsed), 'IPV4OnlyWarning');
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return args;
|
|
72
|
-
}
|
|
73
|
-
//Checking for windows IPV6 fields as per official documentation
|
|
74
|
-
function checkForIpV6SpecificFields(options) {
|
|
75
|
-
let optionsUsed = "";
|
|
76
|
-
let args = [];
|
|
77
|
-
if (options === null || options === void 0 ? void 0 : options.IPV6) {
|
|
78
|
-
args.push('-6');
|
|
79
|
-
if (options.srcAddr) {
|
|
80
|
-
args.push('-S', options.srcAddr);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
if (typeof options.srcAddr === 'string') {
|
|
85
|
-
optionsUsed = optionsUsed.concat(',', options.srcAddr);
|
|
86
|
-
}
|
|
87
|
-
if (optionsUsed.length > 0) {
|
|
88
|
-
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.ENABLE_IPV6_EXPLICIT.replace('commands', optionsUsed), 'IPV6OnlyWarning');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return args;
|
|
92
|
-
}
|
|
93
|
-
exports.default = windows;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const process_1 = require("process");
|
|
4
|
+
const messages_1 = require("../messages");
|
|
5
|
+
const windows = (ip, options) => {
|
|
6
|
+
let args = [];
|
|
7
|
+
const windowsRootPath = process.env.SystemRoot + '/system32/ping.exe';
|
|
8
|
+
//NO Allowing Unsanitized user input into spawn.Checking each param and assigning
|
|
9
|
+
if (!options) {
|
|
10
|
+
args.push(ip);
|
|
11
|
+
return {
|
|
12
|
+
command: windowsRootPath,
|
|
13
|
+
arguments: args
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
if (options === null || options === void 0 ? void 0 : options.numeric) {
|
|
18
|
+
args.push('-a');
|
|
19
|
+
}
|
|
20
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.numberOfEchos) === 'number') {
|
|
21
|
+
args.push('-n', options.numberOfEchos.toString());
|
|
22
|
+
}
|
|
23
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.bufferSize) === 'number') {
|
|
24
|
+
args.push('-l', options.bufferSize.toString());
|
|
25
|
+
}
|
|
26
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.TTL) === 'number') {
|
|
27
|
+
args.push('-i', options.TTL.toString());
|
|
28
|
+
}
|
|
29
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.timeout) === 'number') {
|
|
30
|
+
args.push('-w', (options.timeout * 1000).toString());
|
|
31
|
+
}
|
|
32
|
+
args.push(...(checkForIpV4SpecificFields(options)));
|
|
33
|
+
args.push(...(checkForIpV6SpecificFields(options)));
|
|
34
|
+
args.push(ip);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
command: windowsRootPath,
|
|
38
|
+
arguments: args
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//Checking for windows IPV4 fields as per official documentation
|
|
42
|
+
function checkForIpV4SpecificFields(options) {
|
|
43
|
+
let optionsUsed = "";
|
|
44
|
+
let args = [];
|
|
45
|
+
if (options === null || options === void 0 ? void 0 : options.IPV4) {
|
|
46
|
+
args.push('-4');
|
|
47
|
+
if (options.doNotFragment) {
|
|
48
|
+
args.push('-f');
|
|
49
|
+
}
|
|
50
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.recordRouteHops) === 'number') {
|
|
51
|
+
args.push('-r', options.recordRouteHops.toString());
|
|
52
|
+
}
|
|
53
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.hopTimestamp) === 'number') {
|
|
54
|
+
args.push('-s', options.hopTimestamp.toString());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (options.doNotFragment) {
|
|
59
|
+
optionsUsed = optionsUsed.concat(',', options.doNotFragment.toString());
|
|
60
|
+
}
|
|
61
|
+
if (options.recordRouteHops) {
|
|
62
|
+
optionsUsed = optionsUsed.concat(',', options.recordRouteHops.toString());
|
|
63
|
+
}
|
|
64
|
+
if (options.hopTimestamp) {
|
|
65
|
+
optionsUsed = optionsUsed.concat(',', options.hopTimestamp.toString());
|
|
66
|
+
}
|
|
67
|
+
if (optionsUsed.length > 0) {
|
|
68
|
+
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.ENABLE_IPV4_EXPLICIT.replace('commands', optionsUsed), 'IPV4OnlyWarning');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return args;
|
|
72
|
+
}
|
|
73
|
+
//Checking for windows IPV6 fields as per official documentation
|
|
74
|
+
function checkForIpV6SpecificFields(options) {
|
|
75
|
+
let optionsUsed = "";
|
|
76
|
+
let args = [];
|
|
77
|
+
if (options === null || options === void 0 ? void 0 : options.IPV6) {
|
|
78
|
+
args.push('-6');
|
|
79
|
+
if (options.srcAddr) {
|
|
80
|
+
args.push('-S', options.srcAddr);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
if (typeof options.srcAddr === 'string') {
|
|
85
|
+
optionsUsed = optionsUsed.concat(',', options.srcAddr);
|
|
86
|
+
}
|
|
87
|
+
if (optionsUsed.length > 0) {
|
|
88
|
+
(0, process_1.emitWarning)(messages_1.ERROR_MESSAGES.ENABLE_IPV6_EXPLICIT.replace('commands', optionsUsed), 'IPV6OnlyWarning');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return args;
|
|
92
|
+
}
|
|
93
|
+
exports.default = windows;
|
|
94
|
+
//# sourceMappingURL=windows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windows.js","sourceRoot":"","sources":["../../../src/builder/windows.ts"],"names":[],"mappings":";;AACA,qCAAqC;AACrC,0CAA4C;AAE5C,MAAM,OAAO,GAAG,CAAC,EAAU,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ends Error {
|
|
2
|
-
code?: string;
|
|
3
|
-
constructor(message: string, code?: string);
|
|
4
|
-
}
|
|
5
|
-
export declare class ipError extends pingError {
|
|
6
|
-
constructor(message: string);
|
|
7
|
-
}
|
|
8
|
-
export declare class supportedError extends pingError {
|
|
9
|
-
constructor(message: string);
|
|
10
|
-
}
|
|
1
|
+
export declare class pingError extends Error {
|
|
2
|
+
code?: string;
|
|
3
|
+
constructor(message: string, code?: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class ipError extends pingError {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class supportedError extends pingError {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|