Skip to content

Instantly share code, notes, and snippets.

@Glazomer
Created November 14, 2019 15:12
Show Gist options
  • Save Glazomer/0a2b6eba1583afd8fb47b9eee22dbb93 to your computer and use it in GitHub Desktop.
Save Glazomer/0a2b6eba1583afd8fb47b9eee22dbb93 to your computer and use it in GitHub Desktop.
const fetch = require('node-fetch'),
fs = require('fs');
function* randomString(length) {
const chars =
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
l = chars.length;
while (true) {
let result = '';
for (let i = length; i > 0; --i)
result += chars[Math.floor(Math.random() * l)];
yield result;
}
}
let i = 0,
err = 0,
l = 0;
const blackList = new RegExp(
[
'showcaptcha?',
'/vaucher/',
'/collections/',
'/apps/',
'/search/',
'/bus/',
'yandex.ru/lab/',
'yandex.ru/news/',
'yandex.ru/profile/',
'yandex.ru/jobs/',
'yandex.ru/maps/',
'yandex.ru/poll/',
'mobile.yandex.net/v1/ios/',
'trust.yandex.ru/',
'market.yandex.ru',
'health.yandex.ru',
'travel.yandex.ru',
'zapravki.yandex.ru',
'tanker.yandex.ru',
'talents.yandex.ru',
'forms.yandex.ru',
'music.yandex.ru',
'plus.yandex.ru',
'tv.yandex.ru',
'passport.yandex.ru',
'yandex.com.tr',
'play.google.com',
'apps.apple.com',
'kinopoisk.ru',
'facebook.com',
'beru.ru'
].join('|')
);
function dumpInfo(limit) {
l += limit;
for (let hash of randomString(5)) {
if (limit-- < 0) break;
fetch(`https://ya.cc/${hash}`)
.then(r => {
process.stdout.write(` checked (errors): ${++i} (${err}) of ${l}\r`);
if (r.status == 200) {
if (!blackList.test(r.url))
fs.appendFile('./urls.txt', r.url + '\n', function() {});
if (r.url.includes('code.')) {
console.log(r.url + '\n');
}
}
})
.catch(() =>
process.stdout.write(` checked (errors): ${i} (${++err}) of ${l}\r`)
);
}
}
setInterval(() => dumpInfo(600), 6 * 1000);
dumpInfo(600);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment