当前位置:首页 > 其他 > 查看Navicat保存的数据库密码

查看Navicat保存的数据库密码

其他10个月前 (08-18)

查看Navicat保存的数据库密码

mysql的root密码不知道谁设置过,需要从navicat保存的连接文件将密码读取出来


查看Navicat保存的数据库密码

幸亏navicat以前连接过


查看Navicat保存的数据库密码

打开navicat,文件--导出连接


查看Navicat保存的数据库密码

文本编辑器打开导出的connections.ncx,找到Password


浏览器打开

https://tool.lu/coderunner/


修改倒数第二行,将Password修改进去,运行代码

<?php
 
namespace FatSmallTools;
 
class NavicatPassword
{
    protected $version = 0;
    protected $aesKey = 'libcckeylibcckey';
    protected $aesIv = 'libcciv libcciv ';
    protected $blowString = '3DC5CA39';
    protected $blowKey = null;
    protected $blowIv = null;
    
    public function __construct($version = 12)
    {
        $this->version = $version;
        $this->blowKey = sha1('3DC5CA39', true);
        $this->blowIv = hex2bin('d9c7c3c8870d64bd');
    }
    
    public function encrypt($string)
    {
        $result = FALSE;
        switch ($this->version) {
            case 11:
                $result = $this->encryptEleven($string);
                break;
            case 12:
                $result = $this->encryptTwelve($string);
                break;
            default:
                break;
        }
        
        return $result;
    }
    
    protected function encryptEleven($string)
    {
        $round = intval(floor(strlen($string) / 8));
        $leftLength = strlen($string) % 8;
        $result = '';
        $currentVector = $this->blowIv;
        
        for ($i = 0; $i < $round; $i++) {
            $temp = $this->encryptBlock($this->xorBytes(substr($string, 8 * $i, 8), $currentVector));
            $currentVector = $this->xorBytes($currentVector, $temp);
            $result .= $temp;
        }
        
        if ($leftLength) {
            $currentVector = $this->encryptBlock($currentVector);
            $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
        }
        
        return strtoupper(bin2hex($result));
    }
    
    protected function encryptBlock($block)
    {
        return openssl_encrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING); 
    }
    
    protected function decryptBlock($block)
    {
        return openssl_decrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING); 
    }
    
    protected function xorBytes($str1, $str2)
    {
        $result = '';
        for ($i = 0; $i < strlen($str1); $i++) {
            $result .= chr(ord($str1[$i]) ^ ord($str2[$i]));
        }
        
        return $result;
    }
    
    protected function encryptTwelve($string)
    {
        $result = openssl_encrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
        return strtoupper(bin2hex($result));
    }
    
    public function decrypt($string)
    {
        $result = FALSE;
        switch ($this->version) {
            case 11:
                $result = $this->decryptEleven($string);
                break;
            case 12:
                $result = $this->decryptTwelve($string);
                break;
            default:
                break;
        }
        
        return $result;
    }
    
    protected function decryptEleven($upperString)
    {
        $string = hex2bin(strtolower($upperString));
        
        $round = intval(floor(strlen($string) / 8));
        $leftLength = strlen($string) % 8;
        $result = '';
        $currentVector = $this->blowIv;
        
        for ($i = 0; $i < $round; $i++) {
            $encryptedBlock = substr($string, 8 * $i, 8);
            $temp = $this->xorBytes($this->decryptBlock($encryptedBlock), $currentVector);
            $currentVector = $this->xorBytes($currentVector, $encryptedBlock);
            $result .= $temp;
        }
        
        if ($leftLength) {
            $currentVector = $this->encryptBlock($currentVector);
            $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
        }
        
        return $result;
    }
    
    protected function decryptTwelve($upperString)
    {
        $string = hex2bin(strtolower($upperString));
        return openssl_decrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
    }
}
 
 
use FatSmallTools\NavicatPassword;
 
//需要指定版本,11或12
$navicatPassword = new NavicatPassword(11);
//$navicatPassword = new NavicatPassword(12);
 
//解密
//$decode = $navicatPassword->decrypt('15057D7BA390');
$decode = $navicatPassword->decrypt('15BB394B902A25531C85');
echo $decode."\n";

查看Navicat保存的数据库密码

解密后得到root密码123@qq.com


查看Navicat保存的数据库密码

测试连接成功

本站所有文章均可随意转载,转载时请保留原文链接及作者。

本文链接:https://www.vos.cn/other/525.html

相关文章

万网免费主机设置子目录绑定二级域名

万网免费主机设置子目录绑定二级域名

万网免费主机后台没有子目录绑定子域名的功能,只能通过.htaccess文件重写规则来完成例子为 子目录名称为nexus,实现nexus.vmos.cn代替www.vmos.cn/nexusRewrit...

foxmail收取gmail 提示-ERR [AUTH] Web login required:http://mail.google.com/support/bin/

foxmail收取gmail 提示-ERR [AUTH] Web login required:http://mail.google.com/support/bin/

-ERR [AUTH] Web login required: http://mail.google.com/support/bin/answer.py?answer=78754会提示密码有...

N3700软路由配置

N3700软路由配置

最近想用ITX做个软路由用于替下华硕RT-N16,因为24小时开机要求功耗不能高,并且集成千兆环境,所以看上了DQ77KB这个板子。后来感觉功耗还可以降低,换为HP Hewlett-Packard 2...

pageadmin隐藏版权信息

pageadmin隐藏版权信息

头部titile隐藏打开/e/usercontrol/web_top.ascx增加<script language="javascript"> var&nb...

windows下使用dig命令测试公共DNS

windows下使用dig命令测试公共DNS

dig是Linux下用DNS查询信息的工具,全称是Domain Information Groper,与nslookup类似,但比它功能强大。windows下需要安装才可以使用。打开ftp://ftp...

H3C HDM默认密码

H3C HDM默认密码

HDM是Hardware Device Management在系统启动界面上直接看到DHCP分配给DHM的IP地址,进入BIOS也可以找到HDM口的IP地址,浏览器登录HDM控制台的默认用户名为adm...