Advertisement
rg443

ip2location > visitor-blocker > TSV download

Aug 24th, 2020 (edited)
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (async function() {
  2.   var cl = Array.from(document.getElementsByName("countryCodes[]")[0].options).map(v => v.value);
  3.   var a=[];
  4.   console.log(cl);
  5.   for (var cn of cl) {
  6.     r = await fetch("https://www.ip2location.com/free/visitor-blocker", {
  7.       "headers": {
  8.         "content-type": "application/x-www-form-urlencoded",
  9.       },
  10.       "referrer": "https://www.ip2location.com/free/visitor-blocker",
  11.       "body": `countryCodes%5B%5D=${cn}&version=4&format=peer-guardian-2&emailAddress=`,
  12.       "method": "POST",
  13.       "mode": "cors"
  14.     });
  15.     var d = await r.text();
  16.     var m=[...d.matchAll(/^(.+):(\d+\.\d+\.\d+\.\d+)-(\d+\.\d+\.\d+\.\d+)$/gim)];
  17.     for (var x of m)
  18.     a.push ([x[2],x[3],cn,x[1]].join("\t"));
  19.     console.log(cn);
  20.   }
  21.  window.list1=a.join("\n");//document.body.innerHTML="<pre>"+a.join("\n")+"</pre>";
  22.   console.log('done');
  23.   download('ip2location-cc.txt',a.join("\n"));
  24. })()
  25. 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)};
  26.  
  27. /*
  28. https://lite.ip2location.com/ip-address-ranges-by-country
  29. https://lite.ip2location.com/austria-ip-address-ranges
  30. https://www.ip2location.com/free/visitor-blocker
  31.  
  32. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement