Created
November 12, 2020 06:29
-
-
Save shizeeg/6c7b607bb36ebdd4460dea51623b410a to your computer and use it in GitHub Desktop.
a script for Tampermonkey to update IPs on freenom's managedns page
This file contains 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 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