From 2cc2f311652381ac8f8bc06bd7a13ce6d25d2c7d Mon Sep 17 00:00:00 2001 From: Joren Date: Thu, 22 May 2025 14:41:10 +0200 Subject: [PATCH] first commit --- autologin.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 autologin.js diff --git a/autologin.js b/autologin.js new file mode 100644 index 0000000..ed986a7 --- /dev/null +++ b/autologin.js @@ -0,0 +1,34 @@ +// ==UserScript== +// @name Wazuh Auto-Login +// @namespace http://tampermonkey.net/ +// @version 1.0 +// @description Auto-login to Wazuh dashboard with read-only user +// @match https://192.168.168.96/* +// @grant none +// @run-at document-idle +// ==/UserScript== + +(function () { + const username = ""; + const password = ""; + + const tryLogin = () => { + const userInput = document.querySelector('input[aria-label="username_input"]'); + const passInput = document.querySelector('input[aria-label="password_input"]'); + const loginButton = document.querySelector('button[data-test-subj="submit"]'); + + if (userInput && passInput && loginButton) { + userInput.value = username; + userInput.dispatchEvent(new Event('input', { bubbles: true })); + passInput.value = password; + passInput.dispatchEvent(new Event('input', { bubbles: true })); + + setTimeout(() => loginButton.click(), 300); + } else { + setTimeout(tryLogin, 300); + } + }; + + tryLogin(); +})(); +