Skip to content

Instantly share code, notes, and snippets.

@ssaavedra
Last active March 19, 2018 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaavedra/a2069c37479459cadc0ce3d1859e8f36 to your computer and use it in GitHub Desktop.
Save ssaavedra/a2069c37479459cadc0ce3d1859e8f36 to your computer and use it in GitHub Desktop.
Fix Vodafone's router UI to be able to auto-fill the user/password again
// ==UserScript==
// @name Fix dumb "new" Vodafone router page
// @namespace http://192.168.1.1//
// @include /http:\/\/(192\.168|10\.(\d{1,3})|172\.(\d+))\.(\d+).1\/login.html/
// @license https://opensource.org/licenses/MIT
// @grant none
// ==/UserScript==
// Uses a regex so that your router can be configured on any local IP.
/*
This fixes the router's login page so that it includes "id" and "username" on both username and password
fields (I'm using its CSS selector to get them) so that KeePass/1Password/LastPass/etc can grab the fields
and auto-fill them.
*/
(function(window, document) {
window.addEventListener('load', function() {
if(document.querySelector("#info > span:nth-child(1)").textContent.match(/VOX25-v3.4.02/)) {
const udiv = document.querySelector("div.row:nth-child(2) > div:nth-child(1) > input:nth-child(1)")
const pdiv = document.querySelector("div.row:nth-child(3) > div:nth-child(1) > input:nth-child(1)")
udiv.setAttribute("id", "username")
udiv.setAttribute("name", "username")
pdiv.setAttribute("id", "password")
pdiv.setAttribute("name", "password")
} else {
// Silently fail. Otherwise:
// alert("UserScript alert: Please check the Vodafone router userscript and adapt for version changes")
}
})
})(window, document)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment