@k03mad/dns-leak 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/app/helpers/log.js +1 -1
- package/app/run.js +51 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,9 @@ Using API/tools:\
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npm i @k03mad/dns-leak -g
|
|
13
|
+
```
|
|
13
14
|
|
|
15
|
+
```bash
|
|
14
16
|
dns-leak
|
|
15
17
|
```
|
|
16
18
|
|
|
@@ -21,6 +23,7 @@ npm i @k03mad/dns-leak
|
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
```js
|
|
24
|
-
import {CloudPing, IPLeak, IPWhois, NextDNS} from '
|
|
25
|
-
// details at ./app/api folder
|
|
26
|
+
import {CloudPing, IPLeak, IPWhois, NextDNS} from '@k03mad/dns-leak';
|
|
26
27
|
```
|
|
28
|
+
|
|
29
|
+
Details at [./app/api](/app/api) folder
|
package/app/helpers/log.js
CHANGED
package/app/run.js
CHANGED
|
@@ -9,7 +9,7 @@ const NextApi = new NextDNS();
|
|
|
9
9
|
const WhoisApi = new IPWhois();
|
|
10
10
|
const CloudPingApi = new CloudPing();
|
|
11
11
|
|
|
12
|
-
const [leak, next, whois, location] = await Promise.
|
|
12
|
+
const [leak, next, whois, location] = await Promise.allSettled([
|
|
13
13
|
LeakApi.getDnsInfoMulti({isSpinnerEnabled: true}),
|
|
14
14
|
NextApi.getTest(),
|
|
15
15
|
WhoisApi.getIpInfo(),
|
|
@@ -19,43 +19,60 @@ const [leak, next, whois, location] = await Promise.all([
|
|
|
19
19
|
const spinnerName = 'IP info';
|
|
20
20
|
spinner.start(spinnerName, true);
|
|
21
21
|
|
|
22
|
-
const dnsIps = [
|
|
22
|
+
const dnsIps = [
|
|
23
|
+
...new Set([
|
|
24
|
+
...Object.keys(leak.value?.ip || []),
|
|
25
|
+
next.value?.resolver || '',
|
|
26
|
+
]),
|
|
27
|
+
].filter(Boolean);
|
|
23
28
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const dnsIpsInfo = await Promise.all(dnsIps.map(async ip => {
|
|
30
|
+
try {
|
|
31
|
+
const data = await WhoisApi.getIpInfo({ip});
|
|
32
|
+
spinner.count(spinnerName, dnsIps.length);
|
|
33
|
+
return data;
|
|
34
|
+
} catch {}
|
|
28
35
|
}));
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
const dnsIpsInfoFormatted = dnsIpsInfo
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.sort((a, b) => a?.ip?.localeCompare(b?.ip))
|
|
40
|
+
.flatMap(data => formatIpInfo(data));
|
|
41
|
+
|
|
42
|
+
const output = [];
|
|
43
|
+
|
|
44
|
+
if (whois.value) {
|
|
45
|
+
output.push(
|
|
46
|
+
header('IP'),
|
|
47
|
+
formatIpInfo(whois.value),
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (dnsIpsInfoFormatted.length > 0) {
|
|
52
|
+
output.push(
|
|
53
|
+
header('DNS'),
|
|
54
|
+
...dnsIpsInfoFormatted,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (next.value?.ecs) {
|
|
59
|
+
try {
|
|
60
|
+
const data = await WhoisApi.getIpInfo({ip: next.value.ecs.replace(/\/.+/, '')});
|
|
61
|
+
data.ip += ` (${next.value.ecs})`;
|
|
31
62
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
if (next.ecs) {
|
|
46
|
-
const data = await WhoisApi.getIpInfo({ip: next.ecs.replace(/\/.+/, '')});
|
|
47
|
-
data.ip += ` (${next.ecs})`;
|
|
48
|
-
|
|
49
|
-
log(
|
|
50
|
-
header('DNS ECS'),
|
|
51
|
-
'',
|
|
52
|
-
formatIpInfo(data),
|
|
53
|
-
'',
|
|
63
|
+
output.push(
|
|
64
|
+
header('DNS ECS'),
|
|
65
|
+
formatIpInfo(data),
|
|
66
|
+
);
|
|
67
|
+
} catch {}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (location.value) {
|
|
71
|
+
output.push(
|
|
72
|
+
header('CLOUDFRONT CDN'),
|
|
73
|
+
formatLocationInfo(location.value),
|
|
54
74
|
);
|
|
55
75
|
}
|
|
56
76
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'',
|
|
60
|
-
formatLocationInfo(location),
|
|
61
|
-
);
|
|
77
|
+
spinner.stop(spinnerName);
|
|
78
|
+
log(`\n${output.join('\n\n')}`);
|