首页 > 数据库 >利用Navicate查看已连接数据库密码

利用Navicate查看已连接数据库密码

时间:2023-03-17 16:35:46浏览次数:47  
标签:function return string 数据库 currentVector 密码 protected Navicate result

一、导出链接

 二、选择要查询的数据库链接

三、导出文件用notepad++打开

 四、解密密码

在线运行代码 ,使用PHP在线运行工具(将上面文档的密码替换标红地方)
<?php
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);
    }
};
 
 
//需要指定版本两种,11或12
//$navicatPassword = new NavicatPassword(11);
$navicatPassword = new NavicatPassword(11);
 
//解密
//$decode = $navicatPassword->decrypt('15057D7BA390');
$decode = $navicatPassword->decrypt('221723DF5E050B2521'); // navicat密钥
echo $decode."\n";
?>

 

标签:function,return,string,数据库,currentVector,密码,protected,Navicate,result
From: https://www.cnblogs.com/liaozk/p/17227229.html

相关文章

  • 谈谈为什么要拆分数据库?有哪些方法?
    为什么要拆分数据库?数据库负载和数据量大拆分数据库是有讲究的,必须:先水平切分,然后垂直切分。什么是垂直切分?垂直切分是根据业务来拆分数据库,同一类业务的数据表拆分到......
  • .net 连接各个数据库的ConnectionString字符串
    DataType----->ConnectionStringDataType.MySql----->DataSource=127.0.0.1;Port=3306;UserID=root;Password=root;InitialCatalog=cccddd;Charset=utf8;SslMode=none......
  • AndroidStudio数据库连接有问题
    packagecom.example.daka;importandroidx.appcompat.app.AppCompatActivity;importandroid.os.Bundle;importandroid.view.View;importandroid.widget.EditTex......
  • C# 连接SQL数据库 ,增删改查
     Default3.aspx.cs1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Data;//数据库执行方式4usingSystem.Data.SqlClient;//数据库5us......
  • SQL Server修改sa用户密码
     SQLServer数据库使用windows用户登录,安全性->登录名->找到sa用户->属性:可直接修改sa用户密码(可去掉勾选强制实施密码策略)  ......
  • 使用 Athena (Presto) 分析本地 Oracle 数据库导出的数据
    在传统企业客户,无论是前台的交易数据库还是后台的数据仓库,都会选择使用Oracle,它具备非常广泛的技术资料、社区资源和问题处理案例(各种踩坑的经验);同时它还有广泛的用户基础......
  • 分布式数据库DDBS
    一、什么是分布式数据库分布式数据库系统(DDBS:Distributed Database System)是在集中式数据库系统的基础上发展来的。是数据库技术与网络技术结合的产物。分布式数据......
  • elasticsearch设置/修改密码
    elasticsearch设置密码1.进入到lelasticsearch目录下的config目录,找到elasticsearch.yml文件,在里面添加如下命令并重启:xpack.security.enabled:truexpack.license.sel......
  • 自动生成8位数字密码
    //密码自动生成8位数字automaticallyGenerate(){//可获取的字符串letchars='0123456789'letlist=[]//通过随机获取八个字符串......
  • 接口自动化---数据库断言封装python
    接口自动化---数据库断言封装python前言:在接口测试响应验证中,通常可以通过接口响应值来验证,还可以通过查询数据库信息辅助来验证。接口测试数据清理1、通过Delete接口删......