欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決Navicat數(shù)據(jù)庫(kù)連接成功但密碼忘記的問(wèn)題

 更新時(shí)間:2023年08月31日 11:36:34   作者:Covarde.H  
這篇文章給大家介紹了Navicat數(shù)據(jù)庫(kù)連接成功,密碼忘記如何解決,文中給大家介紹了兩種解決方法,有詳細(xì)的圖文講解,需要的朋友可以參考下

解決方法

一:通過(guò)注冊(cè)表找到數(shù)據(jù)庫(kù)連接的密碼,再通過(guò)PHP解密

具體操作:

1.用 win + R 快捷鍵打開(kāi)運(yùn)行窗口,輸入 regedit 打開(kāi)注冊(cè)表

2.在注冊(cè)表地址欄輸入下面內(nèi)容,查找Navicat密碼保存位置,回車(chē):

計(jì)算機(jī)\HKEY_CURRENT_USER\SOFTWARE\PremiumSoft\Navicat\Servers 

3.在servers目錄下,找到需要找回密碼的連接,鼠標(biāo)左鍵點(diǎn)擊,右側(cè)下拉找到名稱(chēng)為 pwd 的一項(xiàng),該項(xiàng)的數(shù)據(jù)即為密碼。右鍵,點(diǎn)擊修改,復(fù)制數(shù)據(jù):

4.使用 https://tool.lu/coderunner/ 在線(xiàn)工具,對(duì)復(fù)制下來(lái)的密碼15057D7BA390進(jìn)行解密

5.將以下php解密代碼復(fù)制到在線(xiàn)工具中,將復(fù)制的數(shù)據(jù)粘貼到代碼的倒數(shù)第二行,點(diǎn)擊執(zhí)行,即可得到密碼

PS:該工具首行不能空行,否則執(zhí)行會(huì)報(bào)錯(cuò);另外,在代碼倒數(shù)五六行需要指定Navicat版本

<?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(12);
$navicatPassword = new NavicatPassword(11);
//解密
$decode = $navicatPassword->decrypt('15057D7BA390');
echo $decode."\n";

二:通過(guò)Navicat導(dǎo)出連接,找到連接密碼,再通過(guò)PHP進(jìn)行解密

具體操作:

1.打開(kāi)Navicat,導(dǎo)航欄點(diǎn)擊“文件”,點(diǎn)擊“導(dǎo)出連接”,

2.選擇自己需要找回密碼的連接,并勾選左下角“導(dǎo)出密碼”,點(diǎn)擊“確定”

 3.打開(kāi)導(dǎo)出的文件,找到Password這一項(xiàng),將引號(hào)中的數(shù)據(jù)復(fù)制下來(lái)

4.打開(kāi)并使用方法一步驟4.中的在線(xiàn)工具和代碼,修改倒數(shù)第二行的內(nèi)容為步驟三保存的數(shù)據(jù)833E4ABBC56C89041A9070F043641E3B,點(diǎn)擊運(yùn)行

PS:由于我使用的是Navicat 12,在這種方法中需要修改代碼中倒數(shù)第五六行的版本,否則解析出來(lái)亂碼

以上就是解決Navicat數(shù)據(jù)庫(kù)連接成功但密碼忘記的問(wèn)題的詳細(xì)內(nèi)容,更多關(guān)于Navicat數(shù)據(jù)庫(kù)密碼忘記的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論