@@ -31,6 +31,19 @@ class Menu(QWidget):
31
31
32
32
def __init__ (self ):
33
33
super ().__init__ ()
34
+ # set up all the default variable to be used in password cracker
35
+ self .inputFile = "" # input file holds path to file with password or ash to crack
36
+ self .outputFile = "" # output file will be the file where the passwords are printed
37
+ self .mode = Menu .BRUTE_FORCE # by default will use brute force method
38
+ # file that contains the words for the dictionary attack to run or masks for the masks attack
39
+ self .methodInput = ""
40
+ self .rules = "" #holds path to the file with rules
41
+ self .appendMask = "" #hold the mask that will be applied to end of brute force
42
+ self .prependMask = "" #hold the mask that will be applied to start of brute force
43
+ # by default we assume we are dealing with plain passwords
44
+ self .hashMode = passwordCracker .NO_HASH
45
+ self .onlineHashCheck = False
46
+ # testing
34
47
self .setUpShortcuts ()
35
48
self .openMenu ()
36
49
@@ -51,9 +64,10 @@ def file_open(self, path = 'Input'):
51
64
return file .read ().splitlines ()
52
65
except FileNotFoundError :
53
66
print ("ERROR: could not open file" )
67
+ return ""
54
68
55
69
def openMenu (self ):
56
- self .setStyleSheet (menuCSS )
70
+ # self.setStyleSheet(menuCSS)
57
71
# set up window
58
72
self .setGeometry (300 , 200 , 300 , 600 )
59
73
self .setWindowTitle ('Password Cracker' )
@@ -66,18 +80,14 @@ def openMenu(self):
66
80
# set one group for all password methods
67
81
methodGroup = QButtonGroup ()
68
82
#brute force option
69
- radiobutton = QRadioButton ("Brute-force or dictionary attack" )
83
+ radiobutton = QRadioButton ("Brute-force attack" )
84
+ radiobutton .setToolTip ('Select to do either brute-force or dictionary attack!' )
70
85
radiobutton .setChecked (True )
71
86
radiobutton .methodNum = Menu .BRUTE_FORCE
72
87
methodGroup .addButton (radiobutton , 0 )
73
88
radiobutton .toggled .connect (self .selectAttackMode )
74
89
layout .addWidget (radiobutton , 0 , 0 )
75
90
76
- # Check-box to add option to add to dictionary attack
77
- self .optionBox = QCheckBox ("Customize Attack attack" )
78
- self .optionBox .toggled .connect (self .toggleMenu )
79
- layout .addWidget (self .optionBox , 1 , 0 )
80
-
81
91
#mask option
82
92
radiobutton = QRadioButton ("Mask attack" )
83
93
radiobutton .methodNum = Menu .MASK
@@ -94,51 +104,87 @@ def openMenu(self):
94
104
btn .resize (btn .sizeHint ())
95
105
layout .addWidget (btn , 0 , 4 )
96
106
97
- # Create togglable menu -> Nest layout in frame because you can control when to show and when to hide
98
- # frame = QFrame()
99
- # bruteForceMenu = QGridLayout()
100
-
101
- bruteForceGroup = QButtonGroup ()
102
- # Option to apply rules
103
- self .ruleMenu = QRadioButton ("Add Rules" )
104
- # self.ruleMenu.setProperty('Hide', False)
105
- # btn.setObjectName('ShowMe')
106
- self .ruleMenu .optionNum = Menu .USE_RULE
107
- bruteForceGroup .addButton (self .ruleMenu , 1 )
108
- self .ruleMenu .toggled .connect (self .selectBruteforceOption )
109
- self .ruleMenu .setVisible (False )
110
- layout .addWidget (self .ruleMenu , 2 , 0 )
111
-
112
- #store hidden layout in frame
113
- # frame.setLayout(bruteForceMenu)
107
+ # Togglable options for dictionary attack
108
+ # Check-box to add rules to add to dictionary attack
109
+ self .ruleBox = QCheckBox ("Add Rules" )
110
+ self .ruleBox .toggled .connect (self .toggleRules )
111
+ layout .addWidget (self .ruleBox , 1 , 0 )
112
+
113
+ # Check-box to append a mask to add to dictionary attack
114
+ self .maskAppendBox = QCheckBox ("Append Mask" )
115
+ self .maskAppendBox .toggled .connect (self .toggleAppendMask )
116
+ layout .addWidget (self .maskAppendBox , 1 , 2 )
117
+
118
+ # Check-box to append a mask to add to dictionary attack
119
+ self .maskPrependBox = QCheckBox ("Prepend Mask" )
120
+ self .maskPrependBox .toggled .connect (self .togglePrependMask )
121
+ layout .addWidget (self .maskPrependBox , 1 , 3 )
122
+
123
+ self .hashBox = QCheckBox ("Hash mode" )
124
+ self .hashBox .toggled .connect (self .toggleHashMode )
125
+ layout .addWidget (self .hashBox , 2 , 0 )
126
+
127
+ self .rainbowBox = QCheckBox ("Rainbow check" )
128
+ self .rainbowBox .toggled .connect (self .toggleOnlineHash )
129
+ layout .addWidget (self .rainbowBox , 2 , 1 )
130
+
131
+ self .hashDropdown = QComboBox (self )
132
+ self .hashDropdown .addItem ("SHA1" )
133
+ self .hashDropdown .addItem ("MD5" )
134
+ self .hashDropdown .addItem ("bcrypt" )
135
+ self .hashDropdown .currentIndexChanged .connect (self .toggleHashMode )
136
+ layout .addWidget (self .hashDropdown , 2 , 2 ,1 , 2 )
114
137
138
+ # ** USE save file mode instead of open
139
+ self .inputBtn = QPushButton ('' , self )
140
+ self .inputBtn .setIcon (QIcon ('Resources/Images/open.png' ))
141
+ self .inputBtn .setIconSize (QSize (24 ,24 ))
142
+ self .inputBtn .setToolTip ('Select file with all the passwords or hashes that you want to crack ' )
143
+ self .inputBtn .toggled .connect (self .getInputFile )
144
+ layout .addWidget (self .inputBtn , 3 , 1 )
145
+
146
+ self .outputBtn = QPushButton ('' , self )
147
+ self .outputBtn .setIcon (QIcon ('Resources/Images/open.png' ))
148
+ self .outputBtn .setIconSize (QSize (24 ,24 ))
149
+ self .outputBtn .setToolTip ('Select file that will store the cracked passwords ' )
150
+ self .outputBtn .toggled .connect (self .getOutputFile )
151
+ layout .addWidget (self .outputBtn , 3 , 2 )
152
+
153
+ self .startBtn = QPushButton ('Crack passwords!' , self )
154
+ self .startBtn .toggled .connect (self .startCrack )
155
+ self .outputBtn .setToolTip ('Press to start cracking passwords!' )
156
+ layout .addWidget (self .startBtn , 4 , 1 , 1 , 2 )
115
157
116
- # self.addWidget(frame) # add to bruteForce menu to main window
117
- # frame.hide()
118
- # frame.show()
119
-
120
- #testing **
158
+
121
159
def selectAttackMode (self ):
122
160
radiobutton = self .sender ()
123
161
if radiobutton .isChecked ():
124
162
if (radiobutton .methodNum == Menu .BRUTE_FORCE ):
125
- self .optionBox .setVisible (True )
163
+ self .ruleBox .setVisible (True )
164
+ self .maskAppendBox .setVisible (True )
165
+ self .maskPrependBox .setVisible (True )
126
166
if (radiobutton .methodNum == Menu .MASK ):
127
- self .optionBox .setVisible (False )
167
+ self .ruleBox .setVisible (False )
168
+ self .maskAppendBox .setVisible (False )
169
+ self .maskPrependBox .setVisible (False )
128
170
129
-
130
- def toggleMenu (self ):
131
- # for every box
132
- if (self .optionBox .isChecked ()):
133
- # self.ruleMenu.setProperty('Hide', True)
134
- self .ruleMenu .setVisible (True )
135
- else :
136
- self .ruleMenu .setVisible (False )
137
- # self.ruleMenu.setProperty('Hide', False)
138
- # self.ruleMenu.setStyle(self.ruleMenu.style())
139
- def selectBruteforceOption (self ):
140
- # use dictionary attack with proper option applied
171
+ def toggleRules (self ):
172
+ pass
173
+ def toggleAppendMask (self ):
174
+ pass
175
+ def togglePrependMask (self ):
176
+ pass
177
+ def toggleHashMode (self ):
178
+ pass
179
+ def toggleOnlineHash (self ):
180
+ pass
181
+ def getInputFile (self ):
182
+ pass
183
+ def getOutputFile (self ):
184
+ pass
185
+ def startCrack (self ):
141
186
pass
187
+ # Look at different option like input file/output file, rules file and so on
142
188
if __name__ == '__main__' :
143
189
app = QApplication (sys .argv )
144
190
screen = Menu ()
0 commit comments