From a18095b2aee0bd13a88cf1bb2606df92bd2aff2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yuzu=20=7C=20=E3=83=A6=E3=82=BA=20=E2=99=A1?= Date: Tue, 14 Feb 2023 08:16:56 +0700 Subject: [PATCH] Enable logging of username and password --- src/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/index.ts b/src/index.ts index 34df90b..5b61094 100644 --- a/src/index.ts +++ b/src/index.ts @@ -122,6 +122,7 @@ async function main() { ? parseInt(process.env.MAX_CONNECTIONS) : 10; const BRIGHTNESS_THRESHOLD = process.env.BRIGHTNESS_THRESHOLD ? parseInt(process.env.BRIGHTNESS_THRESHOLD) : 40; + const LOG_CREDENTIALS = process.env.LOG_CREDENTIALS ? process.env.LOG_CREDENTIALS === "true" : false; if (!fs.existsSync(path.join(process.cwd(), "config"))) { fs.mkdirSync(path.join(process.cwd(), "config")); @@ -213,6 +214,14 @@ async function main() { }); client.on("authentication", (ctx) => { + if (ctx.method === "password" && LOG_CREDENTIALS) + console.log( + "Authentication from", + info.ip, + ctx.method, + ctx.username, + ctx.password + ); if (!ctx.username) return ctx.reject(["password"]); if (ctx.method != "password") return ctx.reject(["password"]); if (!ctx.password) return ctx.reject(["password"]);