在Navicat查看已保存的数据库密码
1、将数据库连接导出,导出时勾选密码。
2、将导出的文件用记事本打开,可以看到root账号下对应的密码已经被加密。
3、解密。
需要在下面的网址下,运行此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');
-
$decode = $navicatPassword->decrypt('6E3CD79374732F89F047B5316FD28637');
-
echo $decode."\n";
运行即可看到原密码。
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhgaejce
系列文章
更多
-
Abaqus复合材料3D Hashin失效准则,脆性断裂-Vumat
-
ModuleNotFoundError: No module named ‘matplotlib‘怎么办
-
Cesium结合GIS天地图 加载倾斜摄影3dtile + vue3
-
Paper Reading- Center-based 3D Object Detection and Tracking (Based: KITTI)
-
自监督医学图像Models Genesis: Generic Autodidactic Models for 3D Medical Image Analysis论文精读笔记
-
Centos7极快安装Elasticsearch 7.17.7
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
怎样阻止微信小程序自动打开
PHP中文网 06-13 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
photoshop蒙版画笔没反应怎么办
PHP中文网 06-24