C++ Multithreaded Bruteforce Base

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
Here's a little base for a multi threaded scanner, bruteforce program or whatever you want it to be.
I wanted todo an multi threaded rcon bruteforcer, but i was too lazy and [member=1371].silent[/member] was too lazy to answer me properly so he could do it.

// 0X688 - UGBASE.EU
// btw, this base sucks there are better ways (but it's functional) x.x

#include <Windows.h>
#include <iostream>
#include <stddef.h>
#include <vector>

std::vector<std::string> password_list;
std::vector < std::vector<std::string> > thread_password_list;
const int iProcessingThreads = 4;
HANDLE *dwThreads;
typedef struct ThreadData {
int iOwnID;
std::vector<std::string> *p_List;
} THREADData, *PThreadData;


// Threading happens here / actual code.

DWORD WINAPI WorkerThread ( LPVOID params )
{
PThreadData data = (PThreadData)params;
int iListSize =  data->p_List->size();
DWORD iLastReport = GetTickCount();
printf ( "Thread %i started passwords to process: %i\n", data->iOwnID, iListSize );

for ( int it = 0; it != iListSize; it++ )
{
std::string password = data->p_List->at ( it );

//printf("THREAD %i - Testing Password: %s\n", data->iOwnID, password.c_str() );

if ( GetTickCount()-iLastReport > 5000 )
{
printf("THREAD %i - %i/%i passwords checked.\n", data->iOwnID, it, iListSize );
iLastReport = GetTickCount();
}

Sleep ( 100 ); // cool down the cpu maaan!
}

return 0;
}

//

int main()
{
for ( int it = 0; it != 859; it ++ )
password_list.push_back ( "Test.");

int iListSize = password_list.size();
int iPWSPerList = iListSize/iProcessingThreads;

if ( !iPWSPerList ) // list is pretty small or you have an insane amount of threads.
iPWSPerList = 1;

for ( int it = 0; it != iProcessingThreads; it ++ )
{
std::vector<std::string> list;
int iPWSAllocated = iPWSPerList;

if ( iPWSAllocated > (iListSize=password_list.size()) )
iPWSAllocated = iListSize;

printf("Thread %i:\n", it);

list.reserve(iPWSAllocated);
for ( int i = 0; i != iPWSAllocated; i ++ )
list.push_back(std::string());

std::copy_n(std::next(std::begin(password_list), 0), iPWSAllocated, std::begin(list));
password_list.erase(password_list.begin(), password_list.begin()+iPWSAllocated);

printf("-> %i Passwords\n", list.size());

thread_password_list.push_back ( list );
}

// Copy leftovers to the last thread.
int iPasswordsLeft = password_list.size();
for ( int i = 0; i != iPasswordsLeft; i ++ )
thread_password_list [ thread_password_list.size()-1 ].push_back(std::string());
std::copy_n(std::next(std::begin(password_list), 0), iPasswordsLeft, std::begin(thread_password_list [ thread_password_list.size()-1 ]));
printf("%i Passwords were left assigned them to the last thread.\n", iPasswordsLeft);
password_list.clear();

printf("----------------------------------------------\n");
printf("Starting Threads\n");
printf("----------------------------------------------\n");
// Start threads, assign pointers etc.
dwThreads = new HANDLE [ iProcessingThreads ];
DWORD dwThreadID;

for ( int it = 0; it != iProcessingThreads; it ++ )
{
PThreadData data = (PThreadData)alloca(sizeof(THREADData));
data->iOwnID = it;
data->p_List = &thread_password_list[it];
dwThreads [ it ] = CreateThread ( NULL, NULL, WorkerThread, data, NULL, &dwThreadID );
}


getchar();
return 0;
}
 

.silent

Well-known member
Joined
Apr 14, 2013
Messages
339
Reaction score
13
Faek negEr
I also thought about making a multi threaded RCON bruter with GUI (.NET or Qt) where you could just click + and add a new attack, the state would be saved etc.
Maybe i'll make it some time, I have lots of things to do at the moment xd
BTW i also prefer these old school C threads rather than those shits from std, I've once used threads from .NET in one app just to avoid some shits with unmanaged functions in managed classes, but I didn't like it xd
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
love it..

I like the idea of using vectors, although don't you think rcon bruteforcing is gay?
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
T3K link said:
love it..

I like the idea of using vectors, although don't you think rcon bruteforcing is gay?
well in combination with curl or winsockets it can be used to bruteforce all kind of things (mostly brazzers accounts if they got no 3xlogin tries per minute or smth laik that).
 

BBB

Active member
Joined
Apr 5, 2013
Messages
62
Reaction score
1
just a little thought:
if people use "random" passwort of alphanumeric characters "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
and the password has a length <=6, so you have 62^6 possible words  :sweet_jesus:
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
BBB link said:
just a little thought:
if people use "random" passwort of alphanumeric characters "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
and the password has a length <=6, so you have 62^6 possible words  :sweet_jesus:
huh? the length of the string doesn't matters.
 

Pinii

Active member
Joined
Sep 18, 2013
Messages
126
Reaction score
0
What program should I use to compilate?  :surprised:
 
Top