Commit 5a71353a authored by Mathieu Valois's avatar Mathieu Valois
Browse files

default threads number, fix percentage display

parent 33d4263b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void setFilename(const std::string& filename);

    void setThreads(const int& nb_threads);


public slots:
+1 −5
Original line number Diff line number Diff line
@@ -281,8 +281,6 @@ int Statsgen::generate_stats() {
		return 0;
	}

	cout << "total counter " << total_counter << endl;

	return 1;
}

@@ -463,10 +461,8 @@ Container analyze_password(const string & password, SecurityRules & sr, const in
	char last_simplemask = 'a';
	int sizeAdvancedMask = 0;
	int sizeSimpleMask = 0;
	wchar_t letter;

	for (int i=0; i < c.pass_length; i++) {
		letter = password[i];
	for(wchar_t letter: password){
		analyse_letter(letter, last_simplemask, c.simplemask_string, c.advancedmask_string, c.pol, sizeAdvancedMask, sizeSimpleMask);
	}

+4 −1
Original line number Diff line number Diff line
@@ -9,8 +9,10 @@
 * Please see the attached LICENSE file for additional licensing information.
 */

#include "mainwindow.h"
#include <QApplication>
#include <thread>

#include "mainwindow.h"

int main(int argc, char *argv[])
{
@@ -21,5 +23,6 @@ int main(int argc, char *argv[])
    if(argc >= 2){
    	w.setFilename(argv[1]);
    }
    w.setThreads(std::thread::hardware_concurrency());
    return a.exec();
}
+6 −2
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ void MainWindow::setFilename(const string& filename){
    ui->fileLine->setText(QString::fromStdString(filename));
}

void MainWindow::setThreads(const int& nb_threads){
    ui->threadNumberSpin->setValue(nb_threads);
}


MainWindow::~MainWindow()
{
@@ -306,10 +310,10 @@ void MainWindow::handleResults()
                               + QString::number(stats.getTotalFilter(), 'g', 2)
                               + " on a total of "
                               + QString::number(stats.getTotalFilter(), 'g', 2)
                               + " passwords (" + QString::number(percentageTotal, 'g', 1) + "%)");
                               + " passwords (" + QString::number(percentageTotal) + "%)");


    ui->securityLabel->setText("--> " + QString::number(percentageSecurity, 'g', 2)
    ui->securityLabel->setText("--> " + QString::number(percentageSecurity)
                               + "% of the passwords respects the security rules");

    stats.print_stats();