chore: UPdate the shell

This commit is contained in:
BluJ
2023-04-07 15:06:55 -06:00
parent 90aa314633
commit 4efa94ec10
6 changed files with 17 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
import { Effects } from "../../types";
import { parseCommand } from "../../util/parseCommand";
import { CheckResult } from "./CheckResult";
export function containsAddress(x: string, port: number) {
const readPorts = x
@@ -25,8 +26,14 @@ export async function checkPortListening(
} = {}
): Promise<CheckResult> {
const hasAddress =
containsAddress(await effects.shell("cat /proc/net/tcp"), port) ||
containsAddress(await effects.shell("cat /proc/net/udp"), port);
containsAddress(
await effects.runCommand(parseCommand("cat /proc/net/tcp")),
port
) ||
containsAddress(
await effects.runCommand(parseCommand("cat /proc/net/udp")),
port
);
if (hasAddress) {
return { status: "passing", message };
}