Fix MITM
This commit is contained in:
+3
-2
@@ -15,6 +15,7 @@ const { installCert, uninstallCert } = require("./cert/install");
|
||||
const { isCertExpired } = require("./cert/rootCA");
|
||||
const { DATA_DIR, MITM_DIR } = require("./paths");
|
||||
const { log, err } = require("./logger");
|
||||
const { LSOF_BIN } = require("./config");
|
||||
|
||||
const DEFAULT_MITM_ROUTER_BASE = "http://localhost:20128";
|
||||
|
||||
@@ -108,7 +109,7 @@ function getProcessUsingPort443() {
|
||||
if (processMatch) return processMatch[1].replace(".exe", "");
|
||||
}
|
||||
} else {
|
||||
const result = execSync("lsof -i :443", { encoding: "utf8", windowsHide: true });
|
||||
const result = execSync(`${LSOF_BIN} -i :443`, { encoding: "utf8", windowsHide: true });
|
||||
const lines = result.trim().split("\n");
|
||||
if (lines.length > 1) return lines[1].split(/\s+/)[0];
|
||||
}
|
||||
@@ -298,7 +299,7 @@ function getPort443Owner(sudoPassword) {
|
||||
});
|
||||
} else {
|
||||
// Only find process actually LISTENING on TCP port 443
|
||||
exec("lsof -nP -iTCP:443 -sTCP:LISTEN -t", { windowsHide: true }, (err, stdout) => {
|
||||
exec(`${LSOF_BIN} -nP -iTCP:443 -sTCP:LISTEN -t`, { windowsHide: true }, (err, stdout) => {
|
||||
if (err || !stdout?.trim()) return resolve(null);
|
||||
const pid = parseInt(stdout.trim().split("\n")[0], 10);
|
||||
if (!pid || isNaN(pid)) return resolve(null);
|
||||
|
||||
Reference in New Issue
Block a user