Markopy
Utilizing Markov Models for brute forcing attacks
Markov::GUI::Generate Class Reference

QT Generation page class. More...

#include <Generate.h>

Inheritance diagram for Markov::GUI::Generate:
Collaboration diagram for Markov::GUI::Generate:

Public Slots

void home ()
 
void generation ()
 
void train ()
 
void vis ()
 

Public Member Functions

 Generate (QWidget *parent=Q_NULLPTR)
 

Private Attributes

Ui::Generate ui
 

Detailed Description

QT Generation page class.

Definition at line 15 of file Generate.h.

Constructor & Destructor Documentation

◆ Generate()

Generate::Generate ( QWidget *  parent = Q_NULLPTR)

Definition at line 20 of file Generate.cpp.

21  : QMainWindow(parent)
22 {
23  ui.setupUi(this);
24 
25  QObject::connect(ui.pushButton, &QPushButton::clicked, this, [this] {generation(); });
26  QObject::connect(ui.pushButton_4, &QPushButton::clicked, this, [this] {home(); });
27  QObject::connect(ui.pushButton_3, &QPushButton::clicked, this, [this] {train(); });
28  QObject::connect(ui.pushButton_2, &QPushButton::clicked, this, [this] {vis(); });
29 
30 
31  ui.pushButton->setVisible(false);
32  ui.lineEdit->setVisible(false);
33  ui.lineEdit_2->setVisible(false);
34  ui.lineEdit_3->setVisible(false);
35  ui.label_3->setVisible(false);
36  ui.label_4->setVisible(false);
37  ui.label_5->setVisible(false);
38 
39 
40 }
Ui::Generate ui
Definition: Generate.h:21

References ui.

Member Function Documentation

◆ generation

void Generate::generation ( )
slot

Definition at line 42 of file Generate.cpp.

42  {
43 
44 
45 
46 
47  QString file_name = QFileDialog::getOpenFileName(this, "Open a File", QDir::homePath());
48  QFile file(file_name);
49 
50 
51 
52  int numberPass = ui.lineEdit->text().toInt();
53  int minLen = ui.lineEdit_2->text().toInt();
54  int maxLen = ui.lineEdit_3->text().toInt();
55  char* cstr;
56  std::string fname = file_name.toStdString();
57  cstr = new char[fname.size() + 1];
58  strcpy(cstr, fname.c_str());
59 
60  ui.label_6->setText("GENERATING!");
61 
63  mp.Import("src\\CLI\\sample_models\\2gram-trained.mdl");
64 
65  mp.Generate(numberPass,cstr,minLen,maxLen);
66 
67  if (!file.open(QFile::ReadOnly | QFile::Text)) {
68  QMessageBox::warning(this, "Error", "File Not Open!");
69  }
70  QTextStream in(&file);
71  QString text = in.readAll();
72  ui.plainTextEdit->setPlainText(text);
73 
74  ui.label_6->setText("DONE!");
75 
76 
77 
78  file.close();
79 }
Markov::Model with char represented nodes.
Definition: mp.py:1

References Markov::API::MarkovPasswords::Generate(), and ui.

Here is the call graph for this function:

◆ home

void Generate::home ( )
slot

Definition at line 121 of file Generate.cpp.

121  {
122  CLI* w = new CLI;
123  w->show();
124  this->close();
125 }
QT CLI Class.
Definition: CLI.h:14

◆ train

void Generate::train ( )
slot

Definition at line 82 of file Generate.cpp.

82  {
83  QString file_name = QFileDialog::getOpenFileName(this, "Open a File", QDir::homePath());
84  QFile file(file_name);
85 
86  if (!file.open(QFile::ReadOnly | QFile::Text)) {
87  QMessageBox::warning(this, "Error", "File Not Open!");
88  }
89  QTextStream in(&file);
90  QString text = in.readAll();
91 
92 
93  char* cstr;
94  std::string fname = file_name.toStdString();
95  cstr = new char[fname.size() + 1];
96  strcpy(cstr, fname.c_str());
97 
98 
99 
100  char a = ',';
102  mp.Import("models\\2gram.mdl");
103  mp.Train(cstr, a,10);
104  mp.Export("models\\finished.mdl");
105 
106 
107 
108  ui.pushButton->setVisible(true);
109  ui.lineEdit->setVisible(true);
110  ui.lineEdit_2->setVisible(true);
111  ui.lineEdit_3->setVisible(true);
112  ui.label_3->setVisible(true);
113  ui.label_4->setVisible(true);
114  ui.label_5->setVisible(true);
115 
116  file.close();
117 
118 
119 }

References Markov::API::MarkovPasswords::Train(), and ui.

Referenced by Python.Markopy.BaseCLI::process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vis

void Generate::vis ( )
slot

Definition at line 126 of file Generate.cpp.

126  {
128  w->show();
129  this->close();
130 }

Member Data Documentation

◆ ui

Ui::Generate Markov::GUI::Generate::ui
private

Definition at line 21 of file Generate.h.

Referenced by Generate(), generation(), and train().


The documentation for this class was generated from the following files: