Skip to content

Instantly share code, notes, and snippets.

@shizeeg
Created November 12, 2020 06:29
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 shizeeg/6c7b607bb36ebdd4460dea51623b410a to your computer and use it in GitHub Desktop.
Save shizeeg/6c7b607bb36ebdd4460dea51623b410a to your computer and use it in GitHub Desktop.
a script for Tampermonkey to update IPs on freenom's managedns page
// ==UserScript==
// @name freenom fillup IP
// @namespace https://my.freenom.com/
// @version 0.1
// @description fill up IPs
// @author Shizeeg Unadequatov <shizeeque (at) gmail.com>
// @match https://my.freenom.com/clientarea.php?managedns=
// @grant none
// ==/UserScript==
/* eslint-env jquery */
(function() {
'use strict';
$.get('https://api.ipify.org', function(ipv4) {
$.get('https://api6.ipify.org', function(ipv6) {
ipv6 = ipv6.slice(0,19) + "::1";
main(ipv4, ipv6);
});
});
})();
function main(ipv4, ipv6) {
console.log("main(" + ipv4 + ", [" + ipv6 + "])");
document.querySelectorAll('#recordslistform > table > tbody > tr > td.value_column > p > input[type=text]').forEach(function(e) {
if (typeof ipv4 !== 'underfined' && typeof ipv6 !== 'undefined') {
let value = e.getAttribute('value').includes(":") ? ipv6 : ipv4;
e.setAttribute('value', value);
console.log("set ", e.getAttribute('value'), "to ", value);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment