Last active
January 9, 2021 11:14
-
-
Save rg443a/f1daf3e6f52a443c9e908f60b7988d52 to your computer and use it in GitHub Desktop.
ip2location visitor-blocker download [TSV]
This file contains hidden or 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
(async function() { | |
var cl = Array.from(document.getElementsByName("countryCodes[]")[0].options).map(v => v.value); | |
var a=[]; | |
console.log(cl); | |
for (var cn of cl) { | |
r = await fetch("https://www.ip2location.com/free/visitor-blocker", { | |
"headers": { | |
"content-type": "application/x-www-form-urlencoded", | |
}, | |
"referrer": "https://www.ip2location.com/free/visitor-blocker", | |
"body": `countryCodes%5B%5D=${cn}&version=4&format=peer-guardian-2&emailAddress=`, | |
"method": "POST", | |
"mode": "cors" | |
}); | |
var d = await r.text(); | |
var m=[...d.matchAll(/^(.+):(\d+\.\d+\.\d+\.\d+)-(\d+\.\d+\.\d+\.\d+)$/gim)]; | |
for (var x of m) | |
a.push ([x[2],x[3],cn,x[1]].join("\t")); | |
console.log(cn); | |
} | |
window.list1=a.join("\n");//document.body.innerHTML="<pre>"+a.join("\n")+"</pre>"; | |
console.log('done'); | |
download('ip2location-cc_'+(new Date().toISOString().substring(0, 10))+'.txt',a.join("\n")); | |
})() | |
function download(b,c){var a=document.createElement("a");a.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(c));a.setAttribute("download",b);a.style.display="none";document.body.appendChild(a);a.click();document.body.removeChild(a)}; | |
/* | |
https://lite.ip2location.com/ip-address-ranges-by-country | |
https://lite.ip2location.com/austria-ip-address-ranges | |
https://www.ip2location.com/free/visitor-blocker | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment