Loading GUI/GUI.pro +2 −9 Changes for GUI/GUI.pro: 2 added lines, 9 removed lines. Original line number Diff line number Diff line #------------------------------------------------- # # Project created by QtCreator 2018-01-10T12:47:54 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets QT += widgets QT += charts TARGET = GUI TEMPLATE = app Loading GUI/GUI.pro.user +14 −8 Changes for GUI/GUI.pro.user: 14 added lines, 8 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> <!-- Written by QtCreator 3.5.1, 2018-01-31T11:42:43. --> <!-- Written by QtCreator 4.5.0, 2018-02-07T17:04:56. --> <qtcreator> <data> <variable>EnvironmentId</variable> <value type="QByteArray">{da6987d4-31c4-4f3d-a60d-58ce3b5634b9}</value> <value type="QByteArray">{02a7caed-4b6b-495d-8fef-b11555302a3f}</value> </data> <data> <variable>ProjectExplorer.Project.ActiveTarget</variable> Loading Loading @@ -40,6 +40,7 @@ <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> <value type="bool" key="EditorConfiguration.ShowMargin">false</value> <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> <value type="int" key="EditorConfiguration.TabSize">8</value> Loading @@ -60,12 +61,12 @@ <valuemap type="QVariantMap"> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{1490749a-bd0b-472a-9ead-4692066d8a49}</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{4457406e-e5e6-438e-9e2a-610fde4151e0}</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/kael/Projet/Statistiques/build-GUI-Desktop-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/jorand/Documents/Projet_3A/Statistiques/build-GUI-Desktop-Debug</value> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> Loading @@ -73,7 +74,6 @@ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> Loading Loading @@ -126,7 +126,7 @@ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> </valuemap> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/kael/Projet/Statistiques/build-GUI-Desktop-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/jorand/Documents/Projet_3A/Statistiques/build-GUI-Desktop-Release</value> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> Loading @@ -134,7 +134,6 @@ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> Loading Loading @@ -202,6 +201,11 @@ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">0</value> <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> Loading Loading @@ -240,12 +244,14 @@ <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">GUI</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/kael/Projet/Statistiques/GUI/GUI.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/jorand/Documents/Projet_3A/Statistiques/GUI/GUI.pro</value> <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">GUI.pro</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/jorand/Documents/Projet_3A/Statistiques/build-GUI-Desktop-Debug</value> <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> Loading GUI/mainwindow.cpp +58 Changes for GUI/mainwindow.cpp: 58 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include <QFileDialog> #include <QTextStream> #include <iostream> #include <QtCharts> Loading Loading @@ -164,7 +165,64 @@ void MainWindow::disableWithCount() void MainWindow::handleResults() { waitBox.close(); QBarSeries * barLength = new QBarSeries(); QPieSeries * pieCharset = new QPieSeries(); double percentageTotal, percentageSecurity, total_counter, total_filter; stats->initGraphicalStats(barLength, pieCharset, percentageTotal, percentageSecurity, total_counter, total_filter); /* HISTOGRAM FOR LENGTH */ QChart *chartL = new QChart(); chartL->addSeries(barLength); chartL->setTitle("Length"); QChartView *chartViewL = new QChartView(chartL); chartViewL->setRenderHint(QPainter::Antialiasing); auto layoutL = new QVBoxLayout(); layoutL->addWidget(chartViewL); ui->lengthWidget->setLayout(layoutL); /* PIECHART FOR CHARSET */ pieCharset->setLabelsVisible(); QPieSlice *slice = pieCharset->slices().at(1); slice->setExploded(); slice->setLabelVisible(); slice->setPen(QPen(Qt::darkGreen, 2)); slice->setBrush(Qt::green); QChart *chartC = new QChart(); chartC->addSeries(pieCharset); chartC->setTitle("Charset"); chartC->legend()->hide(); QChartView *chartViewC = new QChartView(chartC); chartViewC->setRenderHint(QPainter::Antialiasing); auto layoutC = new QVBoxLayout(); layoutC->addWidget(chartViewC); ui->charsetWidget->setLayout(layoutC); /* LABELS */ ui->AnalyzedLabel->setText("Number of analyzed passwords: " + QString::number(total_filter) + " on a total of " + QString::number(total_counter) + " passwords (" + QString::number(percentageTotal, 'f', 2) + "%)"); ui->securityLabel->setText(QString::number(percentageSecurity, 'f', 2) + "% of the passwords respects the security rules"); stats->print_stats(); ui->resultLabel->setText("For more detailed statistics, check the file \"result.txt\""); } GUI/mainwindow.ui +95 −30 Changes for GUI/mainwindow.ui: 95 added lines, 30 removed lines. Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> <width>943</width> <height>701</height> <width>1300</width> <height>800</height> </rect> </property> <property name="sizePolicy"> Loading @@ -21,14 +21,14 @@ </property> <property name="minimumSize"> <size> <width>943</width> <height>701</height> <width>1300</width> <height>800</height> </size> </property> <property name="maximumSize"> <size> <width>943</width> <height>701</height> <width>1300</width> <height>800</height> </size> </property> <property name="windowTitle"> Loading @@ -40,8 +40,8 @@ <rect> <x>20</x> <y>20</y> <width>901</width> <height>601</height> <width>1260</width> <height>711</height> </rect> </property> <layout class="QHBoxLayout" name="horizontalLayout"> Loading Loading @@ -76,13 +76,6 @@ </property> </widget> </item> <item row="3" column="0" colspan="2"> <widget class="QPushButton" name="startButton"> <property name="text"> <string>Start</string> </property> </widget> </item> <item row="0" column="2"> <widget class="QPushButton" name="Browser"> <property name="text"> Loading @@ -98,8 +91,8 @@ <widget class="QWidget" name="gridLayoutWidget_2"> <property name="geometry"> <rect> <x>66</x> <y>30</y> <x>40</x> <y>40</y> <width>321</width> <height>189</height> </rect> Loading Loading @@ -184,10 +177,10 @@ <widget class="QWidget" name="gridLayoutWidget_3"> <property name="geometry"> <rect> <x>70</x> <y>30</y> <x>30</x> <y>50</y> <width>321</width> <height>161</height> <height>174</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_3"> Loading @@ -198,13 +191,6 @@ </property> </widget> </item> <item row="0" column="0"> <widget class="QLabel" name="lengthLabel"> <property name="text"> <string>Min Length</string> </property> </widget> </item> <item row="1" column="0"> <widget class="QLabel" name="specialLabel"> <property name="text"> Loading Loading @@ -261,17 +247,31 @@ </property> </widget> </item> <item row="0" column="0"> <widget class="QLabel" name="lengthLabel"> <property name="text"> <string>Min Length</string> </property> </widget> </item> </layout> </widget> </widget> </item> <item row="3" column="0" colspan="3"> <widget class="QPushButton" name="startButton"> <property name="text"> <string>Start</string> </property> </widget> </item> </layout> </item> <item> <widget class="QFrame" name="resultFrame"> <property name="minimumSize"> <size> <width>450</width> <width>830</width> <height>0</height> </size> </property> Loading @@ -281,6 +281,71 @@ <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> <widget class="QLabel" name="AnalyzedLabel"> <property name="geometry"> <rect> <x>20</x> <y>10</y> <width>791</width> <height>17</height> </rect> </property> <property name="text"> <string/> </property> </widget> <widget class="QLabel" name="securityLabel"> <property name="geometry"> <rect> <x>100</x> <y>30</y> <width>711</width> <height>20</height> </rect> </property> <property name="text"> <string/> </property> </widget> <widget class="QLabel" name="resultLabel"> <property name="geometry"> <rect> <x>290</x> <y>680</y> <width>531</width> <height>20</height> </rect> </property> <property name="text"> <string/> </property> </widget> <widget class="QWidget" name="lengthWidget" native="true"> <property name="geometry"> <rect> <x>0</x> <y>60</y> <width>830</width> <height>271</height> </rect> </property> <property name="minimumSize"> <size> <width>800</width> <height>0</height> </size> </property> </widget> <widget class="QWidget" name="charsetWidget" native="true"> <property name="geometry"> <rect> <x>0</x> <y>340</y> <width>830</width> <height>341</height> </rect> </property> </widget> </widget> </item> </layout> Loading @@ -291,8 +356,8 @@ <rect> <x>0</x> <y>0</y> <width>943</width> <height>25</height> <width>1300</width> <height>22</height> </rect> </property> </widget> Loading GUI/statsgen.cpp +81 −26 Changes for GUI/statsgen.cpp: 81 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -13,11 +13,14 @@ #include <vector> #include <thread> #include <pthread.h> #include <QFile> #include "statsgen.h" #include "utils.h" #include <QFile> #include <QString> using namespace std; Loading Loading @@ -223,58 +226,111 @@ void Statsgen::print_stats() { int count; float perc = (float) 100 * (total_filter / total_counter); wcout << "\n\tSelected " << total_filter << " on " << total_counter << " passwords\t(" wofstream writeFile("result.txt"); writeFile << "\n\tSelected " << total_filter << " on " << total_counter << " passwords\t(" << perc << " %)" << endl; wcout << "\nSecurity rules : " << endl; wcout << "\tMinimal length of a password: " << minLength << endl; wcout << "\tMinimum of special characters in a password: " << minSpecial << endl; wcout << "\tMinimum of digits in a password: " << minDigit << endl; wcout << "\tMinimum of lower characters in a password: " << minLower << endl; wcout << "\tMinimum of upper characters in a password: " << minUpper << endl; writeFile << "\nSecurity rules : " << endl; writeFile << "\tMinimal length of a password: " << minLength << endl; writeFile << "\tMinimum of special characters in a password: " << minSpecial << endl; writeFile << "\tMinimum of digits in a password: " << minDigit << endl; writeFile << "\tMinimum of lower characters in a password: " << minLower << endl; writeFile << "\tMinimum of upper characters in a password: " << minUpper << endl; float perce = (float) 100 * (nbSecurePassword / total_counter); wcout << "\n\t\t--> " << nbSecurePassword << " passwords\t(" << perce << " %) respect the security rules\n" << endl; writeFile << "\n\t\t--> " << nbSecurePassword << " passwords\t(" << perce << " %) respect the security rules\n" << endl; wcout << "\nmin - max\n" << endl; wcout << setw(43) << right << "digit: " writeFile << "\nmin - max\n" << endl; writeFile << setw(43) << right << "digit: " << setw(2) << right << minMaxValue.mindigit << " - " << minMaxValue.maxdigit << endl; wcout << setw(43) << right << "lower: " writeFile << setw(43) << right << "lower: " << setw(2) << right << minMaxValue.minlower << " - " << minMaxValue.maxlower << endl; wcout << setw(43) << right << "upper: " writeFile << setw(43) << right << "upper: " << setw(2) << right << minMaxValue.minupper << " - " << minMaxValue.maxupper << endl; wcout << setw(43) << right << "special: " writeFile << setw(43) << right << "special: " << setw(2) << right << minMaxValue.minspecial << " - " << minMaxValue.maxspecial << endl; wcout << "\nStatistics relative to length: \n" << endl; showMap(stats_length, top, total_counter, hiderare, count); writeFile << "\nStatistics relative to length: \n" << endl; showMap(writeFile, stats_length, top, total_counter, hiderare, count); wcout << "\nStatistics relative to charsets: \n" << endl; showMap(stats_charactersets, -1, total_counter, hiderare, count); writeFile << "\nStatistics relative to charsets: \n" << endl; showMap(writeFile, stats_charactersets, -1, total_counter, hiderare, count); wcout << "\nStatistics relative to simplemasks: \n" << endl; showMap(stats_simplemasks, top, total_counter, hiderare, count); writeFile << "\nStatistics relative to simplemasks: \n" << endl; showMap(writeFile, stats_simplemasks, top, total_counter, hiderare, count); if (limitSimplemask > 0) { wcout << endl; readResult(stats_simplemasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); readResult(writeFile, stats_simplemasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); } wcout << "\nStatistics relative to advancedmask: \n" << endl; showMap(stats_advancedmasks, top, total_counter, hiderare, count); writeFile << "\nStatistics relative to advancedmask: \n" << endl; showMap(writeFile, stats_advancedmasks, top, total_counter, hiderare, count); if (limitAdvancedmask > 0) { wcout << endl; readResult(stats_advancedmasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); readResult(writeFile, stats_advancedmasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); } } void Statsgen::initGraphicalStats(QBarSeries * barLength, QPieSeries * pieCharset, double & percentageTotal, double & percentageSecurity, double & total, double & filter) { total = total_counter; filter = total_filter; percentageTotal = (double) 100 * (total_filter / total_counter); percentageSecurity = (double) 100 * (nbSecurePassword / total_counter); /* LENGTH HISTOGRAM */ multimap<double, int> reverseL = flip_map<int>(stats_length); double percentageL; double nbHideL = 0; MapIterator<double, int> itL; for(itL = reverseL.end(); itL != reverseL.begin(); itL--) { if (itL == reverseL.end()) continue; percentageL = (double) (100*itL->first) / total_counter; if (percentageL >= 2) { QBarSet *set = new QBarSet(QString::number(itL->second)); *set << itL->first; barLength->append(set); } else { nbHideL += itL->first; } } QBarSet *set = new QBarSet("Other lengths"); *set << nbHideL; barLength->append(set); /* CHARSET PIECHART */ multimap<double, wstring> reverseC = flip_map<wstring>(stats_charactersets); int top = 0; double nbHideC = 0; MapIterator<double, wstring> itC; for(itC = reverseC.end(); itC != reverseC.begin(); itC--) { if (itC == reverseC.end()) continue; top++; if (top <= 5) { pieCharset->append(QString::fromStdWString(itC->second), itC->first); } else { nbHideC += itC->first; } } pieCharset->append("Other charsets", nbHideC); } Loading Loading @@ -430,7 +486,6 @@ void updateMinMax(minMax & minMaxValue, const Policy & pol) { void * generate_stats_thread(void * threadarg) { struct thread_data *my_data; my_data = (struct thread_data *) threadarg; Loading Loading
GUI/GUI.pro +2 −9 Changes for GUI/GUI.pro: 2 added lines, 9 removed lines. Original line number Diff line number Diff line #------------------------------------------------- # # Project created by QtCreator 2018-01-10T12:47:54 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets QT += widgets QT += charts TARGET = GUI TEMPLATE = app Loading
GUI/GUI.pro.user +14 −8 Changes for GUI/GUI.pro.user: 14 added lines, 8 removed lines. Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> <!-- Written by QtCreator 3.5.1, 2018-01-31T11:42:43. --> <!-- Written by QtCreator 4.5.0, 2018-02-07T17:04:56. --> <qtcreator> <data> <variable>EnvironmentId</variable> <value type="QByteArray">{da6987d4-31c4-4f3d-a60d-58ce3b5634b9}</value> <value type="QByteArray">{02a7caed-4b6b-495d-8fef-b11555302a3f}</value> </data> <data> <variable>ProjectExplorer.Project.ActiveTarget</variable> Loading Loading @@ -40,6 +40,7 @@ <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> <value type="bool" key="EditorConfiguration.ShowMargin">false</value> <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> <value type="int" key="EditorConfiguration.TabSize">8</value> Loading @@ -60,12 +61,12 @@ <valuemap type="QVariantMap"> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{1490749a-bd0b-472a-9ead-4692066d8a49}</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{4457406e-e5e6-438e-9e2a-610fde4151e0}</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/kael/Projet/Statistiques/build-GUI-Desktop-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/jorand/Documents/Projet_3A/Statistiques/build-GUI-Desktop-Debug</value> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> Loading @@ -73,7 +74,6 @@ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> Loading Loading @@ -126,7 +126,7 @@ <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> </valuemap> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/kael/Projet/Statistiques/build-GUI-Desktop-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/jorand/Documents/Projet_3A/Statistiques/build-GUI-Desktop-Release</value> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> Loading @@ -134,7 +134,6 @@ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> Loading Loading @@ -202,6 +201,11 @@ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">0</value> <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> Loading Loading @@ -240,12 +244,14 @@ <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">GUI</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/kael/Projet/Statistiques/GUI/GUI.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/jorand/Documents/Projet_3A/Statistiques/GUI/GUI.pro</value> <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">GUI.pro</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/jorand/Documents/Projet_3A/Statistiques/build-GUI-Desktop-Debug</value> <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> Loading
GUI/mainwindow.cpp +58 Changes for GUI/mainwindow.cpp: 58 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ #include <QFileDialog> #include <QTextStream> #include <iostream> #include <QtCharts> Loading Loading @@ -164,7 +165,64 @@ void MainWindow::disableWithCount() void MainWindow::handleResults() { waitBox.close(); QBarSeries * barLength = new QBarSeries(); QPieSeries * pieCharset = new QPieSeries(); double percentageTotal, percentageSecurity, total_counter, total_filter; stats->initGraphicalStats(barLength, pieCharset, percentageTotal, percentageSecurity, total_counter, total_filter); /* HISTOGRAM FOR LENGTH */ QChart *chartL = new QChart(); chartL->addSeries(barLength); chartL->setTitle("Length"); QChartView *chartViewL = new QChartView(chartL); chartViewL->setRenderHint(QPainter::Antialiasing); auto layoutL = new QVBoxLayout(); layoutL->addWidget(chartViewL); ui->lengthWidget->setLayout(layoutL); /* PIECHART FOR CHARSET */ pieCharset->setLabelsVisible(); QPieSlice *slice = pieCharset->slices().at(1); slice->setExploded(); slice->setLabelVisible(); slice->setPen(QPen(Qt::darkGreen, 2)); slice->setBrush(Qt::green); QChart *chartC = new QChart(); chartC->addSeries(pieCharset); chartC->setTitle("Charset"); chartC->legend()->hide(); QChartView *chartViewC = new QChartView(chartC); chartViewC->setRenderHint(QPainter::Antialiasing); auto layoutC = new QVBoxLayout(); layoutC->addWidget(chartViewC); ui->charsetWidget->setLayout(layoutC); /* LABELS */ ui->AnalyzedLabel->setText("Number of analyzed passwords: " + QString::number(total_filter) + " on a total of " + QString::number(total_counter) + " passwords (" + QString::number(percentageTotal, 'f', 2) + "%)"); ui->securityLabel->setText(QString::number(percentageSecurity, 'f', 2) + "% of the passwords respects the security rules"); stats->print_stats(); ui->resultLabel->setText("For more detailed statistics, check the file \"result.txt\""); }
GUI/mainwindow.ui +95 −30 Changes for GUI/mainwindow.ui: 95 added lines, 30 removed lines. Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> <width>943</width> <height>701</height> <width>1300</width> <height>800</height> </rect> </property> <property name="sizePolicy"> Loading @@ -21,14 +21,14 @@ </property> <property name="minimumSize"> <size> <width>943</width> <height>701</height> <width>1300</width> <height>800</height> </size> </property> <property name="maximumSize"> <size> <width>943</width> <height>701</height> <width>1300</width> <height>800</height> </size> </property> <property name="windowTitle"> Loading @@ -40,8 +40,8 @@ <rect> <x>20</x> <y>20</y> <width>901</width> <height>601</height> <width>1260</width> <height>711</height> </rect> </property> <layout class="QHBoxLayout" name="horizontalLayout"> Loading Loading @@ -76,13 +76,6 @@ </property> </widget> </item> <item row="3" column="0" colspan="2"> <widget class="QPushButton" name="startButton"> <property name="text"> <string>Start</string> </property> </widget> </item> <item row="0" column="2"> <widget class="QPushButton" name="Browser"> <property name="text"> Loading @@ -98,8 +91,8 @@ <widget class="QWidget" name="gridLayoutWidget_2"> <property name="geometry"> <rect> <x>66</x> <y>30</y> <x>40</x> <y>40</y> <width>321</width> <height>189</height> </rect> Loading Loading @@ -184,10 +177,10 @@ <widget class="QWidget" name="gridLayoutWidget_3"> <property name="geometry"> <rect> <x>70</x> <y>30</y> <x>30</x> <y>50</y> <width>321</width> <height>161</height> <height>174</height> </rect> </property> <layout class="QGridLayout" name="gridLayout_3"> Loading @@ -198,13 +191,6 @@ </property> </widget> </item> <item row="0" column="0"> <widget class="QLabel" name="lengthLabel"> <property name="text"> <string>Min Length</string> </property> </widget> </item> <item row="1" column="0"> <widget class="QLabel" name="specialLabel"> <property name="text"> Loading Loading @@ -261,17 +247,31 @@ </property> </widget> </item> <item row="0" column="0"> <widget class="QLabel" name="lengthLabel"> <property name="text"> <string>Min Length</string> </property> </widget> </item> </layout> </widget> </widget> </item> <item row="3" column="0" colspan="3"> <widget class="QPushButton" name="startButton"> <property name="text"> <string>Start</string> </property> </widget> </item> </layout> </item> <item> <widget class="QFrame" name="resultFrame"> <property name="minimumSize"> <size> <width>450</width> <width>830</width> <height>0</height> </size> </property> Loading @@ -281,6 +281,71 @@ <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> <widget class="QLabel" name="AnalyzedLabel"> <property name="geometry"> <rect> <x>20</x> <y>10</y> <width>791</width> <height>17</height> </rect> </property> <property name="text"> <string/> </property> </widget> <widget class="QLabel" name="securityLabel"> <property name="geometry"> <rect> <x>100</x> <y>30</y> <width>711</width> <height>20</height> </rect> </property> <property name="text"> <string/> </property> </widget> <widget class="QLabel" name="resultLabel"> <property name="geometry"> <rect> <x>290</x> <y>680</y> <width>531</width> <height>20</height> </rect> </property> <property name="text"> <string/> </property> </widget> <widget class="QWidget" name="lengthWidget" native="true"> <property name="geometry"> <rect> <x>0</x> <y>60</y> <width>830</width> <height>271</height> </rect> </property> <property name="minimumSize"> <size> <width>800</width> <height>0</height> </size> </property> </widget> <widget class="QWidget" name="charsetWidget" native="true"> <property name="geometry"> <rect> <x>0</x> <y>340</y> <width>830</width> <height>341</height> </rect> </property> </widget> </widget> </item> </layout> Loading @@ -291,8 +356,8 @@ <rect> <x>0</x> <y>0</y> <width>943</width> <height>25</height> <width>1300</width> <height>22</height> </rect> </property> </widget> Loading
GUI/statsgen.cpp +81 −26 Changes for GUI/statsgen.cpp: 81 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -13,11 +13,14 @@ #include <vector> #include <thread> #include <pthread.h> #include <QFile> #include "statsgen.h" #include "utils.h" #include <QFile> #include <QString> using namespace std; Loading Loading @@ -223,58 +226,111 @@ void Statsgen::print_stats() { int count; float perc = (float) 100 * (total_filter / total_counter); wcout << "\n\tSelected " << total_filter << " on " << total_counter << " passwords\t(" wofstream writeFile("result.txt"); writeFile << "\n\tSelected " << total_filter << " on " << total_counter << " passwords\t(" << perc << " %)" << endl; wcout << "\nSecurity rules : " << endl; wcout << "\tMinimal length of a password: " << minLength << endl; wcout << "\tMinimum of special characters in a password: " << minSpecial << endl; wcout << "\tMinimum of digits in a password: " << minDigit << endl; wcout << "\tMinimum of lower characters in a password: " << minLower << endl; wcout << "\tMinimum of upper characters in a password: " << minUpper << endl; writeFile << "\nSecurity rules : " << endl; writeFile << "\tMinimal length of a password: " << minLength << endl; writeFile << "\tMinimum of special characters in a password: " << minSpecial << endl; writeFile << "\tMinimum of digits in a password: " << minDigit << endl; writeFile << "\tMinimum of lower characters in a password: " << minLower << endl; writeFile << "\tMinimum of upper characters in a password: " << minUpper << endl; float perce = (float) 100 * (nbSecurePassword / total_counter); wcout << "\n\t\t--> " << nbSecurePassword << " passwords\t(" << perce << " %) respect the security rules\n" << endl; writeFile << "\n\t\t--> " << nbSecurePassword << " passwords\t(" << perce << " %) respect the security rules\n" << endl; wcout << "\nmin - max\n" << endl; wcout << setw(43) << right << "digit: " writeFile << "\nmin - max\n" << endl; writeFile << setw(43) << right << "digit: " << setw(2) << right << minMaxValue.mindigit << " - " << minMaxValue.maxdigit << endl; wcout << setw(43) << right << "lower: " writeFile << setw(43) << right << "lower: " << setw(2) << right << minMaxValue.minlower << " - " << minMaxValue.maxlower << endl; wcout << setw(43) << right << "upper: " writeFile << setw(43) << right << "upper: " << setw(2) << right << minMaxValue.minupper << " - " << minMaxValue.maxupper << endl; wcout << setw(43) << right << "special: " writeFile << setw(43) << right << "special: " << setw(2) << right << minMaxValue.minspecial << " - " << minMaxValue.maxspecial << endl; wcout << "\nStatistics relative to length: \n" << endl; showMap(stats_length, top, total_counter, hiderare, count); writeFile << "\nStatistics relative to length: \n" << endl; showMap(writeFile, stats_length, top, total_counter, hiderare, count); wcout << "\nStatistics relative to charsets: \n" << endl; showMap(stats_charactersets, -1, total_counter, hiderare, count); writeFile << "\nStatistics relative to charsets: \n" << endl; showMap(writeFile, stats_charactersets, -1, total_counter, hiderare, count); wcout << "\nStatistics relative to simplemasks: \n" << endl; showMap(stats_simplemasks, top, total_counter, hiderare, count); writeFile << "\nStatistics relative to simplemasks: \n" << endl; showMap(writeFile, stats_simplemasks, top, total_counter, hiderare, count); if (limitSimplemask > 0) { wcout << endl; readResult(stats_simplemasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); readResult(writeFile, stats_simplemasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); } wcout << "\nStatistics relative to advancedmask: \n" << endl; showMap(stats_advancedmasks, top, total_counter, hiderare, count); writeFile << "\nStatistics relative to advancedmask: \n" << endl; showMap(writeFile, stats_advancedmasks, top, total_counter, hiderare, count); if (limitAdvancedmask > 0) { wcout << endl; readResult(stats_advancedmasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); readResult(writeFile, stats_advancedmasks[L"othermasks"], L"othermasks", count, total_counter, hiderare); } } void Statsgen::initGraphicalStats(QBarSeries * barLength, QPieSeries * pieCharset, double & percentageTotal, double & percentageSecurity, double & total, double & filter) { total = total_counter; filter = total_filter; percentageTotal = (double) 100 * (total_filter / total_counter); percentageSecurity = (double) 100 * (nbSecurePassword / total_counter); /* LENGTH HISTOGRAM */ multimap<double, int> reverseL = flip_map<int>(stats_length); double percentageL; double nbHideL = 0; MapIterator<double, int> itL; for(itL = reverseL.end(); itL != reverseL.begin(); itL--) { if (itL == reverseL.end()) continue; percentageL = (double) (100*itL->first) / total_counter; if (percentageL >= 2) { QBarSet *set = new QBarSet(QString::number(itL->second)); *set << itL->first; barLength->append(set); } else { nbHideL += itL->first; } } QBarSet *set = new QBarSet("Other lengths"); *set << nbHideL; barLength->append(set); /* CHARSET PIECHART */ multimap<double, wstring> reverseC = flip_map<wstring>(stats_charactersets); int top = 0; double nbHideC = 0; MapIterator<double, wstring> itC; for(itC = reverseC.end(); itC != reverseC.begin(); itC--) { if (itC == reverseC.end()) continue; top++; if (top <= 5) { pieCharset->append(QString::fromStdWString(itC->second), itC->first); } else { nbHideC += itC->first; } } pieCharset->append("Other charsets", nbHideC); } Loading Loading @@ -430,7 +486,6 @@ void updateMinMax(minMax & minMaxValue, const Policy & pol) { void * generate_stats_thread(void * threadarg) { struct thread_data *my_data; my_data = (struct thread_data *) threadarg; Loading