hey i have this code
when starting the Process to make database it freeze at all what should i do?
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
import sys
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(400, 300)
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "memo md5 crypter", None, QtGui.QApplication.UnicodeUTF8))
self.label = QtGui.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(50, 20, 321, 71))
self.label.setText(QtGui.QApplication.translate("Dialog", "<!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\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:26pt; font-weight:600;\">memo md5 cracker</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
self.label.setObjectName(_fromUtf8("label"))
self.md5hash = QtGui.QLineEdit(Dialog)
self.md5hash.setGeometry(QtCore.QRect(70, 100, 291, 27))
self.md5hash.setObjectName(_fromUtf8("md5hash"))
self.label_2 = QtGui.QLabel(Dialog)
self.label_2.setGeometry(QtCore.QRect(30, 100, 41, 17))
self.label_2.setText(QtGui.QApplication.translate("Dialog", "md5:", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setObjectName(_fromUtf8("label_2"))
self.progress = QtGui.QProgressBar(Dialog)
self.progress.setGeometry(QtCore.QRect(20, 260, 361, 23))
self.progress.setProperty("value", 0)
self.progress.setObjectName(_fromUtf8("progress"))
self.generate = QtGui.QPushButton(Dialog)
self.generate.setGeometry(QtCore.QRect(20, 210, 151, 27))
self.generate.setText(QtGui.QApplication.translate("Dialog", "generate data base", None, QtGui.QApplication.UnicodeUTF8))
self.generate.setObjectName(_fromUtf8("generate"))
self.check = QtGui.QPushButton(Dialog)
self.check.setGeometry(QtCore.QRect(180, 210, 97, 27))
self.check.setText(QtGui.QApplication.translate("Dialog", "check hash", None, QtGui.QApplication.UnicodeUTF8))
self.check.setObjectName(_fromUtf8("check"))
self.quit = QtGui.QPushButton(Dialog)
self.quit.setGeometry(QtCore.QRect(290, 210, 97, 27))
self.quit.setText(QtGui.QApplication.translate("Dialog", "Quit", None, QtGui.QApplication.UnicodeUTF8))
self.quit.setObjectName(_fromUtf8("quit"))
self.label_3 = QtGui.QLabel(Dialog)
self.label_3.setGeometry(QtCore.QRect(30, 140, 67, 17))
self.label_3.setText(QtGui.QApplication.translate("Dialog", "statue:", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setObjectName(_fromUtf8("label_3"))
self.statue = QtGui.QLabel(Dialog)
self.statue.setGeometry(QtCore.QRect(80, 135, 301, 31))
self.statue.setText(QtGui.QApplication.translate("Dialog", "idle", None, QtGui.QApplication.UnicodeUTF8))
self.statue.setObjectName(_fromUtf8("statue"))
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.quit, QtCore.SIGNAL(_fromUtf8("clicked()")), Dialog.close)
QtCore.QObject.connect(self.generate, QtCore.SIGNAL(_fromUtf8("clicked()")), self.generatefun)
QtCore.QObject.connect(self.check, QtCore.SIGNAL(_fromUtf8("clicked()")), self.checkfun)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
pass
def generatefun(self):
import anydbm
import string
import hashlib
from itertools import product
from multiprocessing import Process
t1=Process(name="t1", target=self.g1)
t1.start()
t1.join()
t2=Process(name="t2", target=self.g2)
t2.start()
t2.join()
def g1(self):
import hashlib
from itertools import product
import anydbm
import string
str=string.printable
x1=1
md1=hashlib.md5()
db1=anydbm.open("md1.dat", "c")
while x1<100:
iter1=product(str, repeat=x1)
for i1 in iter1:
ij1="".join(i1)
md1.update(ij1)
db1[md1.hexdigest()]=ij1
self.changepro(x1)
x1=x1+1
db1.close()
self.changepro(0)
def g2(self):
import hashlib
from itertools import product
import anydbm
import string
str=string.printable
x2=100
md2=hashlib.md5()
db2=anydbm.open("md2.dat", "c")
while x2<200:
iter2=product(str, repeat=x2)
for i2 in iter2:
ij2="".join(i2)
md2.update(ij2)
md2.update(ij2)
db2[md2.hexdigest()]=ij2
self.changepro(x2-100)
x2=x2+1
self.changepro(0)
db2.close()
def checker(self, md5input):
import hashlib
from itertools import product
import anydbm
try:
db1=anydbm.open("md1.dat", "r")
except IOError:
self.changeresult("data base 1 not found!")
try:
db2=anydbm.open("md2.dat", "r")
except IOError:
self.changeresult("data base 2 not found")
if db1[md5input]:
self.changeresult(db1[md5input])
db1.close()
db2.close()
elif db2[md5input]:
self.changeresult(db2[md5input])
db1.close()
db2.close()
else:
self.changeresult("hash not found in the data base")
db1.close()
db2.close()
def checkfun(self):
from multiprocessing import Process
c1=Process(name="c1", target=self.checker)
c1.start()
def changeresult(self, texthere):
self.statue.setText(QtGui.QApplication.translate("Dialog", texthere, None, QtGui.QApplication.UnicodeUTF8))
def changepro(self, value):
self.progress.setProperty("value", int(value))
app = QtGui.QApplication(sys.argv)
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec_())