-
Notifications
You must be signed in to change notification settings - Fork 1
/
amarpass_gui.py
116 lines (95 loc) · 4.63 KB
/
amarpass_gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'amarpass_qt_gui.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from project import chars, bn_words, save
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(775, 620)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
# Wordlist 1 button
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(120, 120, 230, 60))
font = QtGui.QFont()
font.setPointSize(12)
self.pushButton.setFont(font)
self.pushButton.setObjectName("pushButton")
# Connect to the function on_wordlist1_clicked()
self.pushButton.clicked.connect(self.on_wordlist1_clicked)
# Wordlist 2 button
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(380, 120, 260, 60))
font = QtGui.QFont()
font.setPointSize(12)
self.pushButton_2.setFont(font)
self.pushButton_2.setObjectName("pushButton_2")
# Connect to the function on_wordlist2_clicked()
self.pushButton_2.clicked.connect(self.on_wordlist2_clicked)
# Text area where the password is shown
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
self.textEdit.setGeometry(QtCore.QRect(120, 210, 520, 160))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(False)
font.setItalic(False)
self.textEdit.setFont(font)
self.textEdit.setObjectName("textEdit")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "AmarPass"))
self.pushButton.setText(_translate("MainWindow", "Wordlist 1"))
self.pushButton_2.setText(_translate("MainWindow", "Wordlist 2"))
self.textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"hr { height: 1px; border-width: 0; }\n"
"li.unchecked::marker { content: \"\\2610\"; }\n"
"li.checked::marker { content: \"\\2612\"; }\n"
"</style></head><body style=\" font-family:\'Segoe UI\'; font-size:12pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Generated password will be shown here</p></body></html>"))
# Function to generate password when wordlist 1 button is clicked
def on_wordlist1_clicked(self):
words = bn_words(3, "1_avro_wordlist.txt")
password = ""
# Add random chars() separator to words to make the password strong
for i in words:
sep = chars()
word = i
password += word + sep
# Save the historical usage data of how many times a word is used
save(words)
# Display the password in the GUI
self.textEdit.setPlainText(password)
# Function to generate password when wordlist 2 button is clicked
def on_wordlist2_clicked(self):
words = bn_words(3, "2_phonetic_wordlist.txt")
password = ""
# Add random chars() separator to words to make the password strong
for i in words:
sep = chars()
word = i
password += word + sep
# Save the historical usage data of how many times a word is used
save(words)
# Display the password in the GUI
self.textEdit.setPlainText(password)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())