Exemplo n.º 1
0
    def __init__(self, parent=None):
        super(gui, self).__init__(parent)
        self.ui = Ui_GroupBox()
        self.ui.setupUi(self)
        self.setWindowIcon(QtGui.QIcon('icon.ico'))

        self.Settings_md2= QtGui.QAction('MD2', self)
        self.ui.settings_hashType.addAction(self.Settings_md2)
        self.Settings_md4= QtGui.QAction('MD4', self)
        self.ui.settings_hashType.addAction(self.Settings_md4)
        self.Settings_md5= QtGui.QAction('MD5', self)
        self.ui.settings_hashType.addAction(self.Settings_md5)
        self.Settings_sha1= QtGui.QAction('SHA-1', self)
        self.ui.settings_hashType.addAction(self.Settings_sha1)
        self.Settings_sha224= QtGui.QAction('SHA-224', self)
        self.ui.settings_hashType.addAction(self.Settings_sha224)
        self.Settings_sha256= QtGui.QAction('SHA-256', self)
        self.ui.settings_hashType.addAction(self.Settings_sha256)
        self.Settings_sha384= QtGui.QAction('SHA-384', self)
        self.ui.settings_hashType.addAction(self.Settings_sha384)
        self.Settings_sha512= QtGui.QAction('SHA-512', self)
        self.ui.settings_hashType.addAction(self.Settings_sha512)



        QtCore.QObject.connect(self.ui.start,QtCore.SIGNAL("clicked()"), self.start_brute)
        QtCore.QObject.connect(self.ui.stop,QtCore.SIGNAL("clicked()"), self.stop_brute)
        QtCore.QObject.connect(self.ui.Hash,QtCore.SIGNAL("returnPressed()"), self.start_brute)
        QtCore.QObject.connect(self.Settings_md2, QtCore.SIGNAL('triggered()'), self.setMD2)
        QtCore.QObject.connect(self.Settings_md4, QtCore.SIGNAL('triggered()'), self.setMD4)
        QtCore.QObject.connect(self.Settings_md5, QtCore.SIGNAL('triggered()'), self.setMD5)
        QtCore.QObject.connect(self.Settings_sha1, QtCore.SIGNAL('triggered()'), self.setSHA1)
        QtCore.QObject.connect(self.Settings_sha256, QtCore.SIGNAL('triggered()'), self.setSHA256)
        QtCore.QObject.connect(self.Settings_sha224, QtCore.SIGNAL('triggered()'), self.setSHA224)
        QtCore.QObject.connect(self.Settings_sha384, QtCore.SIGNAL('triggered()'), self.setSHA384)
        QtCore.QObject.connect(self.Settings_sha512, QtCore.SIGNAL('triggered()'), self.setSHA512)

        try:
            self.set=shelve.open("config",writeback=True)
        except:
            self.ui.results.setText("WARNING! Unable to save your settings!")
        try:
            self.htype=self.set["hash_type"]
        except:
            self.htype="md5"
        self.set["hash_type"]=self.htype
        self.set.sync()
        self.htype=self.set["hash_type"]
        self.ha=self.ui.Hash.text()
        self.wordLength=self.ui.word_len_spin.value()
        self.min_wordLength=self.ui.word_len_min_spin.value()
        self.thread1=Worker(self.ha,self.htype,self.wordLength,self.min_wordLength)
        self.connect(self.thread1, QtCore.SIGNAL('test(const QString)'), self.ui.results.setText)
Exemplo n.º 2
0
class gui(QtGui.QGroupBox):
    def __init__(self, parent=None):
        super(gui, self).__init__(parent)
        self.ui = Ui_GroupBox()
        self.ui.setupUi(self)
        self.setWindowIcon(QtGui.QIcon('icon.ico'))

        self.Settings_md2= QtGui.QAction('MD2', self)
        self.ui.settings_hashType.addAction(self.Settings_md2)
        self.Settings_md4= QtGui.QAction('MD4', self)
        self.ui.settings_hashType.addAction(self.Settings_md4)
        self.Settings_md5= QtGui.QAction('MD5', self)
        self.ui.settings_hashType.addAction(self.Settings_md5)
        self.Settings_sha1= QtGui.QAction('SHA-1', self)
        self.ui.settings_hashType.addAction(self.Settings_sha1)
        self.Settings_sha224= QtGui.QAction('SHA-224', self)
        self.ui.settings_hashType.addAction(self.Settings_sha224)
        self.Settings_sha256= QtGui.QAction('SHA-256', self)
        self.ui.settings_hashType.addAction(self.Settings_sha256)
        self.Settings_sha384= QtGui.QAction('SHA-384', self)
        self.ui.settings_hashType.addAction(self.Settings_sha384)
        self.Settings_sha512= QtGui.QAction('SHA-512', self)
        self.ui.settings_hashType.addAction(self.Settings_sha512)



        QtCore.QObject.connect(self.ui.start,QtCore.SIGNAL("clicked()"), self.start_brute)
        QtCore.QObject.connect(self.ui.stop,QtCore.SIGNAL("clicked()"), self.stop_brute)
        QtCore.QObject.connect(self.ui.Hash,QtCore.SIGNAL("returnPressed()"), self.start_brute)
        QtCore.QObject.connect(self.Settings_md2, QtCore.SIGNAL('triggered()'), self.setMD2)
        QtCore.QObject.connect(self.Settings_md4, QtCore.SIGNAL('triggered()'), self.setMD4)
        QtCore.QObject.connect(self.Settings_md5, QtCore.SIGNAL('triggered()'), self.setMD5)
        QtCore.QObject.connect(self.Settings_sha1, QtCore.SIGNAL('triggered()'), self.setSHA1)
        QtCore.QObject.connect(self.Settings_sha256, QtCore.SIGNAL('triggered()'), self.setSHA256)
        QtCore.QObject.connect(self.Settings_sha224, QtCore.SIGNAL('triggered()'), self.setSHA224)
        QtCore.QObject.connect(self.Settings_sha384, QtCore.SIGNAL('triggered()'), self.setSHA384)
        QtCore.QObject.connect(self.Settings_sha512, QtCore.SIGNAL('triggered()'), self.setSHA512)

        try:
            self.set=shelve.open("config",writeback=True)
        except:
            self.ui.results.setText("WARNING! Unable to save your settings!")
        try:
            self.htype=self.set["hash_type"]
        except:
            self.htype="md5"
        self.set["hash_type"]=self.htype
        self.set.sync()
        self.htype=self.set["hash_type"]
        self.ha=self.ui.Hash.text()
        self.wordLength=self.ui.word_len_spin.value()
        self.min_wordLength=self.ui.word_len_min_spin.value()
        self.thread1=Worker(self.ha,self.htype,self.wordLength,self.min_wordLength)
        self.connect(self.thread1, QtCore.SIGNAL('test(const QString)'), self.ui.results.setText)
    def stop_brute(self):
        self.thread1.stopped=True
        self.ui.results.setText("Stopped")
    def setMD2(self):
        self.htype="md2"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: MD2")
        self.set.sync()
    def setMD4(self):
        self.htype="md4"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: MD4")
        self.set.sync()
    def setMD5(self):
        self.htype="md5"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: MD5")
        self.set.sync()
    def setSHA1(self):
        self.htype="sha1"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: SHA-1")
        self.set.sync()
    def setSHA224(self):
        self.htype="sha224"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: SHA-224")
        self.set.sync()
    def setSHA256(self):
        self.htype="sha256"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: SHA-256")
        self.set.sync()
    def setSHA384(self):
        self.htype="sha384"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: SHA-384")
        self.set.sync()
    def setSHA512(self):
        self.htype="sha512"
        self.set["hash_type"]=self.htype
        self.ui.results.setText("Hashing algorythm: SHA-512")
        self.set.sync()
    def ShowMore(self):
        pass
    def ProcessData(self,data):
        self.ui.results.setText(data)
    def start_brute(self):
        self.ha=str(self.ui.Hash.text())
        self.wordLength=int(self.ui.word_len_spin.value())
        self.min_wordLength=int(self.ui.word_len_min_spin.value())

        THREADS=xrange(2)
        
        # TODO: tried to add parallel processing, but failed...

#a=StartWorkers(self,THREADS)
#a.run()

        #print self.ha,self.htype

#th_list=[]
#for thread in THREADS:
#     	th_list.append(Worker(self.ha,self.htype,self.wordLength,self.min_wordLength,thread))
#   for th in th_list:
#       	self.connect(th, QtCore.SIGNAL('test(const QString)'), self.ProcessData)
#       	self.connect(th, QtCore.SIGNAL('Important(const QString)'),self.ui.results.setText)
#       	th.start()

        self.thread1=Worker(self.ha,self.htype,self.wordLength,self.min_wordLength)
        self.connect(self.thread1, QtCore.SIGNAL('test(const QString)'), self.ProcessData)#self.ui.results.setText)
        self.connect(self.thread1, QtCore.SIGNAL('Important(const QString)'),self.ui.results.setText)
        self.thread1.start()