first commit
This commit is contained in:
		
							
								
								
									
										34
									
								
								autologin.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								autologin.js
									
									
									
									
									
										Normal file
									
								
							@@ -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();
 | 
			
		||||
})();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user