玩蛇网提供最新Python编程技术信息以及Python资源下载!

Access密码识别工具py2.7+PyQt实现方法

python 培训

这是一段非正式的python代码,只能达到预期的效果,还有很多地方并不完善。不能运用到正式的环境中。(在这个文件中所做的变更将会丢失!)

Access密码识别工具py2.7+PyQt实现方法,是用py 2.7 + pyqt4 + eric4搭建的。如下代码供测试使用!慎用

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'F:\Python\PyAccess.ui'
# Created: Thu Feb 23 15:07:51 2012
#      by: PyQt4 UI code generator 4.9.1


from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    _fromUtf8 = lambda s: s

class PYAccess(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(397, 91)
        MainWindow.setMaximumSize(QtCore.QSize(397, 91))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("Access.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralWidget = QtGui.QWidget(MainWindow)
        self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
        self.btnSelectFile = QtGui.QPushButton(self.centralWidget)
        self.btnSelectFile.setGeometry(QtCore.QRect(290, 20, 91, 23))
        self.btnSelectFile.setObjectName(_fromUtf8("btnSelectFile"))
        self.tbFilePath = QtGui.QLineEdit(self.centralWidget)
        self.tbFilePath.setGeometry(QtCore.QRect(20, 20, 261, 20))
        self.tbFilePath.setObjectName(_fromUtf8("tbFilePath"))
        self.tbVersion = QtGui.QLineEdit(self.centralWidget)
        self.tbVersion.setGeometry(QtCore.QRect(20, 50, 111, 20))
        self.tbVersion.setObjectName(_fromUtf8("tbVersion"))
        self.tbPassword = QtGui.QLineEdit(self.centralWidget)
        self.tbPassword.setGeometry(QtCore.QRect(160, 50, 221, 20))
        self.tbPassword.setObjectName(_fromUtf8("tbPassword"))
        MainWindow.setCentralWidget(self.centralWidget)

        self.retranslateUi(MainWindow)
        QtCore.QObject.connect(self.btnSelectFile, QtCore.SIGNAL(_fromUtf8("clicked()")), self.slotselectfile)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        
    def slotselectfile(self):
        fname = QtGui.QFileDialog.getOpenFileName(MainWindow, 'Open Access File','/*.mdb')
        if fname=='':
            return
        else:
            self.tbFilePath.setText(fname)
            # 未加密的文件0x42开始至0x61之前的每间隔一字节的数值
            baseByte=[0xbe, 0xec, 0x65, 0x9c, 0xfe,0x28, 0x2b, 0x8a, 0x6c, 0x7b,0xcd, 0xdf, 0x4f, 0x13, 0xf7,0xb1]
            # 标志 0x62 处的数值
            flagByte = 0x0c
            # 定义密码字符串
            password = '';
            # 读取方式打开文件并复制给fs
            fs=open(fname,'r')
            fs.seek(0x14)
            version='unknow'
            ver = ord(fs.read(1))
            if ver==1:
                version='Access2000'
            elif ver==0:
                version='Access97'
            fs.seek(0x42)
            bs=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
            integer = 0
            while integer < 33:
                tmpInt=ord(fs.read(1))
                bs[integer]=tmpInt
                integer=integer+1
            #标记
            flag = bs[32] ^ flagByte
            # 开始循环
            i = 0
            while i < 16:
                b = (baseByte[i] ^ bs[i * 2])
                if i % 2 == 0 and ver == 1:
                    b = b^flag;
                if b > 0 :
                    password = password + chr(b)
                i=i+1
            fs.close()
            self.tbVersion.setText(version)
            self.tbPassword.setText(password)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Access 数据库密码破解工具", None, QtGui.QApplication.UnicodeUTF8))
        self.btnSelectFile.setText(QtGui.QApplication.translate("MainWindow", " 选择文件 ...", None, QtGui.QApplication.UnicodeUTF8))
        self.tbFilePath.setText(QtGui.QApplication.translate("MainWindow", "Access文件路径,请点击右侧“选择文件” ", None, QtGui.QApplication.UnicodeUTF8))
        self.tbVersion.setText(QtGui.QApplication.translate("MainWindow", " 版本信息 ", None, QtGui.QApplication.UnicodeUTF8))
        self.tbPassword.setText(QtGui.QApplication.translate("MainWindow", " Access 文件密码 ",
2000
 None, QtGui.QApplication.UnicodeUTF8))

#www.iplaypython.com

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    MainWindow = QtGui.QMainWindow()
    ui = PYAccess()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

其它python密码相关源码文章推荐:
1、凯撒移位密码加密算法的Python3.0实现方法
2、Python获取web密码程序的脚本源代码

玩蛇网原创,转载请注明文章出处和来源网址:http://www.iplaypython.com/code/gui/ui2321.html



微信公众号搜索"玩蛇网Python之家"加关注,每日最新的Python资讯、图文视频教程可以让你一手全掌握。强烈推荐关注!

微信扫描下图可直接关注

玩蛇网Python新手QQ群,欢迎加入: ① 240764603 玩蛇网Python新手群
文章发布日期:2016-05-10 16:42 玩蛇网 www.iplaypython.com

上一篇:没有了
下一篇:最简易的python计算器实现源代码
评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
相关文章推荐
别人正在看
特别推荐
去顶部去底部