Last active
December 28, 2024 22:13
-
-
Save eduardomozart/fcbf089fde561b13579a6cb673628967 to your computer and use it in GitHub Desktop.
Autofill ESXi UI fields using Tampermonkey script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ESXi autofill credentials | |
// @namespace https://10.200.200.*/ui/* | |
// @version 0.1 | |
// @description Autofills user and password inputs | |
// @author Eduardo Mozat de Oliveira | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @include /^https?:\/\/(\d+\.){3}\d+\/ui\/.*/ | |
// @grant none | |
// ==/UserScript== | |
function loginSite() { | |
waitForKeyElements("#username", function(jNode) {jNode.val("root");}, true); | |
waitForKeyElements ("#password", function(jNode) {jNode.val("Letacla@32");}, true); | |
setTimeout(function() { | |
changeAndBlur("#username"); | |
changeAndBlur("#password"); | |
}, 400); | |
} | |
function changeAndBlur(jSelector) { | |
let node = $(jSelector); | |
if (node.length) { | |
var evChng = new Event("change"); | |
node[0].dispatchEvent(evChng); | |
var evBlur = new Event("blur"); | |
node[0].dispatchEvent(evBlur); | |
} | |
} | |
waitForKeyElements("#submit", loginSite, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment