最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

如何解決Navicat已經(jīng)成功連接,密碼忘記的問題

 更新時間:2024年07月17日 10:39:59   作者:自行車在路上  
這篇文章主要介紹了如何解決Navicat已經(jīng)成功連接,密碼忘記的問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教

一直想寫一下這篇文章的總結(jié),因為有時真的忘記了,要去網(wǎng)上重新搜索一下之前用過的方法,因此這里記錄一下,也為了以后遇到這種問題可以直接看我的文章,而不是到處找,以下為實踐篇。

1. 如果是win,通過注冊表里去找對應(yīng)的數(shù)據(jù),用php解碼

去cmd里輸入

regedit

去到對應(yīng)的注冊表

查找Navicat的密碼保存位置

去到對應(yīng)的路徑下面

計算機\HKEY_CURRENT_USER\Software\PremiumSoft

可以看到

打開對應(yīng)的目錄,尋找一下servers下要找的數(shù)據(jù)庫,如我要找阿里云的密碼

尋找pwd找出來,復(fù)制數(shù)據(jù)

去到

https://tool.lu/coderunner/

復(fù)制黏貼一下php解密的代碼

<?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";

將15057D7BA390復(fù)制到倒數(shù)第二行

點擊執(zhí)行,得到密碼

2. linux/win/蘋果桌面情況下,可導(dǎo)出連接看然后去php解密(適用)

導(dǎo)出后用notepad++看里面的代碼

尋找password值

復(fù)制888B51B60B5FF32FAF86AC去第一種方法php方法里解密

3. 直接登錄navicat,用命令去改密碼

通過Navicat Premium能登陸MySQL,但root用戶密碼忘記了

方法: 用UPDATE直接編輯user表

mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';  mysql> FLUSH PRIVILEGES;

總結(jié)

  • 從操作上沒有卡手的地方
  • 不太明白為什么說php是最好的語言,猜測用java寫出來也是可以解密的

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

五河县| 油尖旺区| 秦安县| 北宁市| 西乌| 犍为县| 泗水县| 奉化市| 兴义市| 恭城| 三门县| 莒南县| 方城县| 同心县| 怀仁县| 泌阳县| 寿阳县| 兰坪| 奎屯市| 会理县| 大英县| 汤阴县| 仙游县| 天水市| 承德县| 元阳县| 县级市| 韩城市| 长治县| 隆子县| 敦化市| 和静县| 论坛| 德庆县| 安新县| 宝丰县| 邛崃市| 竹溪县| 乌审旗| 桃源县| 镇江市|