当前位置: 首页 > article >正文

Navicat For Mysql 1112 导出密码破解 python

  1. 导出连接;

2.选择需要导出的连接,勾选导出密码;

3.查看导出的connections.ncx文件,找到Password字段值;

Password="FDBA203EE85CA9D242EFD22B4AEBCE47"

4.替换代码中位置:

from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
import hashlib
import binascii

class NavicatPassword:
    def __init__(self, version=12):
        self.version = version
        self.aes_key = b'libcckeylibcckey'
        self.aes_iv = b'libcciv libcciv '
        self.blow_string = b'3DC5CA39'
        self.blow_key = hashlib.sha1(self.blow_string).digest()
        self.blow_iv = bytes.fromhex('d9c7c3c8870d64bd')

    def encrypt(self, string):
        if self.version == 11:
            return self.encrypt_eleven(string)
        elif self.version == 12:
            return self.encrypt_twelve(string)
        else:
            return None

    def decrypt(self, string):
        if self.version == 11:
            return self.decrypt_eleven(string)
        elif self.version == 12:
            return self.decrypt_twelve(string)
        else:
            return None

    def encrypt_eleven(self, string):
        string = string.encode('utf-8')
        round_count = len(string) // 8
        left_length = len(string) % 8
        result = b''
        current_vector = self.blow_iv

        for i in range(round_count):
            block = string[i * 8:(i + 1) * 8]
            temp = self.encrypt_block(self.xor_bytes(block, current_vector))
            current_vector = self.xor_bytes(current_vector, temp)
            result += temp

        if left_length:
            current_vector = self.encrypt_block(current_vector)
            result += self.xor_bytes(string[round_count * 8:], current_vector)

        return binascii.hexlify(result).upper().decode('utf-8')

    def encrypt_twelve(self, string):
        cipher = Cipher(algorithms.AES(self.aes_key), modes.CBC(self.aes_iv), backend=default_backend())
        encryptor = cipher.encryptor()
        padded_string = self.pad(string.encode('utf-8'))
        encrypted = encryptor.update(padded_string) + encryptor.finalize()
        return binascii.hexlify(encrypted).upper().decode('utf-8')

    def decrypt_eleven(self, upper_string):
        string = binascii.unhexlify(upper_string.lower())
        round_count = len(string) // 8
        left_length = len(string) % 8
        result = b''
        current_vector = self.blow_iv

        for i in range(round_count):
            encrypted_block = string[i * 8:(i + 1) * 8]
            temp = self.xor_bytes(self.decrypt_block(encrypted_block), current_vector)
            current_vector = self.xor_bytes(current_vector, encrypted_block)
            result += temp

        if left_length:
            current_vector = self.encrypt_block(current_vector)
            result += self.xor_bytes(string[round_count * 8:], current_vector)

        return result.decode('utf-8')

    def decrypt_twelve(self, upper_string):
        string = binascii.unhexlify(upper_string.lower())
        cipher = Cipher(algorithms.AES(self.aes_key), modes.CBC(self.aes_iv), backend=default_backend())
        decryptor = cipher.decryptor()
        decrypted = decryptor.update(string) + decryptor.finalize()
        return self.unpad(decrypted).decode('utf-8')

    def encrypt_block(self, block):
        cipher = Cipher(algorithms.Blowfish(self.blow_key), modes.ECB(), backend=default_backend())
        encryptor = cipher.encryptor()
        return encryptor.update(block) + encryptor.finalize()

    def decrypt_block(self, block):
        cipher = Cipher(algorithms.Blowfish(self.blow_key), modes.ECB(), backend=default_backend())
        decryptor = cipher.decryptor()
        return decryptor.update(block) + decryptor.finalize()

    def xor_bytes(self, str1, str2):
        return bytes(a ^ b for a, b in zip(str1, str2))

    def pad(self, data):
        pad_length = 16 - (len(data) % 16)
        return data + bytes([pad_length] * pad_length)

    def unpad(self, data):
        pad_length = data[-1]
        return data[:-pad_length]

# 使用示例
navicat_password = NavicatPassword(11)
#navicat_password = NavicatPassword(12)
# 解密示例
decrypted = navicat_password.decrypt('FDBA203EE85CA9D242EFD22B4AEBCE47')
print(decrypted)

输出:


http://www.kler.cn/a/507847.html

相关文章:

  • 微服务中引入消息队列的利弊
  • linux之进程信号(初识信号,信号的产生)
  • ESP8266固件烧录
  • 15. 三数之和【力扣】--三指针
  • 蓝桥杯_B组_省赛_2022(用作博主自己学习)
  • 微信小程序集成Vant Weapp移动端开发的框架
  • PHP生产管理系统
  • 算法-最大连续1的个数
  • IntelliJ IDEA 路径问题总结:如何配置并显示当前工作目录
  • Python学习之旅:入门阶段(七)数据结构
  • 【C++】反向迭代器
  • Kotlin语言的正则表达式
  • wordpress zibll 2025款新页脚-6ke论坛
  • uni-app:动态禁止下拉列表展示情况(如果下拉列表数据为空就拦截下拉框展示,显示提示信息)
  • LeetCode 111.二叉树的最小深度
  • 【原创】大数据治理入门(1)《大数据治理入门:为什么重要?》入门必看 高赞实用
  • SpringBoot3集成Sa-Token详解
  • windows下安装并使用node.js
  • 【Python】第二弹---深入理解编程基础:从常量、变量到注释的全面解析
  • Docker 镜像加速的配置
  • thinkphp:实现压缩文件上传、解压、文件更名、压缩包删除功能,增加trycatch
  • MyBatis基于XML的详细使用-缓存
  • 用户中心项目教程(一)--Ant design pro初始化的学习和使用
  • 什么是.NET中的反射,它有哪些应用场景
  • 包装类和简单认识泛型
  • RPA赋能内容创作:打造小红书入门词语图片的全自动化流程