Commit b2adfbb9 authored by Jorand Jean-baptiste's avatar Jorand Jean-baptiste
Browse files

modif interface

parent be965ce8
Loading
Loading
Loading
Loading
+1 −1
Changes for GUI/GUI.pro.user: 1 added line, 1 removed line.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.5.0, 2018-02-07T17:04:56. -->
<!-- Written by QtCreator 4.5.0, 2018-02-07T18:52:03. -->
<qtcreator>
 <data>
  <variable>EnvironmentId</variable>
+51 −8
Changes for GUI/mainwindow.cpp: 51 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ void MainWindow::startGame() {
    stats = new Statsgen();
    stats->setFilename(ui->fileLine->text());

    ui->AnalyzedLabel->setText("");
    ui->securityLabel->setText("");
    ui->resultLabel->setText("");

    if(ui->withcountButton->isChecked())
    {
        stats->setWithcount(true);
@@ -140,13 +144,33 @@ void MainWindow::startGame() {
        stats->setSecurityRules(8,0,1,1,1);
    }

    ui->ThreadlineEdit->setDisabled(true);
    ui->topLineEdit->setDisabled(true);
    ui->SimplelineEdit->setDisabled(true);
    ui->AdvancedlineEdit->setDisabled(true);
    ui->RegexlineEdit->setDisabled(true);
    ui->lengthLineEdit->setDisabled(true);
    ui->lowerLineEdit->setDisabled(true);
    ui->upperLineEdit->setDisabled(true);
    ui->specialLineEdit->setDisabled(true);
    ui->digitLineEdit->setDisabled(true);
    ui->startButton->setDisabled(true);
    ui->threadsCheckBox->setDisabled(true);
    ui->topCheckBox->setDisabled(true);
    ui->regexCheckBox->setDisabled(true);
    ui->maxAdvancedCheckBox->setDisabled(true);
    ui->maxSimpleCheckBox->setDisabled(true);

    delete layoutCharset;
    delete layoutLength;


    WorkerThread *workerThread = new WorkerThread(stats);
    connect(workerThread, SIGNAL(resultReady()), this, SLOT(handleResults()));
    connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
    workerThread->start();
    waitBox.setText("Analysis in progress");

    waitBox.setText("Analysis in progress");
    waitBox.exec();
}

@@ -166,6 +190,24 @@ void MainWindow::handleResults()
{
    waitBox.close();

    ui->ThreadlineEdit->setDisabled(false);
    ui->topLineEdit->setDisabled(false);
    ui->SimplelineEdit->setDisabled(false);
    ui->AdvancedlineEdit->setDisabled(false);
    ui->RegexlineEdit->setDisabled(false);
    ui->lengthLineEdit->setDisabled(false);
    ui->lowerLineEdit->setDisabled(false);
    ui->upperLineEdit->setDisabled(false);
    ui->specialLineEdit->setDisabled(false);
    ui->digitLineEdit->setDisabled(false);
    ui->startButton->setDisabled(false);
    ui->threadsCheckBox->setDisabled(false);
    ui->topCheckBox->setDisabled(false);
    ui->regexCheckBox->setDisabled(false);
    ui->maxAdvancedCheckBox->setDisabled(false);
    ui->maxSimpleCheckBox->setDisabled(false);


    QBarSeries * barLength = new QBarSeries();
    QPieSeries * pieCharset = new QPieSeries();
    double percentageTotal, percentageSecurity, total_counter, total_filter;
@@ -182,9 +224,9 @@ void MainWindow::handleResults()
    QChartView *chartViewL = new QChartView(chartL);
    chartViewL->setRenderHint(QPainter::Antialiasing);

    auto layoutL = new QVBoxLayout();
    layoutL->addWidget(chartViewL);
    ui->lengthWidget->setLayout(layoutL);
    layoutLength = new QVBoxLayout();
    layoutLength->addWidget(chartViewL);
    ui->lengthWidget->setLayout(layoutLength);


    /* PIECHART FOR CHARSET */
@@ -204,9 +246,9 @@ void MainWindow::handleResults()
    QChartView *chartViewC = new QChartView(chartC);
    chartViewC->setRenderHint(QPainter::Antialiasing);

    auto layoutC = new QVBoxLayout();
    layoutC->addWidget(chartViewC);
    ui->charsetWidget->setLayout(layoutC);
    layoutCharset = new QVBoxLayout();
    layoutCharset->addWidget(chartViewC);
    ui->charsetWidget->setLayout(layoutCharset);


    /* LABELS */
@@ -218,7 +260,8 @@ void MainWindow::handleResults()
                               + " passwords (" + QString::number(percentageTotal, 'f', 2) + "%)");


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

    stats->print_stats();

+2 −1
Changes for GUI/mainwindow.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@ private:
    Ui::MainWindow *ui;
    Statsgen * stats;
    QMessageBox waitBox;

    QVBoxLayout * layoutCharset;
    QVBoxLayout * layoutLength;
};


+74 −63
Changes for GUI/mainwindow.ui: 74 added lines, 63 removed lines.
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1300</width>
    <width>1350</width>
    <height>800</height>
   </rect>
  </property>
@@ -21,13 +21,13 @@
  </property>
  <property name="minimumSize">
   <size>
    <width>1300</width>
    <width>1350</width>
    <height>800</height>
   </size>
  </property>
  <property name="maximumSize">
   <size>
    <width>1300</width>
    <width>1350</width>
    <height>800</height>
   </size>
  </property>
@@ -40,8 +40,8 @@
     <rect>
      <x>20</x>
      <y>20</y>
      <width>1260</width>
      <height>711</height>
      <width>1315</width>
      <height>731</height>
     </rect>
    </property>
    <layout class="QHBoxLayout" name="horizontalLayout">
@@ -91,10 +91,10 @@
         <widget class="QWidget" name="gridLayoutWidget_2">
          <property name="geometry">
           <rect>
            <x>40</x>
            <y>40</y>
            <width>321</width>
            <height>189</height>
            <x>20</x>
            <y>30</y>
            <width>260</width>
            <height>91</height>
           </rect>
          </property>
          <layout class="QGridLayout" name="gridLayout_2">
@@ -108,16 +108,6 @@
             </property>
            </widget>
           </item>
           <item row="0" column="1">
            <widget class="QRadioButton" name="classicButton">
             <property name="text">
              <string>Classic</string>
             </property>
             <property name="checked">
              <bool>true</bool>
             </property>
            </widget>
           </item>
           <item row="1" column="1">
            <widget class="QLineEdit" name="ThreadlineEdit"/>
           </item>
@@ -128,9 +118,6 @@
             </property>
            </widget>
           </item>
           <item row="3" column="1">
            <widget class="QLineEdit" name="SimplelineEdit"/>
           </item>
           <item row="2" column="0">
            <widget class="QCheckBox" name="regexCheckBox">
             <property name="text">
@@ -138,38 +125,21 @@
             </property>
            </widget>
           </item>
           <item row="4" column="1">
            <widget class="QLineEdit" name="AdvancedlineEdit"/>
           </item>
           <item row="3" column="0">
            <widget class="QCheckBox" name="maxSimpleCheckBox">
             <property name="text">
              <string>Maximum simple mask size</string>
             </property>
            </widget>
           </item>
           <item row="4" column="0">
            <widget class="QCheckBox" name="maxAdvancedCheckBox">
           <item row="0" column="1">
            <widget class="QRadioButton" name="classicButton">
             <property name="text">
              <string>Maximum advanced mask size</string>
              <string>Classic</string>
             </property>
            </widget>
           </item>
           <item row="5" column="0">
            <widget class="QCheckBox" name="topCheckBox">
             <property name="text">
              <string>Top X answers to display</string>
             <property name="checked">
              <bool>true</bool>
             </property>
            </widget>
           </item>
           <item row="5" column="1">
            <widget class="QLineEdit" name="topLineEdit"/>
           </item>
          </layout>
         </widget>
        </widget>
       </item>
       <item row="2" column="0" colspan="3">
       <item row="3" column="0" colspan="3">
        <widget class="QGroupBox" name="groupBox_2">
         <property name="title">
          <string>Security rules</string>
@@ -177,8 +147,8 @@
         <widget class="QWidget" name="gridLayoutWidget_3">
          <property name="geometry">
           <rect>
            <x>30</x>
            <y>50</y>
            <x>20</x>
            <y>20</y>
            <width>321</width>
            <height>174</height>
           </rect>
@@ -258,7 +228,56 @@
         </widget>
        </widget>
       </item>
       <item row="3" column="0" colspan="3">
       <item row="2" column="0" colspan="3">
        <widget class="QGroupBox" name="groupBox_3">
         <property name="title">
          <string>Advanced options (only shown in &quot;result.txt&quot;)</string>
         </property>
         <widget class="QWidget" name="gridLayoutWidget_4">
          <property name="geometry">
           <rect>
            <x>20</x>
            <y>20</y>
            <width>301</width>
            <height>101</height>
           </rect>
          </property>
          <layout class="QGridLayout" name="gridLayout_4">
           <item row="1" column="0">
            <widget class="QCheckBox" name="maxAdvancedCheckBox">
             <property name="text">
              <string>Maximum advanced mask size</string>
             </property>
            </widget>
           </item>
           <item row="2" column="0">
            <widget class="QCheckBox" name="topCheckBox">
             <property name="text">
              <string>Top X answers to display</string>
             </property>
            </widget>
           </item>
           <item row="1" column="1">
            <widget class="QLineEdit" name="AdvancedlineEdit"/>
           </item>
           <item row="0" column="0">
            <widget class="QCheckBox" name="maxSimpleCheckBox">
             <property name="text">
              <string>Maximum simple mask size</string>
             </property>
            </widget>
           </item>
           <item row="0" column="1">
            <widget class="QLineEdit" name="SimplelineEdit"/>
           </item>
           <item row="2" column="1">
            <widget class="QLineEdit" name="topLineEdit"/>
           </item>
          </layout>
         </widget>
        </widget>
       </item>
       <item row="4" column="0" colspan="3">
        <widget class="QPushButton" name="startButton">
         <property name="text">
          <string>Start</string>
@@ -297,9 +316,9 @@
       <widget class="QLabel" name="securityLabel">
        <property name="geometry">
         <rect>
          <x>100</x>
          <x>270</x>
          <y>30</y>
          <width>711</width>
          <width>541</width>
          <height>20</height>
         </rect>
        </property>
@@ -310,9 +329,9 @@
       <widget class="QLabel" name="resultLabel">
        <property name="geometry">
         <rect>
          <x>290</x>
          <y>680</y>
          <width>531</width>
          <x>370</x>
          <y>700</y>
          <width>451</width>
          <height>20</height>
         </rect>
        </property>
@@ -342,7 +361,7 @@
          <x>0</x>
          <y>340</y>
          <width>830</width>
          <height>341</height>
          <height>361</height>
         </rect>
        </property>
       </widget>
@@ -356,19 +375,11 @@
    <rect>
     <x>0</x>
     <y>0</y>
     <width>1300</width>
     <width>1350</width>
     <height>22</height>
    </rect>
   </property>
  </widget>
  <widget class="QToolBar" name="mainToolBar">
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
  </widget>
  <widget class="QStatusBar" name="statusBar"/>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
−20
Changes for GUI/statsgen.cpp: 0 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -83,24 +83,6 @@ void Statsgen::setNbThread(int nb) {
}


void Statsgen::setSecurityRules() {
    wcout << "\nMinimal length of a password:" << endl;
    cin >> minLength;

    wcout << "\nMinimum of special characters in a password:" << endl;
    cin >> minSpecial;

    wcout << "\nMinimum of digits in a password:" << endl;
    cin >> minDigit;

    wcout << "\nMinimum of lower characters in a password:" << endl;
    cin >> minLower;

    wcout << "\nMinimum of upper characters in a password:" << endl;
    cin >> minUpper;
}


void Statsgen::setSecurityRules(int length,int special,int digit,int upper,int lower) {
    minLength=length;
    minSpecial=special;
@@ -453,7 +435,6 @@ void analyze_password(const wstring & password, Container & c, SecurityRules & s
}



void updateMinMax(minMax & minMaxValue, const Policy & pol) {
    if (minMaxValue.mindigit == -1 || minMaxValue.mindigit > pol.digit) {
        minMaxValue.mindigit = pol.digit;
@@ -485,7 +466,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