forked from SECFORCE/sparta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettingsdialogs.py
1541 lines (1299 loc) · 71.1 KB
/
settingsdialogs.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
'''
SPARTA - Network Infrastructure Penetration Testing Tool (http://sparta.secforce.com)
Copyright (c) 2014 SECFORCE (Antonio Quina and Leonidas Stavliotis)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
import os
from PyQt4.QtGui import * # for filters dialog
from app.auxiliary import * # for timestamps
class Validate(QtCore.QObject): # used to validate user input on focusOut - more specifically only called to validate tool name in host/port/terminal commands tabs
def eventFilter(self, widget, event):
if event.type() == QtCore.QEvent.FocusOut: # this horrible line is to avoid making the 'AddSettingsDialog' class visible from here
widget.parent().parent().parent().parent().parent().parent().validateToolName()
return False
else:
return False # TODO: check this
# Borrowed this class from https://gist.github.com/LegoStormtroopr/5075267
# Credit and thanks to LegoStormtoopr (http://www.twitter.com/legostormtroopr)
class SettingsTabBarWidget(QtGui.QTabBar):
def __init__(self, parent=None, *args, **kwargs):
self.tabSize = QtCore.QSize(kwargs.pop('width',100), kwargs.pop('height',25))
QtGui.QTabBar.__init__(self, parent, *args, **kwargs)
def paintEvent(self, event):
painter = QtGui.QStylePainter(self)
option = QtGui.QStyleOptionTab()
for index in range(self.count()):
self.initStyleOption(option, index)
tabRect = self.tabRect(index)
tabRect.moveLeft(10)
painter.drawControl(QtGui.QStyle.CE_TabBarTabShape, option)
painter.drawText(tabRect, QtCore.Qt.AlignVCenter | QtCore.Qt.TextDontClip, self.tabText(index));
painter.end()
def tabSizeHint(self,index):
return self.tabSize
class AddSettingsDialog(QtGui.QDialog): # dialog shown when the user selects settings menu
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setupLayout()
self.setupConnections()
self.validationPassed = True # TODO: rethink
self.previousTab = self.settingsTabWidget.tabText(self.settingsTabWidget.currentIndex())
self.validate = Validate()
self.hostActionNameText.installEventFilter(self.validate)
self.portActionNameText.installEventFilter(self.validate)
self.terminalActionNameText.installEventFilter(self.validate)
self.hostTableRow = -1
self.portTableRow = -1
self.terminalTableRow = -1
# TODO: maybe these shouldn't be hardcoded because the user can change them... rethink this?
self.defaultServicesList = ["mysql-default","mssql-default","ftp-default","postgres-default","oracle-default"]
def setupConnections(self):
self.browseUsersListButton.clicked.connect(lambda: self.wordlistDialog())
self.browsePasswordsListButton.clicked.connect(lambda: self.wordlistDialog('Choose password path'))
self.addToolForHostButton.clicked.connect(self.addToolForHost)
self.removeToolForHostButton.clicked.connect(self.removeToolForHost)
self.addToolButton.clicked.connect(self.addToolForService)
self.removeToolButton.clicked.connect(self.removeToolForService)
self.addToolForTerminalButton.clicked.connect(self.addToolForTerminal)
self.removeToolForTerminalButton.clicked.connect(self.removeToolForTerminal)
self.addServicesButton.clicked.connect(lambda: self.moveService(self.servicesAllTableWidget, self.servicesActiveTableWidget))
self.removeServicesButton.clicked.connect(lambda: self.moveService(self.servicesActiveTableWidget, self.servicesAllTableWidget))
self.addTerminalServiceButton.clicked.connect(lambda: self.moveService(self.terminalServicesAllTable, self.terminalServicesActiveTable))
self.removeTerminalServiceButton.clicked.connect(lambda: self.moveService(self.terminalServicesActiveTable, self.terminalServicesAllTable))
self.toolForHostsTableWidget.clicked.connect(self.updateToolForHostInformation)
self.toolForServiceTableWidget.clicked.connect(self.updateToolForServiceInformation)
self.toolForTerminalTableWidget.clicked.connect(self.updateToolForTerminalInformation)
self.hostActionNameText.textChanged.connect(lambda: self.realTimeToolNameUpdate(self.toolForHostsTableWidget, self.hostActionNameText.text()))
self.portActionNameText.textChanged.connect(lambda: self.realTimeToolNameUpdate(self.toolForServiceTableWidget, self.portActionNameText.text()))
self.terminalActionNameText.textChanged.connect(lambda: self.realTimeToolNameUpdate(self.toolForTerminalTableWidget, self.terminalActionNameText.text()))
self.enableAutoAttacks.clicked.connect(lambda: self.enableAutoToolsTab())
self.checkDefaultCred.clicked.connect(self.toggleDefaultServices)
self.settingsTabWidget.currentChanged.connect(self.switchTabClick)
self.ToolSettingsTab.currentChanged.connect(self.switchToolTabClick)
##################### ACTION FUNCTIONS (apply / cancel related) #####################
def setSettings(self, settings): # called by the controller once the config file has been read at start time and also when the cancel button is pressed to forget any changes.
self.settings = settings
self.resetGui() # clear any changes the user may have made and canceled.
self.populateSettings() # populate the GUI with the new settings
self.hostActionsNumber = 1 # TODO: this is most likely not the best way to do it. we should check if New_Action_1 exists and if so increase the number until it doesn't exist. no need for a self.variable - can be a local one.
self.portActionsNumber = 1
self.terminalActionsNumber = 1
def applySettings(self): # called when apply button is pressed
if self.validateCurrentTab(self.settingsTabWidget.tabText(self.settingsTabWidget.currentIndex())):
self.updateSettings()
return True
return False
def updateSettings(self): # updates the local settings object (must be called when applying settings and only after validation succeeded)
# LEO: reorganised stuff in a more logical way but no changes were made yet :)
# update GENERAL tab settings
self.settings.general_default_terminal = str(self.terminalComboBox.currentText())
self.settings.general_max_fast_processes = str(self.fastProcessesComboBox.currentText())
self.settings.general_screenshooter_timeout = str(self.screenshotTextinput.text())
self.settings.general_web_services = str(self.webServicesTextinput.text())
if self.checkStoreClearPW.isChecked():
self.settings.brute_store_cleartext_passwords_on_exit = 'True'
else:
self.settings.brute_store_cleartext_passwords_on_exit = 'False'
if self.checkBlackBG.isChecked():
self.settings.general_tool_output_black_background = 'True'
else:
self.settings.general_tool_output_black_background = 'False'
# update BRUTE tab settings
self.settings.brute_username_wordlist_path = str(self.userlistPath.text())
self.settings.brute_password_wordlist_path = str(self.passwordlistPath.text())
self.settings.brute_default_username = str(self.defaultUserText.text())
self.settings.brute_default_password = str(self.defaultPassText.text())
# update TOOLS tab settings
self.settings.tools_nmap_stage1_ports = str(self.stage1Input.text())
self.settings.tools_nmap_stage2_ports = str(self.stage2Input.text())
self.settings.tools_nmap_stage3_ports = str(self.stage3Input.text())
self.settings.tools_nmap_stage4_ports = str(self.stage4Input.text())
self.settings.tools_nmap_stage5_ports = str(self.stage5Input.text())
# update AUTOMATED ATTACKS tab settings
if self.enableAutoAttacks.isChecked():
self.settings.general_enable_scheduler = 'True'
else:
self.settings.general_enable_scheduler = 'False'
# TODO: seems like all the other settings should be updated here as well instead of updating them in the validation function.
#def initValues(self): # LEO: renamed and changed the previous tabs defaults otherwise validation doesn't work the first time
def resetGui(self): # called when the cancel button is clicked, to initialise everything
self.validationPassed = True
self.previousTab = 'General'
self.previousToolTab = 'Tool Paths'
self.hostTableRow = -1
self.portTableRow = -1
self.terminalTableRow = -1
self.hostActionNameText.setText('')
self.hostLabelText.setText(' ')
self.hostLabelText.setReadOnly(True)
self.hostCommandText.setText('init value')
self.portActionNameText.setText('')
self.portLabelText.setText(' ')
self.portLabelText.setReadOnly(True)
self.portCommandText.setText('init value')
self.terminalActionNameText.setText('')
self.terminalLabelText.setText(' ')
self.terminalLabelText.setReadOnly(True)
self.terminalCommandText.setText('init value')
# reset layouts
clearLayout(self.scrollVerLayout)
clearLayout(self.defaultBoxVerlayout)
self.terminalComboBox.clear()
def populateSettings(self): # called by setSettings at start up or when showing the settings dialog after a cancel action. it populates the GUI with the controller's settings object.
self.populateGeneralTab() # LEO: split it in functions so that it's less confusing and easier to refactor later
self.populateBruteTab()
self.populateToolsTab()
self.populateAutomatedAttacksTab()
def populateGeneralTab(self):
self.terminalsSupported = ['gnome-terminal','xterm']
self.terminalComboBox.insertItems(0, self.terminalsSupported)
self.fastProcessesComboBox.setCurrentIndex(int(self.settings.general_max_fast_processes) - 1)
self.screenshotTextinput.setText(str(self.settings.general_screenshooter_timeout))
self.webServicesTextinput.setText(str(self.settings.general_web_services))
if self.settings.general_tool_output_black_background == 'True' and self.checkBlackBG.isChecked() == False:
self.checkBlackBG.toggle()
elif self.settings.general_tool_output_black_background == 'False' and self.checkBlackBG.isChecked() == True:
self.checkBlackBG.toggle()
if self.settings.brute_store_cleartext_passwords_on_exit == 'True' and self.checkStoreClearPW.isChecked() == False:
self.checkStoreClearPW.toggle()
elif self.settings.brute_store_cleartext_passwords_on_exit == 'False' and self.checkStoreClearPW.isChecked() == True:
self.checkStoreClearPW.toggle()
def populateBruteTab(self):
self.userlistPath.setText(self.settings.brute_username_wordlist_path)
self.passwordlistPath.setText(self.settings.brute_password_wordlist_path)
self.defaultUserText.setText(self.settings.brute_default_username)
self.defaultPassText.setText(self.settings.brute_default_password)
def populateToolsTab(self):
# POPULATE TOOL PATHS TAB
self.nmapPathInput.setText(self.settings.tools_path_nmap)
self.hydraPathInput.setText(self.settings.tools_path_hydra)
self.cutycaptPathInput.setText(self.settings.tools_path_cutycapt)
self.textEditorPathInput.setText(self.settings.tools_path_texteditor)
# POPULATE STAGED NMAP TAB
self.stage1Input.setText(self.settings.tools_nmap_stage1_ports)
self.stage2Input.setText(self.settings.tools_nmap_stage2_ports)
self.stage3Input.setText(self.settings.tools_nmap_stage3_ports)
self.stage4Input.setText(self.settings.tools_nmap_stage4_ports)
self.stage5Input.setText(self.settings.tools_nmap_stage5_ports)
# POPULATE TOOLS TABS (HOST/PORT/TERMINAL)
self.toolForHostsTableWidget.setRowCount(len(self.settings.hostActions))
for row in range(len(self.settings.hostActions)):
# add a row to the table
self.toolForHostsTableWidget.setItem(row, 0, QtGui.QTableWidgetItem())
# add the label for the port actions
self.toolForHostsTableWidget.item(row, 0).setText(self.settings.hostActions[row][1])
self.toolForServiceTableWidget.setRowCount(len(self.settings.portActions))
for row in range(len(self.settings.portActions)):
self.toolForServiceTableWidget.setItem(row, 0, QtGui.QTableWidgetItem())
self.toolForServiceTableWidget.item(row, 0).setText(self.settings.portActions[row][1])
self.servicesAllTableWidget.setRowCount(len(self.settings.portActions))
for row in range(len(self.settings.portActions)):
self.servicesAllTableWidget.setItem(row, 0, QtGui.QTableWidgetItem())
self.servicesAllTableWidget.item(row, 0).setText(self.settings.portActions[row][3])
self.toolForTerminalTableWidget.setRowCount(len(self.settings.portTerminalActions))
for row in range(len(self.settings.portTerminalActions)):
# add a row to the table
self.toolForTerminalTableWidget.setItem(row, 0, QtGui.QTableWidgetItem())
# add the label fro the port actions
self.toolForTerminalTableWidget.item(row, 0).setText(self.settings.portTerminalActions[row][1])
self.terminalServicesAllTable.setRowCount(len(self.settings.portTerminalActions))
for row in range(len(self.settings.portTerminalActions)):
self.terminalServicesAllTable.setItem(row, 0, QtGui.QTableWidgetItem())
self.terminalServicesAllTable.item(row, 0).setText(self.settings.portTerminalActions[row][3])
def populateAutomatedAttacksTab(self): # TODO: this one is still to big and ugly. needs work.
self.typeDic = {}
for i in range(len(self.settings.portActions)):
# the dictionary contains the name, the text input and the layout for each tool
self.typeDic.update({self.settings.portActions[i][1]:[QtGui.QLabel(),QtGui.QLineEdit(),QtGui.QCheckBox(),QtGui.QHBoxLayout()]})
for keyNum in range(len(self.settings.portActions)):
# populate the automated attacks tools tab with every tool that is not a default creds check
if self.settings.portActions[keyNum][1] not in self.defaultServicesList:
self.typeDic[self.settings.portActions[keyNum][1]][0].setText(self.settings.portActions[keyNum][1])
self.typeDic[self.settings.portActions[keyNum][1]][0].setFixedWidth(150)
#if self.settings.portActions[keyNum][1] in self.settings.automatedAttacks.keys():
foundToolInAA = False
for t in self.settings.automatedAttacks:
if self.settings.portActions[keyNum][1] == t[0]:
#self.typeDic[self.settings.portActions[keyNum][1]][1].setText(self.settings.automatedAttacks[self.settings.portActions[keyNum][1]])
self.typeDic[self.settings.portActions[keyNum][1]][1].setText(t[1])
self.typeDic[self.settings.portActions[keyNum][1]][2].toggle()
foundToolInAA = True
break
if not foundToolInAA:
self.typeDic[self.settings.portActions[keyNum][1]][1].setText(self.settings.portActions[keyNum][3])
self.typeDic[self.settings.portActions[keyNum][1]][1].setFixedWidth(300)
self.typeDic[self.settings.portActions[keyNum][1]][2].setObjectName(str(self.typeDic[self.settings.portActions[keyNum][1]][2]))
self.typeDic[self.settings.portActions[keyNum][1]][3].addWidget(self.typeDic[self.settings.portActions[keyNum][1]][0])
self.typeDic[self.settings.portActions[keyNum][1]][3].addWidget(self.typeDic[self.settings.portActions[keyNum][1]][1])
self.typeDic[self.settings.portActions[keyNum][1]][3].addItem(self.enabledSpacer)
self.typeDic[self.settings.portActions[keyNum][1]][3].addWidget(self.typeDic[self.settings.portActions[keyNum][1]][2])
self.scrollVerLayout.addLayout(self.typeDic[self.settings.portActions[keyNum][1]][3])
else: # populate the automated attacks tools tab with every tool that IS a default creds check
# TODO: i get the feeling we shouldn't be doing this in the else. the else could just skip the default ones and outside of the loop we can go through self.defaultServicesList and take care of these separately.
if self.settings.portActions[keyNum][1] == "mysql-default":
self.typeDic[self.settings.portActions[keyNum][1]][0].setText('mysql')
elif self.settings.portActions[keyNum][1] == "mssql-default":
self.typeDic[self.settings.portActions[keyNum][1]][0].setText('mssql')
elif self.settings.portActions[keyNum][1] == "ftp-default":
self.typeDic[self.settings.portActions[keyNum][1]][0].setText('ftp')
elif self.settings.portActions[keyNum][1] == "postgres-default":
self.typeDic[self.settings.portActions[keyNum][1]][0].setText('postgres')
elif self.settings.portActions[keyNum][1] == "oracle-default":
self.typeDic[self.settings.portActions[keyNum][1]][0].setText('oracle')
self.typeDic[self.settings.portActions[keyNum][1]][0].setFixedWidth(150)
self.typeDic[self.settings.portActions[keyNum][1]][2].setObjectName(str(self.typeDic[self.settings.portActions[keyNum][1]][2]))
self.typeDic[self.settings.portActions[keyNum][1]][3].addWidget(self.typeDic[self.settings.portActions[keyNum][1]][0])
self.typeDic[self.settings.portActions[keyNum][1]][3].addItem(self.enabledSpacer)
self.typeDic[self.settings.portActions[keyNum][1]][3].addWidget(self.typeDic[self.settings.portActions[keyNum][1]][2])
self.defaultBoxVerlayout.addLayout(self.typeDic[self.settings.portActions[keyNum][1]][3])
self.scrollArea.setWidget(self.scrollWidget)
self.globVerAutoToolsLayout.addWidget(self.scrollArea)
##################### SWITCH TAB FUNCTIONS #####################
def switchTabClick(self): # LEO: this function had duplicate code with validateCurrentTab(). so now we call that one.
if self.settingsTabWidget.tabText(self.settingsTabWidget.currentIndex()) == 'Tools':
self.previousToolTab = self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex())
print 'previous tab is: ' + str(self.previousTab)
if self.validateCurrentTab(self.previousTab): # LEO: we don't care about the return value in this case. it's just for debug.
print 'validation succeeded! switching tab! yay!'
# save the previous tab for the next time we switch tabs. TODO: not sure this should be inside the IF but makes sense to me. no point in saving the previous if there is no change..
self.previousTab = self.settingsTabWidget.tabText(self.settingsTabWidget.currentIndex())
else:
print 'nope! cannot let you switch tab! you fucked up!'
def switchToolTabClick(self): # TODO: check for duplicate code.
if self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Host Commands':
self.toolForHostsTableWidget.selectRow(0)
self.updateToolForHostInformation(False)
elif self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Port Commands':
self.toolForServiceTableWidget.selectRow(0)
self.updateToolForServiceInformation(False)
elif self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Terminal Commands':
self.toolForTerminalTableWidget.selectRow(0)
self.updateToolForTerminalInformation(False)
# LEO: I get the feeling the validation part could go into a validateCurrentToolTab() just like in the other switch tab function.
if self.previousToolTab == 'Tool Paths':
if not self.toolPathsValidate():
self.ToolSettingsTab.setCurrentIndex(0)
elif self.previousToolTab == 'Host Commands':
if not self.validateCommandTabs(self.hostActionNameText, self.hostLabelText, self.hostCommandText):
self.ToolSettingsTab.setCurrentIndex(1)
else:
self.updateHostActions()
elif self.previousToolTab == 'Port Commands':
if not self.validateCommandTabs(self.portActionNameText, self.portLabelText, self.portCommandText):
self.ToolSettingsTab.setCurrentIndex(2)
else:
self.updatePortActions()
elif self.previousToolTab == 'Terminal Commands':
if not self.validateCommandTabs(self.terminalActionNameText, self.terminalLabelText, self.terminalCommandText):
self.ToolSettingsTab.setCurrentIndex(3)
else:
self.updateTerminalActions()
elif self.previousToolTab == 'Staged Nmap':
if not self.validateStagedNmapTab():
self.ToolSettingsTab.setCurrentIndex(4)
# else:
# self.updateTerminalActions() # LEO: commented out because it didn't look right, please check!
self.previousToolTab = self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex())
##################### AUXILIARY FUNCTIONS #####################
#def confInitState(self): # LEO: renamed. i get the feeling this function is not necessary if we put this code somewhere else - eg: right before we apply/cancel. we'll see.
def resetTabIndexes(self): # called when the settings dialog is opened so that we always show the same tabs.
self.settingsTabWidget.setCurrentIndex(0)
self.ToolSettingsTab.setCurrentIndex(0)
def toggleRedBorder(self, widget, red=True): # called by validation functions to display (or not) a red border around a text input widget when input is (in)valid. easier to change stylesheets in one place only.
if red:
widget.setStyleSheet("border: 1px solid red;")
else:
widget.setStyleSheet("border: 1px solid grey;")
# LEO: I moved the really generic validation functions to the end of auxiliary.py and those are used by these slightly-less-generic ones.
# .. the difference is that these ones also take care of the IF/ELSE which was being duplicated all over the code. everything should be simpler now.
# note that I didn't use these everywhere because sometimes the IF/ELSE are not so straight-forward.
def validateNumeric(self, widget):
if not validateNumeric(str(widget.text())):
self.toggleRedBorder(widget, True)
return False
else:
self.toggleRedBorder(widget, False)
return True
def validateString(self, widget):
if not validateString(str(widget.text())): # TODO: this is too strict in some cases...
self.toggleRedBorder(widget, True)
return False
else:
self.toggleRedBorder(widget, False)
return True
def validateStringWithSpace(self, widget):
if not validateStringWithSpace(str(widget.text())):
self.toggleRedBorder(widget, True)
return False
else:
self.toggleRedBorder(widget, False)
return True
def validatePath(self, widget):
if not validatePath(str(widget.text())):
self.toggleRedBorder(widget, True)
return False
else:
self.toggleRedBorder(widget, False)
return True
def validateFile(self, widget):
if not validateFile(str(widget.text())):
self.toggleRedBorder(widget, True)
return False
else:
self.toggleRedBorder(widget, False)
return True
def validateCommandFormat(self, widget):
if not validateCommandFormat(str(widget.text())):
self.toggleRedBorder(widget, True)
return False
else:
self.toggleRedBorder(widget, False)
return True
def validateNmapPorts(self, widget):
if not validateNmapPorts(str(widget.text())):
self.toggleRedBorder(widget, True)
return False
else:
self.toggleRedBorder(widget, False)
return True
##################### VALIDATION FUNCTIONS (per tab) #####################
# LEO: the functions are more or less in the same order as the tabs in the GUI (top-down and left-to-right) except for generic functions
def validateCurrentTab(self, tab): # LEO: your updateSettings() was split in 2. validateCurrentTab() and updateSettings() since they have different functionality. also, we now have a 'tab' parameter so that we can reuse the code in switchTabClick and avoid duplicate code. the tab parameter will either be the current or the previous tab depending where we call this from.
validationPassed = True
if tab == 'General':
if not self.validateGeneralTab():
self.settingsTabWidget.setCurrentIndex(0)
validationPassed = False
elif tab == 'Brute':
if not self.validateBruteTab():
self.settingsTabWidget.setCurrentIndex(1)
validationPassed = False
elif tab == 'Tools':
self.ToolSettingsTab.setCurrentIndex(0)
currentToolsTab = self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex())
if currentToolsTab == 'Tool Paths':
if not self.toolPathsValidate():
self.settingsTabWidget.setCurrentIndex(2)
self.ToolSettingsTab.setCurrentIndex(0)
validationPassed = False
elif currentToolsTab == 'Host Commands':
if not self.validateCommandTabs(self.hostActionNameText, self.hostLabelText, self.hostCommandText):
self.settingsTabWidget.setCurrentIndex(2)
self.ToolSettingsTab.setCurrentIndex(1)
validationPassed = False
else:
self.updateHostActions()
elif currentToolsTab == 'Port Commands':
if not self.validateCommandTabs(self.portActionNameText, self.portLabelText, self.portCommandText):
self.settingsTabWidget.setCurrentIndex(2)
self.ToolSettingsTab.setCurrentIndex(2)
validationPassed = False
else:
self.updatePortActions()
elif currentToolsTab == 'Terminal Commands':
if not self.validateCommandTabs(self.terminalActionNameText, self.terminalLabelText, self.terminalCommandText):
self.settingsTabWidget.setCurrentIndex(2)
self.ToolSettingsTab.setCurrentIndex(3)
validationPassed = False
else:
self.updateTerminalActions()
elif currentToolsTab == 'Staged Nmap':
if not self.validateStagedNmapTab():
self.settingsTabWidget.setCurrentIndex(2)
self.ToolSettingsTab.setCurrentIndex(4)
validationPassed = False
else:
print '>>>> we should never be here. potential bug. 1' # LEO: added this just to help when testing. we'll remove it later.
elif tab == 'Wordlists':
print 'Coming back from wordlists.'
elif tab == 'Automated Attacks':
print 'Coming back from automated attacks.'
else:
print '>>>> we should never be here. potential bug. 2' # LEO: added this just to help when testing. we'll remove it later.
print 'DEBUG: current tab is valid: ' + str(validationPassed)
return validationPassed
#def generalTabValidate(self):
def validateGeneralTab(self):
validationPassed = self.validateNumeric(self.screenshotTextinput)
self.toggleRedBorder(self.webServicesTextinput, False)
for service in str(self.webServicesTextinput.text()).split(','):# TODO: this is too strict! no spaces or comma allowed? we can clean up for the user in some simple cases. actually, i'm not sure we even need to split.
if not validateString(service):
self.toggleRedBorder(self.webServicesTextinput, True)
validationPassed = False
break
return validationPassed
#def bruteTabValidate(self):
def validateBruteTab(self): # LEO: do NOT change the order of the AND statements otherwise validation may not take place if first condition is False
validationPassed = self.validatePath(self.userlistPath)
validationPassed = self.validatePath(self.passwordlistPath) and validationPassed
validationPassed = self.validateString(self.defaultUserText) and validationPassed
validationPassed = self.validateString(self.defaultPassText) and validationPassed
return validationPassed
def toolPathsValidate(self):
validationPassed = self.validateFile(self.nmapPathInput)
validationPassed = self.validateFile(self.hydraPathInput) and validationPassed
validationPassed = self.validateFile(self.cutycaptPathInput) and validationPassed
validationPassed = self.validateFile(self.textEditorPathInput) and validationPassed
return validationPassed
# def commandTabsValidate(self): # LEO: renamed and refactored
def validateCommandTabs(self, nameInput, labelInput, commandInput): # only validates the tool name, label and command fields for host/port/terminal tabs
validationPassed = True
if self.validationPassed == False: # the self.validationPassed comes from the focus out event
self.toggleRedBorder(nameInput, True) # TODO: this seems like a dodgy way to do it - functions should not depend on hope :) . maybe it's better to simply validate again. code will be clearer too.
validationPassed = False
else:
self.toggleRedBorder(nameInput, False)
validationPassed = self.validateStringWithSpace(labelInput) and validationPassed
validationPassed = self.validateCommandFormat(commandInput) and validationPassed
return validationPassed
# avoid using the same code for the selected tab. returns the fields for the current visible tab (host/ports/terminal)
# TODO: don't like this too much. seems like we could just use parameters in the validate tool name function
def selectGroup(self):
tabSelected = -1
if self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Host Commands':
tabSelected = 1
elif self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Port Commands':
tabSelected = 2
elif self.ToolSettingsTab.tabText(self.ToolSettingsTab.currentIndex()) == 'Terminal Commands':
tabSelected = 3
if self.previousToolTab == 'Host Commands' or tabSelected == 1:
tmpWidget = self.toolForHostsTableWidget
tmpActionLineEdit = self.hostActionNameText
tmpLabelLineEdit = self.hostLabelText
tmpCommandLineEdit = self.hostCommandText
actions = self.settings.hostActions
tableRow = self.hostTableRow
if self.previousToolTab == 'Port Commands' or tabSelected == 2:
tmpWidget = self.toolForServiceTableWidget
tmpActionLineEdit = self.portActionNameText
tmpLabelLineEdit = self.portLabelText
tmpCommandLineEdit = self.portCommandText
actions = self.settings.portActions
tableRow = self.portTableRow
if self.previousToolTab == 'Terminal Commands' or tabSelected == 3:
tmpWidget = self.toolForTerminalTableWidget
tmpActionLineEdit = self.terminalActionNameText
tmpLabelLineEdit = self.terminalLabelText
tmpCommandLineEdit = self.terminalCommandText
actions = self.settings.portTerminalActions
tableRow = self.terminalTableRow
return tmpWidget, tmpActionLineEdit, tmpLabelLineEdit, tmpCommandLineEdit, actions, tableRow
# def validateInput(self): # LEO: renamed
def validateToolName(self): # called when there is a focus out event. only validates the tool name (key) for host/port/terminal tabs
selectGroup = self.selectGroup()
tmpWidget = selectGroup[0]
tmplineEdit = selectGroup[1]
actions = selectGroup[4]
row = selectGroup[5]
if tmplineEdit:
row = tmpWidget.currentRow()
if row != -1: # LEO: when the first condition is True the validateUniqueToolName is never called (bad if we want to show a nice error message for the unique key)
if not validateString(str(tmplineEdit.text())) or not self.validateUniqueToolName(tmpWidget, row, str(tmplineEdit.text())):
tmplineEdit.setStyleSheet("border: 1px solid red;")
tmpWidget.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
self.validationPassed = False
print 'the validation is: ' + str(self.validationPassed)
return self.validationPassed
else:
tmplineEdit.setStyleSheet("border: 1px solid grey;")
tmpWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.validationPassed = True
print 'the validation is: ' + str(self.validationPassed)
if tmpWidget.item(row,0).text() != str(actions[row][1]):
print 'difference found'
actions[row][1] = tmpWidget.item(row,0).text()
return self.validationPassed
#def validateUniqueKey(self, widget, tablerow, text): # LEO: renamed. +the function that calls this one already knows the selectGroup stuff so no need to duplicate.
def validateUniqueToolName(self, widget, tablerow, text): # LEO: the function that calls this one already knows the selectGroup stuff so no need to duplicate.
if tablerow != -1:
for row in [i for i in range(widget.rowCount()) if i not in [tablerow]]:
if widget.item(row,0).text() == text:
return False
return True
#def nmapValidate(self):
def validateStagedNmapTab(self): # LEO: renamed and fixed bugs. TODO: this function is being called way too often. something seems wrong in the overall logic
validationPassed = self.validateNmapPorts(self.stage1Input)
validationPassed = self.validateNmapPorts(self.stage2Input) and validationPassed
validationPassed = self.validateNmapPorts(self.stage3Input) and validationPassed
validationPassed = self.validateNmapPorts(self.stage4Input) and validationPassed
validationPassed = self.validateNmapPorts(self.stage5Input) and validationPassed
return validationPassed
##################### TOOLS / HOST COMMANDS FUNCTIONS #####################
def addToolForHost(self):
#if self.commandTabsValidate():
if self.validateCommandTabs(self.hostActionNameText, self.hostLabelText, self.hostCommandText):
currentRows = self.toolForHostsTableWidget.rowCount()
self.toolForHostsTableWidget.setRowCount(currentRows + 1)
self.toolForHostsTableWidget.setItem(currentRows, 0, QtGui.QTableWidgetItem())
self.toolForHostsTableWidget.item(self.toolForHostsTableWidget.rowCount()-1, 0).setText('New_Action_'+str(self.hostActionsNumber))
self.toolForHostsTableWidget.selectRow(currentRows)
self.settings.hostActions.append(['', 'New_Action_'+str(self.hostActionsNumber), ''])
self.hostActionsNumber +=1
self.updateToolForHostInformation()
def removeToolForHost(self):
row = self.toolForHostsTableWidget.currentRow()
# set default values to avoid the error when the first action is add and remove tools
self.hostActionNameText.setText('removed')
self.hostLabelText.setText('removed')
self.hostCommandText.setText('removed')
for tool in self.settings.hostActions:
if tool[1] == str(self.hostActionNameText.text()):
self.settings.hostActions.remove(tool)
break
self.toolForHostsTableWidget.removeRow(row)
self.toolForHostsTableWidget.selectRow(row-1)
self.hostTableRow = self.toolForHostsTableWidget.currentRow()
self.updateToolForHostInformation(False)
def updateHostActions(self):
self.settings.hostActions[self.hostTableRow][0] = str(self.hostLabelText.text())
self.settings.hostActions[self.hostTableRow][2] = str(self.hostCommandText.text())
# update variable -> do not update the values when a line is removed
def updateToolForHostInformation(self, update = True):
#if self.commandTabsValidate() == True:
if self.validateCommandTabs(self.hostActionNameText, self.hostLabelText, self.hostCommandText):
# do not update any values the first time or when the remove button is clicked
if self.hostTableRow == -1 or update == False:
pass
else:
self.updateHostActions()
# self.hostLabelText.setStyleSheet("border: 1px solid grey;")
# self.hostCommandText.setStyleSheet("border: 1px solid grey;")
self.hostTableRow = self.toolForHostsTableWidget.currentRow()
self.hostLabelText.setReadOnly(False)
if self.toolForHostsTableWidget.item(self.hostTableRow, 0) is not None:
key = self.toolForHostsTableWidget.item(self.hostTableRow, 0).text()
for tool in self.settings.hostActions:
if tool[1] == key:
self.hostActionNameText.setText(tool[1])
self.hostLabelText.setText(tool[0])
self.hostCommandText.setText(tool[2])
else:
self.toolForHostsTableWidget.selectRow(self.hostTableRow)
# this function is used to REAL TIME update the tool table when a user enters a edit a tool name in the HOST/PORT/TERMINAL commands tabs
# LEO: this one replaces updateToolForHostTable + updateToolForServicesTable + updateToolForTerminalTable
def realTimeToolNameUpdate(self, tablewidget, text): # the name still sucks, sorry. at least it's refactored
row = tablewidget.currentRow()
if row != -1:
tablewidget.item(row, 0).setText(str(text))
##################### TOOLS / PORT COMMANDS FUNCTIONS #####################
def addToolForService(self):
#if self.commandTabsValidate():
if self.validateCommandTabs(self.portActionNameText, self.portLabelText, self.portCommandText):
currentRows = self.toolForServiceTableWidget.rowCount()
self.toolForServiceTableWidget.setRowCount(currentRows + 1)
self.toolForServiceTableWidget.setItem(currentRows, 0, QtGui.QTableWidgetItem())
self.toolForServiceTableWidget.item(self.toolForServiceTableWidget.rowCount()-1, 0).setText('New_Action_'+str(self.portActionsNumber))
self.toolForServiceTableWidget.selectRow(currentRows)
self.settings.portActions.append(['', 'New_Action_'+str(self.portActionsNumber), ''])
self.portActionsNumber +=1
self.updateToolForServiceInformation()
def removeToolForService(self):
row = self.toolForServiceTableWidget.currentRow()
self.portActionNameText.setText('removed')
self.portLabelText.setText('removed')
self.portCommandText.setText('removed')
for tool in self.settings.portActions:
if tool[1] == str(self.portActionNameText.text()):
self.settings.portActions.remove(tool)
break
self.toolForServiceTableWidget.removeRow(row)
self.toolForServiceTableWidget.selectRow(row-1)
self.portTableRow = self.toolForServiceTableWidget.currentRow()
self.updateToolForServiceInformation(False)
def updatePortActions(self):
self.settings.portActions[self.portTableRow][0] = str(self.portLabelText.text())
self.settings.portActions[self.portTableRow][2] = str(self.portCommandText.text())
def updateToolForServiceInformation(self, update = True):
#if self.commandTabsValidate() == True:
if self.validateCommandTabs(self.portActionNameText, self.portLabelText, self.portCommandText):
# the first time do not update anything
if self.portTableRow == -1 or update == False:
print 'no update'
pass
else:
print 'update done'
self.updatePortActions()
# self.portLabelText.setStyleSheet("border: 1px solid grey;")
# self.portCommandText.setStyleSheet("border: 1px solid grey;")
self.portTableRow = self.toolForServiceTableWidget.currentRow()
self.portLabelText.setReadOnly(False)
if self.toolForServiceTableWidget.item(self.portTableRow, 0) is not None:
key = self.toolForServiceTableWidget.item(self.portTableRow, 0).text()
for tool in self.settings.portActions:
if tool[1] == key:
self.portActionNameText.setText(tool[1])
self.portLabelText.setText(tool[0])
self.portCommandText.setText(tool[2])
# for the case that the tool (ex. new added tool) does not have services assigned
if len(tool) == 4:
servicesList = tool[3].split(',')
self.terminalServicesActiveTable.setRowCount(len(servicesList))
for i in range(len(servicesList)):
self.terminalServicesActiveTable.setItem(i, 0, QtGui.QTableWidgetItem())
self.terminalServicesActiveTable.item(i, 0).setText(str(servicesList[i]))
else:
self.toolForServiceTableWidget.selectRow(self.portTableRow)
##################### TOOLS / TERMINAL COMMANDS FUNCTIONS #####################
def addToolForTerminal(self):
#if self.commandTabsValidate():
if self.validateCommandTabs(self.terminalActionNameText, self.terminalLabelText, self.terminalCommandText):
currentRows = self.toolForTerminalTableWidget.rowCount()
self.toolForTerminalTableWidget.setRowCount(currentRows + 1)
self.toolForTerminalTableWidget.setItem(currentRows, 0, QtGui.QTableWidgetItem())
self.toolForTerminalTableWidget.item(self.toolForTerminalTableWidget.rowCount()-1, 0).setText('New_Action_'+str(self.terminalActionsNumber))
self.toolForTerminalTableWidget.selectRow(currentRows)
self.settings.portTerminalActions.append(['', 'New_Action_'+str(self.terminalActionsNumber), ''])
self.terminalActionsNumber +=1
self.updateToolForTerminalInformation()
def removeToolForTerminal(self):
row = self.toolForTerminalTableWidget.currentRow()
self.terminalActionNameText.setText('removed')
self.terminalLabelText.setText('removed')
self.terminalCommandText.setText('removed')
for tool in self.settings.portTerminalActions:
if tool[1] == str(self.terminalActionNameText.text()):
self.settings.portTerminalActions.remove(tool)
break
self.toolForTerminalTableWidget.removeRow(row)
self.toolForTerminalTableWidget.selectRow(row-1)
self.portTableRow = self.toolForTerminalTableWidget.currentRow()
self.updateToolForTerminalInformation(False)
def updateTerminalActions(self):
self.settings.portTerminalActions[self.terminalTableRow][0] = str(self.terminalLabelText.text())
self.settings.portTerminalActions[self.terminalTableRow][2] = str(self.terminalCommandText.text())
def updateToolForTerminalInformation(self, update = True):
#if self.commandTabsValidate() == True:
if self.validateCommandTabs(self.terminalActionNameText, self.terminalLabelText, self.terminalCommandText):
# do not update anything the first time or when you remove a line
if self.terminalTableRow == -1 or update == False:
pass
else:
self.updateTerminalActions()
# self.terminalLabelText.setStyleSheet("border: 1px solid grey;")
# self.terminalCommandText.setStyleSheet("border: 1px solid grey;")
self.terminalTableRow = self.toolForTerminalTableWidget.currentRow()
self.terminalLabelText.setReadOnly(False)
if self.toolForTerminalTableWidget.item(self.terminalTableRow, 0) is not None:
key = self.toolForTerminalTableWidget.item(self.terminalTableRow, 0).text()
for tool in self.settings.portTerminalActions:
if tool[1] == key:
self.terminalActionNameText.setText(tool[1])
self.terminalLabelText.setText(tool[0])
self.terminalCommandText.setText(tool[2])
# for the case that the tool (ex. new added tool) does not have any service assigned
if len(tool) == 4:
servicesList = tool[3].split(',')
self.terminalServicesActiveTable.setRowCount(len(servicesList))
for i in range(len(servicesList)):
self.terminalServicesActiveTable.setItem(i, 0, QtGui.QTableWidgetItem())
self.terminalServicesActiveTable.item(i, 0).setText(str(servicesList[i]))
else:
self.toolForTerminalTableWidget.selectRow(self.terminalTableRow)
##################### TOOLS / AUTOMATED ATTACKS FUNCTIONS #####################
def enableAutoToolsTab(self): # when 'Run automated attacks' is checked this function is called
if self.enableAutoAttacks.isChecked():
self.AutoAttacksSettingsTab.setTabEnabled(1,True)
else:
self.AutoAttacksSettingsTab.setTabEnabled(1,False)
#def selectDefaultServices(self): # toggles select/deselect all default creds checkboxes
def toggleDefaultServices(self): # toggles select/deselect all default creds checkboxes
for service in self.defaultServicesList:
if not self.typeDic[service][2].isChecked() == self.checkDefaultCred.isChecked():
self.typeDic[service][2].toggle()
#def addRemoveServices(self, add=True):
def moveService(self, src, dst): # in the multiple choice widget (port/terminal commands tabs) it transfers services bidirectionally
if src.selectionModel().selectedRows():
row = src.currentRow()
dst.setRowCount(dst.rowCount() + 1)
dst.setItem(dst.rowCount() - 1, 0, QtGui.QTableWidgetItem())
dst.item(dst.rowCount() - 1, 0).setText(str(src.item(row, 0).text()))
src.removeRow(row)
##################### SETUP FUNCTIONS #####################
def setupLayout(self):
self.setModal(True)
self.setWindowTitle('Settings')
self.setFixedSize(900, 500)
self.flayout = QtGui.QVBoxLayout()
self.settingsTabWidget = QtGui.QTabWidget()
self.settingsTabWidget.setTabBar(SettingsTabBarWidget(width=200,height=25))
self.settingsTabWidget.setTabPosition(QtGui.QTabWidget.West) # put the tab titles on the left
# left tab menu items
self.GeneralSettingsTab = QtGui.QWidget()
self.BruteSettingsTab = QtGui.QWidget()
self.ToolSettingsTab = QtGui.QTabWidget()
self.WordlistsSettingsTab = QtGui.QTabWidget()
self.AutoAttacksSettingsTab = QtGui.QTabWidget()
self.setupGeneralTab()
self.setupBruteTab()
self.setupToolsTab()
self.setupAutomatedAttacksTab()
self.settingsTabWidget.addTab(self.GeneralSettingsTab,"General")
self.settingsTabWidget.addTab(self.BruteSettingsTab,"Brute")
self.settingsTabWidget.addTab(self.ToolSettingsTab,"Tools")
self.settingsTabWidget.addTab(self.WordlistsSettingsTab,"Wordlists")
self.settingsTabWidget.addTab(self.AutoAttacksSettingsTab,"Automated Attacks")
self.settingsTabWidget.setCurrentIndex(0)
self.flayout.addWidget(self.settingsTabWidget)
self.horLayout1 = QtGui.QHBoxLayout()
self.cancelButton = QPushButton('Cancel')
self.cancelButton.setMaximumSize(60, 30)
self.applyButton = QPushButton('Apply')
self.applyButton.setMaximumSize(60, 30)
self.spacer2 = QSpacerItem(750,0)
self.horLayout1.addItem(self.spacer2)
self.horLayout1.addWidget(self.applyButton)
self.horLayout1.addWidget(self.cancelButton)
self.flayout.addLayout(self.horLayout1)
self.setLayout(self.flayout)
def setupGeneralTab(self):
self.terminalLabel = QtGui.QLabel()
self.terminalLabel.setText('Terminal')
self.terminalLabel.setFixedWidth(150)
self.terminalComboBox = QtGui.QComboBox()
self.terminalComboBox.setFixedWidth(150)
self.terminalComboBox.setMinimumContentsLength(3)
self.terminalComboBox.setStyleSheet("QComboBox { combobox-popup: 0; }");
self.terminalComboBox.setCurrentIndex(0)
self.hlayout1 = QtGui.QHBoxLayout()
self.hlayout1.addWidget(self.terminalLabel)
self.hlayout1.addWidget(self.terminalComboBox)
self.hlayout1.addStretch()
self.label3 = QtGui.QLabel()
self.label3.setText('Maximum processes')
self.label3.setFixedWidth(150)
self.fastProcessesNumber = []
for i in range(1, 50):
self.fastProcessesNumber.append(str(i))
self.fastProcessesComboBox = QtGui.QComboBox()
self.fastProcessesComboBox.insertItems(0, self.fastProcessesNumber)
self.fastProcessesComboBox.setMinimumContentsLength(3)
self.fastProcessesComboBox.setStyleSheet("QComboBox { combobox-popup: 0; }");
self.fastProcessesComboBox.setCurrentIndex(19)
self.fastProcessesComboBox.setFixedWidth(150)
self.fastProcessesComboBox.setMaxVisibleItems(3)
self.hlayoutGeneral_4 = QtGui.QHBoxLayout()
self.hlayoutGeneral_4.addWidget(self.label3)
self.hlayoutGeneral_4.addWidget(self.fastProcessesComboBox)
self.hlayoutGeneral_4.addStretch()
self.label1 = QtGui.QLabel()
self.label1.setText('Screenshot timeout')
self.label1.setFixedWidth(150)
self.screenshotTextinput = QtGui.QLineEdit()
self.screenshotTextinput.setFixedWidth(150)
self.hlayoutGeneral_2 = QtGui.QHBoxLayout()
self.hlayoutGeneral_2.addWidget(self.label1)
self.hlayoutGeneral_2.addWidget(self.screenshotTextinput)
self.hlayoutGeneral_2.addStretch()
self.label2 = QtGui.QLabel()
self.label2.setText('Web services')
self.label2.setFixedWidth(150)
self.webServicesTextinput = QtGui.QLineEdit()
self.webServicesTextinput.setFixedWidth(350)
self.hlayoutGeneral_3 = QtGui.QHBoxLayout()
self.hlayoutGeneral_3.addWidget(self.label2)
self.hlayoutGeneral_3.addWidget(self.webServicesTextinput)
self.hlayoutGeneral_3.addStretch()
self.checkStoreClearPW = QtGui.QCheckBox()
self.checkStoreClearPW.setText('Store cleartext passwords on exit')
self.hlayoutGeneral_6 = QtGui.QHBoxLayout()
self.hlayoutGeneral_6.addWidget(self.checkStoreClearPW)
self.checkBlackBG = QtGui.QCheckBox()
self.checkBlackBG.setText('Use black backgrounds for tool output')
self.hlayout2 = QtGui.QHBoxLayout()
self.hlayout2.addWidget(self.checkBlackBG)
self.vlayoutGeneral = QtGui.QVBoxLayout(self.GeneralSettingsTab)
self.vlayoutGeneral.addLayout(self.hlayout1)
self.vlayoutGeneral.addLayout(self.hlayoutGeneral_4)
self.vlayoutGeneral.addLayout(self.hlayoutGeneral_2)
self.vlayoutGeneral.addLayout(self.hlayoutGeneral_3)
self.vlayoutGeneral.addLayout(self.hlayoutGeneral_6)
self.vlayoutGeneral.addLayout(self.hlayout2)
self.generalSpacer = QSpacerItem(10,350)
self.vlayoutGeneral.addItem(self.generalSpacer)
def setupBruteTab(self):
self.vlayoutBrute = QtGui.QVBoxLayout(self.BruteSettingsTab)
self.label5 = QtGui.QLabel()
self.label5.setText('Username lists path')
self.label5.setFixedWidth(150)
self.userlistPath = QtGui.QLineEdit()
self.userlistPath.setFixedWidth(350)
self.browseUsersListButton = QPushButton('Browse')
self.browseUsersListButton.setMaximumSize(80, 30)
self.hlayoutGeneral_7 = QtGui.QHBoxLayout()
self.hlayoutGeneral_7.addWidget(self.label5)
self.hlayoutGeneral_7.addWidget(self.userlistPath)
self.hlayoutGeneral_7.addWidget(self.browseUsersListButton)
self.hlayoutGeneral_7.addStretch()
self.label6 = QtGui.QLabel()
self.label6.setText('Password lists path')
self.label6.setFixedWidth(150)
self.passwordlistPath = QtGui.QLineEdit()
self.passwordlistPath.setFixedWidth(350)