SHOW:
|
|
- or go back to the newest paste.
| 1 | - | var regex = /<td.*?><a class="flag flag-([a-z]{2})" href=".*?">AS(\d+)<\/a>(.*?)<\/td>[\s\S].*<td.*?>([\d,]+)<\/td>/gmi;
|
| 1 | + | (async function() {
|
| 2 | - | var str = document.body.innerHTML; |
| 2 | + | var a = []; |
| 3 | - | var m,a=[]; |
| 3 | + | for (var i = 1; i < 20; i++) {
|
| 4 | var r = await fetch("https://ipinfo.io/hosting/" + i);
| |
| 5 | - | while ((m = regex.exec(str)) !== null) {
|
| 5 | + | var d = await r.text(); |
| 6 | - | // This is necessary to avoid infinite loops with zero-width matches |
| 6 | + | var m = [...d.matchAll(/<td.*?><a class="flag flag-([a-z]{2})" href=".*?">AS(\d+)<\/a>(.*?)<\/td>[\s\S].*<td.*?>([\d,]+)<\/td>/gim)];
|
| 7 | - | if (m.index === regex.lastIndex) {
|
| 7 | + | for (var x of m) |
| 8 | - | regex.lastIndex++; |
| 8 | + | a.push([x[2], x[3], x[1], x[4].replace(/,/g, '')].join("\t"));
|
| 9 | - | } |
| 9 | + | console.log(i); |
| 10 | - | //console.log (m[2],m[3],m[1],m[4].replace(/,/g,'')); |
| 10 | + | } |
| 11 | - | a.push([m[2],m[3],m[1],m[4].replace(/,/g,'')].join("\t"));
|
| 11 | + | window.list1 = a.join("\n"); //document.body.innerHTML="<pre>"+a.join("\n")+"</pre>";
|
| 12 | - | } |
| 12 | + | console.log('done');
|
| 13 | - | document.body.innerHTML="";var pre=document.createElement("pre");pre.innerHTML=a.join("\n");document.body.appendChild(pre);
|
| 13 | + | download('hosted-domains-by-asn.txt', a.join("\n"));
|
| 14 | document.body.innerHTML = ""; | |
| 15 | - | // https://ipinfo.io/hosting/1 |
| 15 | + | var pre = document.createElement("pre");
|
| 16 | pre.innerHTML = a.join("\n");
| |
| 17 | document.body.appendChild(pre); | |
| 18 | ||
| 19 | })() | |
| 20 | ||
| 21 | function download(b, c) {
| |
| 22 | var a = document.createElement("a");
| |
| 23 | a.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(c));
| |
| 24 | a.setAttribute("download", b);
| |
| 25 | a.style.display = "none"; | |
| 26 | document.body.appendChild(a); | |
| 27 | a.click(); | |
| 28 | document.body.removeChild(a) | |
| 29 | }; | |
| 30 |