You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rizzlehash/RH_Main.cpp

91 lines
2.3 KiB

/*
* Copyright © 2015 Matthieu DUVAL, Rudy DUCHE
*
* This file is part of RizzleHash.
*
* RizzleHash is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RizzleHash is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RizzleHash. If not, see <http://www.gnu.org/licenses/>
*/
#include <iostream>
#include <thread>
#include <queue>
#include <time.h>
#include <mutex>
#include <unistd.h>
#include "include/RH_GUI.h"
#include "include/RH_ProcessBruteForce.h"
using namespace std;
int main(int argc,char ** argv)
{
mutex mtx;
GUI gui = GUI();
gui.displayCopyright();
gui.displayHeader();
//gui.displayShortHelp();
uint16_t nombreChoisi = 4;
queue<ProcessBruteForce::statReturn> q[nombreChoisi];
ProcessBruteForce bfArray[nombreChoisi];
thread threadArray[nombreChoisi];
for(int it = 0; it< nombreChoisi; it++)
{
bfArray[it].init(&q[it],it,nombreChoisi,"dc5fc7f9897dfa3eff22a1905ea70277","",10,true,"md5");
threadArray[it] = thread(bfArray[it]);
}
bool done = false;
uint16_t nbLignes = 0;
while(!done)
{
for(int it = 0; it< nombreChoisi; it++)
{
if(!q[it].empty())
{
if(nbLignes > 12)
{
nbLignes = 0;
gui.displayHeader();
}
nbLignes++;
ProcessBruteForce::statReturn sr = q[it].back();
uint32_t wordSecond = sr.totalWords / sr.nbSecond;
gui.displayProcessPerfs("localhost",sr.currentProcessName,wordSecond,sr.currentWord);
q[it].pop();
if(sr.isFound){
done = sr.isFound;
break;
}
}
}
usleep(2);// permert d'eviter de surcharger un coeur pour rien
}
for(int it = 0; it< nombreChoisi; it++)
{
threadArray[it].detach();
}
return 0;
}