- Java锁的逻辑(结合对象头和ObjectMonitor)
- 还在用饼状图?来瞧瞧这些炫酷的百分比可视化新图形(附代码实现)⛵
- 自动注册实体类到EntityFrameworkCore上下文,并适配ABP及ABPVNext
- 基于Sklearn机器学习代码实战
开发小组在测试环境基于 docker 构建和迁移一个 MySQL8.x 实例,过程中大意没有记录对应的用户密码,然后发现某开发同事本地 Navicat 记录了根用户,于是搜索是否能够反解析 Navicat 中的密码掩码(这里可以基本断定 Navicat 对密码是采用了对称加密算法),于是发现了这个仓库:
密码的解密算法显然是被泄露了,那么就可以利用起来。加之笔者之前花了一点点时间入门了一下 Go ,于是业余花了点时间编写了一个 GUI 工具。这个工具主要功能是:在 Windows 系统下,自动读取 Navicat 在注册列表中写入的所有(数据库)服务器连接数据作为列表展示,对于每个服务器连接数据的密码尝试进行解密。效果如下:
参考 how-does-navicat-encrypt-password 仓库,因为 Navicat 两种版本的对称加密算法的具体算法、秘钥和加密向量都被泄露了,得知:
Low
):使用 Blowfish/ECB/NoPadding
模式 High
):使用 AES/CBC/PKCS5Padding
模式 其中 AES/CBC/PKCS5Padding 实现是比较简单的, Blowfish/ECB/NoPadding 在 Go 的原生类库中刚好缺少了 ECB 解码器,只能仔细翻阅 how-does-navicat-encrypt-password 的 Java 版本代码并且强行转换为 Go 实现
func (l *LowVersionCipher) Decrypt(input string) (string, error) {
ciphertext, err := hex.DecodeString(input)
if err != nil {
return "", err
}
if len(ciphertext)%8 != 0 {
return "", errors.New("ciphertext length must be a multiple of 8")
}
plaintext := make([]byte, len(ciphertext))
cv := make([]byte, len(l.iv))
copy(cv, l.iv)
blocksLen := len(ciphertext) / blowfish.BlockSize
leftLen := len(ciphertext) % blowfish.BlockSize
decrypter := NewECBDecrypter(l.cipher)
for i := 0; i < blocksLen; i++ {
temp := make([]byte, blowfish.BlockSize)
copy(temp, ciphertext[i*blowfish.BlockSize:(i+1)*blowfish.BlockSize])
if err != nil {
panic(err)
}
decrypter.CryptBlocks(temp, temp)
xorBytes(temp, cv)
copy(plaintext[i*blowfish.BlockSize:(i+1)*blowfish.BlockSize], temp)
for j := 0; j < len(cv); j++ {
cv[j] ^= ciphertext[i*blowfish.BlockSize+j]
}
}
if leftLen != 0 {
decrypter.CryptBlocks(cv, cv)
temp := make([]byte, leftLen)
copy(temp, ciphertext[blocksLen*blowfish.BlockSize:])
xorBytes(temp, cv[:leftLen])
copy(plaintext[blocksLen*blowfish.BlockSize:], temp)
}
return string(plaintext), nil
}
func xorBytes(a []byte, b []byte) {
for i := 0; i < len(a); i++ {
aVal := int(a[i]) & 0xff // convert byte to integer
bVal := int(b[i]) & 0xff
a[i] = byte(aVal ^ bVal) // xor aVal and bVal and typecast to byte
}
}
接着基于 golang.org/x/sys/windows/registry 加载 Windows 系统注册列表下的服务器连接数据列表, Navicat 多个版本测试发现服务器连接数保存在注册列表的 Software\PremiumSoft\Navicat\Servers 目录下,只需要全量读取出来并且按照每个服务器连接数据的明细 k-v 一步一步解析即可。这个解析过程的伪代码如下:
const NsPath = `Software\PremiumSoft\Navicat\Servers`
nsp, _ := registry.OpenKey(registry.CURRENT_USER, NsPath, registry.READ)
subKeys, _ := nsp.ReadSubKeyNames(999)
var servers []*Server
for _, subKey := range subKeys {
serverPath := strings.Join([]string{NsPath, subKey}, `\`)
sp, _ := registry.OpenKey(registry.CURRENT_USER, serverPath, registry.READ)
// 数据库的版本
serverVersion, _, _ := sp.GetIntegerValue("ServerVersion")
// host
host, _, _ := sp.GetStringValue("Host")
// 用户名
username, _, _ := sp.GetStringValue("UserName")
// 密码密文
pwd, _, _ := sp.GetStringValue("Pwd")
// 端口,一般是3306
port, _, _ := sp.GetIntegerValue("Port")
realPwd := pwd
if (len(pwd) > 0){
// 解密得到密码明文
realPwd, _ = cipher.Decrypt(pwd)
}
servers = append(servers, &Server{...})
}
提醒 - 这个项目仅仅是提供参考和学习,供个人本地开发时候使用,切勿用于窃取他人的数据库密码。项目仓库:
顺带一提使用 fyne 做 GUI 开发效果还可以,不过目前这个库还存在比较多 BUG ,性能高的同时占用的资源也比较高.
(本文完 c-1-d e-a-20230802) 。
最后此篇关于基于Go编写一个可视化Navicat本地密码解析器的文章就讲到这里了,如果你想了解更多关于基于Go编写一个可视化Navicat本地密码解析器的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
Internal Server Error: /admin/account/customuser/add/ Traceback (most recent call last): File "C:\
有问题!虽然我发现几乎相似的线程但没有帮助:( 我编写了一个 php 脚本来从我的 MySQL 数据库中获取注册用户的数量。该脚本在我的本地主机上运行良好;它使用给定的用户名、密码和主机名,分别是“r
我正在做一项基于密码的作业,我将 key 和消息放在单独的数组中。我想创建第三个数组,其中包含围绕消息大小的 key ,如下所示: message keykeyk 我已经在这个问题上苦苦挣扎了一段时间
我的几个客户要求我实现图形密码检查器,例如 关于如何实现这种 UI 有什么想法吗? 最佳答案 试着看看这个:https://code.google.com/p/android-lockpattern/
我正在使用 MAMP,每次登录 phpMyAdmin 时,都会收到以下错误/警告消息: the configuration file now needs a secret passphrase (bl
我正在尝试通过将 Visual Studio 2013 连接到我的测试机来调试 WDF 驱动程序。它创建一个名为 WDKRemoteUser 的用户,并在进行测试时尝试自动登录。有人知道这个用户的密码
使用具有指定用户名和密码的 SVN 提交。我希望服务器抛出错误;所以我可以告诉我的用户他/她的密码错误。 相反,在使用错误密码提交后: svn commit "test_file.txt" --use
我正在尝试实现 friend 推荐。 它从节点“你”开始。而且,我想找到节点“安娜”。 换句话说,这是我的两个或更多 friend 共同认识的人。上面的示例节点是 Anna。 如果您的帮助,我将不胜感
我都尝试过 wget --user=myuser --password=mypassword myfile 和 wget --ftp-user=myuser --ftp-password=mypass
我的一位用户提示说,每当他尝试使用默认管理界面(Django 的管理员)添加新用户(auth.User)时,新用户名和密码都会自动填充他自己的。 问题是他在登录时要求 Firefox 记住他的用户名/
我们正在开发一款应用(当然)用于应用购买 (IAP)。我已完成指南中的所有操作以启用 iap,并且一切正常,直到我想要购买为止。 部分代码: MainViewController.m -(vo
我试图创建两个可选匹配项的并集(如下所示),但我得到的不是并集,而是两者的交集。我应该如何更改此查询以获得所需的联合? optional match (a:PA)-[r2:network*2]-(b:
我想将Ansible用作另一个Python软件的一部分。在该软件中,我有一个包含其用户名/密码的主机列表。 有没有一种方法可以将SSH连接的用户/密码传递给Ansible ad-hoc命令或以加密方式
嗨,我在使用xampp的Apache Web服务器上收到错误500。直到我使用.htaccess,.htpasswd文件,错误才出现。我搜索了,但找不到语法错误。我只有1张图片和要保护的索引文件。以下
我一直使用它来编辑用户帐户信息: $this->validate($request, [ 'password' => 'min:6', 'password_confirmation'
我需要使用InstallUtil来安装C# Windows服务。我需要设置服务登录凭据(用户名和密码)。这一切都需要默默地完成。 有没有办法做这样的事情: installutil.exe myserv
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
如果我有一个随机的、16 个字符长的字母数字盐(不同大小写),它是为每个用户生成和存储的,我是否还需要一个站点范围的盐? 换句话说,这样好吗? sha1($user_salt . $password)
我正在开发一个空白程序,该程序将允许用户创建一个帐户,以便他们可以存储其余额和提款/存款。用户输入用户名和密码后,如何存储这些信息以便用户可以登录并查看其余额?我不一定要尝试使其非常安全,我只是希望能
我正在尝试寻找一种通用方法来搜索没有链接到另一个节点或节点集的节点或节点集。例如,我能够找到特定类型(例如 :Style)的所有节点,这些节点以某种方式连接到一组特定的节点(例如 :MetadataR
我是一名优秀的程序员,十分优秀!