pinokiod 7.5.24 → 7.5.25
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/kernel/procs.js +4 -2
- package/package.json +1 -1
- package/test/procs.test.js +3 -3
package/kernel/procs.js
CHANGED
|
@@ -73,13 +73,15 @@ class Procs {
|
|
|
73
73
|
let pids = new Set()
|
|
74
74
|
let s = stdout.trim()
|
|
75
75
|
const lines = s.split('\n');
|
|
76
|
+
const listeningForeignAddresses = new Set(['0.0.0.0:0', '[::]:0', '*:*', '*:0'])
|
|
76
77
|
for(let line of lines) {
|
|
77
78
|
if (isWin) {
|
|
78
79
|
// Skip headers
|
|
79
80
|
try {
|
|
80
81
|
if (!line.startsWith(' TCP')) continue;
|
|
81
82
|
const parts = line.trim().split(/\s+/);
|
|
82
|
-
const [ , localAddress,
|
|
83
|
+
const [ , localAddress, foreignAddress ] = parts;
|
|
84
|
+
const pid = parts[parts.length - 1]
|
|
83
85
|
|
|
84
86
|
let pid_int = parseInt(pid)
|
|
85
87
|
if (pid_int === 0 || pid_int === 4) {
|
|
@@ -88,7 +90,7 @@ class Procs {
|
|
|
88
90
|
continue
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
if (
|
|
93
|
+
if (!listeningForeignAddresses.has(foreignAddress)) continue;
|
|
92
94
|
const chunks = /(.+):([0-9]+)/.exec(localAddress)
|
|
93
95
|
let host = chunks[1]
|
|
94
96
|
let port = chunks[2]
|
package/package.json
CHANGED
package/test/procs.test.js
CHANGED
|
@@ -16,7 +16,7 @@ function loadProcsForPlatform(platform) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
test("Windows process parser only probes listening TCP rows", async () => {
|
|
19
|
+
test("Windows process parser only probes listening TCP rows without relying on localized state text", async () => {
|
|
20
20
|
const Procs = loadProcsForPlatform("win32")
|
|
21
21
|
const procs = new Procs({})
|
|
22
22
|
const probed = []
|
|
@@ -28,8 +28,8 @@ test("Windows process parser only probes listening TCP rows", async () => {
|
|
|
28
28
|
|
|
29
29
|
const stdout = [
|
|
30
30
|
" Proto Local Address Foreign Address State PID",
|
|
31
|
-
" TCP 127.0.0.1:5173 0.0.0.0:0
|
|
32
|
-
" TCP 127.0.0.1:49153 127.0.0.1:5173
|
|
31
|
+
" TCP 127.0.0.1:5173 0.0.0.0:0 ABHOEREN 1111",
|
|
32
|
+
" TCP 127.0.0.1:49153 127.0.0.1:5173 HERGESTELLT 2222",
|
|
33
33
|
" TCP 0.0.0.0:7860 0.0.0.0:0 LISTENING 3333",
|
|
34
34
|
" TCP [::1]:11434 [::]:0 LISTENING 4444"
|
|
35
35
|
].join("\n")
|