Google IP ranges for RouterOS
require("axios");
/*
* Google IPv4 and IPv6 ranges as RouterOS 'address-list' commands.
* Paste the result into your MikroTik Routerboard RouterOS console.
*
* source: https://support.google.com/a/answer/10026322
*
* Made with ❤️ in 2021 by 🇨🇿 vpithart
*/
var axios = require('axios');
async function routeros_commands_for_google_ip_addresses() {
let googjson = await axios.get('https://www.gstatic.com/ipranges/goog.json').then(response => {
return response.data;
})
let commands = [
'# Google IPv4 and IPv6 ranges as RouterOS address-list commands. Paste the result into your MikroTik Routerboard RouterOS console.',
'# Made with in 2021 by vpithart -- source: https://support.google.com/a/answer/10026322',
'/ip firewall address-list remove [/ip firewall address-list find list="goog"];',
'/ipv6 firewall address-list remove [/ipv6 firewall address-list find list="goog"];'
];
for (pr of googjson.prefixes) {
if (pr.ipv4Prefix) commands.push(`/ip firewall address-list add list="goog" address="${pr.ipv4Prefix}";`);
if (pr.ipv6Prefix) commands.push(`/ipv6 firewall address-list add list="goog" address="${pr.ipv6Prefix}";`);
};
return commands.join("\n");
}
exports.endpoint = async function(request, response) {
response.end(await routeros_commands_for_google_ip_addresses());
}
routeros_commands_for_google_ip_addresses()
no comments