Skip to content

Instantly share code, notes, and snippets.

@6ixfalls
Created April 9, 2023 19:33
Show Gist options
  • Save 6ixfalls/f5e92ade0bb9820fc80f8aa65f8e7644 to your computer and use it in GitHub Desktop.
Save 6ixfalls/f5e92ade0bb9820fc80f8aa65f8e7644 to your computer and use it in GitHub Desktop.
BuyVM Stallion IP Range/Cloudflare Allowlist
let ipsString = `173.245.48.0/20
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
141.101.64.0/18
108.162.192.0/18
190.93.240.0/20
188.114.96.0/20
197.234.240.0/22
198.41.128.0/17
162.158.0.0/15
104.16.0.0/13
104.24.0.0/14
172.64.0.0/13
131.0.72.0/22`; // paste https://www.cloudflare.com/ips-v4
let ports = [80, 443];
let descs = {
"80": "HTTP",
"443": "HTTPS"
};
let ips = ipsString.split("\n");
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
const ipaddressid = new URL(document.URL).pathname.split("/").pop();
for (let i = 0; i < ports.length; i++) {
let port = ports[i];
for (let sn = 0; sn < ips.length; sn++) {
let subnet = ips[sn];
$.ajax({
method: "POST",
url: "https://manage.buyvm.net/ajax/firewall/addrule",
data: {
ipaddressid: Number(ipaddressid),
step: 2,
description: descs[port.toString()],
protocol: "tcp",
srcnet: subnet,
srcport: "0",
dstport: port,
action: "allow"
}
})
.done(r => {
console.log(descs[port.toString()], subnet, port, r);
})
await sleep(2000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment