如何解決Navicat已經(jīng)成功連接,密碼忘記的問(wèn)題
一直想寫(xiě)一下這篇文章的總結(jié),因?yàn)橛袝r(shí)真的忘記了,要去網(wǎng)上重新搜索一下之前用過(guò)的方法,因此這里記錄一下,也為了以后遇到這種問(wèn)題可以直接看我的文章,而不是到處找,以下為實(shí)踐篇。
1. 如果是win,通過(guò)注冊(cè)表里去找對(duì)應(yīng)的數(shù)據(jù),用php解碼
去cmd里輸入
regedit
去到對(duì)應(yīng)的注冊(cè)表

查找Navicat的密碼保存位置
去到對(duì)應(yīng)的路徑下面
計(jì)算機(jī)\HKEY_CURRENT_USER\Software\PremiumSoft
可以看到

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

尋找pwd找出來(lái),復(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ù)第二行
點(diǎn)擊執(zhí)行,得到密碼

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


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

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

3. 直接登錄navicat,用命令去改密碼
通過(guò)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é)
- 從操作上沒(méi)有卡手的地方
- 不太明白為什么說(shuō)php是最好的語(yǔ)言,猜測(cè)用java寫(xiě)出來(lái)也是可以解密的
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
一個(gè)查詢的SQL語(yǔ)句請(qǐng)教,希望能夠用一條SQL語(yǔ)句得到結(jié)果
一個(gè)查詢的SQL語(yǔ)句請(qǐng)教,希望能夠用一條SQL語(yǔ)句得到結(jié)果...2007-06-06
Navicat?premium?for?mac?12的安裝破解圖文教程
Navicat Premium是一款數(shù)據(jù)庫(kù)管理工具,將此工具連接數(shù)據(jù)庫(kù),你可以從中看到各種數(shù)據(jù)庫(kù)的詳細(xì)信息,這篇文章主要介紹了Mac下Navicat?premium?for?mac?12的安裝破解過(guò)程,需要的朋友可以參考下2024-01-01
利用DataSet部分功能實(shí)現(xiàn)網(wǎng)站登錄
這篇文章主要介紹了利用DataSet部分功能實(shí)現(xiàn)網(wǎng)站登錄 ,需要的朋友可以參考下2017-05-05
Access和SQL Server里面的SQL語(yǔ)句的不同之處
做了一個(gè)Winform的營(yíng)養(yǎng)測(cè)量軟件,來(lái)回的搗騰著Access數(shù)據(jù)庫(kù),還是那幾句增刪改查,不過(guò)用多了,發(fā)現(xiàn)Access數(shù)據(jù)庫(kù)下的SQL語(yǔ)句和SQL Server下正宗的SQL還有有很大的不同。2009-12-12
數(shù)據(jù)庫(kù)設(shè)計(jì)規(guī)范化的五個(gè)要求 推薦收藏
通常情況下,可以從兩個(gè)方面來(lái)判斷數(shù)據(jù)庫(kù)是否設(shè)計(jì)的比較規(guī)范。一是看看是否擁有大量的窄表,二是寬表的數(shù)量是否足夠的少。2011-04-04
在SQL Server和Oracle中創(chuàng)建job
有的時(shí)候,我們可能需要在數(shù)據(jù)庫(kù)中設(shè)定一些自動(dòng)執(zhí)行的任務(wù)(job),以此來(lái)自動(dòng)完成一些包括統(tǒng)計(jì)、備份方面的需求,下面就簡(jiǎn)單說(shuō)明一下有關(guān)ms server和oracle兩種數(shù)據(jù)庫(kù)中如何新建自動(dòng)任務(wù)。2009-06-06
快速解決openGauss數(shù)據(jù)庫(kù)pg_xlog爆滿問(wèn)題
這篇文章主要介紹了openGauss數(shù)據(jù)庫(kù)pg_xlog爆滿問(wèn)題解決,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-04-04

