首页 > 数据库 >native 查看连接过的数据库密码

native 查看连接过的数据库密码

时间:2023-04-21 16:56:57浏览次数:31  
标签:function return string 数据库 currentVector 密码 protected result native

native 查看连接过的数据库密码  

  1. 首先导出连接并勾选导出密码。
      2.用文本编辑器打开导出的文件找到密码。   3.打开https://tool.lu/coderunner/在线工具   4.赋值代码到工具中将倒数第二行引号中的值换成自己的密码,点击运行就可在右侧看见密码了。  
<?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('E8586562E8BC1B62A84EC89D61A5B7EC');
echo $decode."\n";

 

     

标签:function,return,string,数据库,currentVector,密码,protected,result,native
From: https://www.cnblogs.com/forever-pq/p/17341005.html

相关文章

  • PLSQL连接远程数据库
    下载并安装InstantClient下载链接:https://pan.baidu.com/s/1j-4FMsTtS8GieoGP-q0AOQ提取码:q6h9下载并安装PLSQL下载路径:https://pan.baidu.com/s/1QBpCKq-SWe6c6PbI6cLEUA提取码:17et注册码:PLSQLDeveloper12.0.7注册码productcode:4vkjwhfeh3ufnqnmpr......
  • 数据库binlog
    目录数据库binlog一、初步了解binlog二、开启binlog日志三、常用的binlog日志操作命令四、查看binlog日志内容,常用的方式五、利用binlog日志回复mysql数据数据库binlog一、初步了解binlogMySQL的二进制日志binlog,可以说是MySQL最重要的日志,以事件形式记录除查询语句select以......
  • Jenkins 忘记登录密码怎么办
    在安装Jenkins中遇到忘记登录密码该怎么呢?方法有很多,我这里记录一下我找的方法1、先停止jenkins服务systemctlstopjenkins2、找到config.xml文件find/-nameconfig.xml命令执行后找到如下结果:/root/.jenkins/config.xml/root/.jenkins/users/admin_83999305795......
  • django使用多个数据库实现
    一、说明:在开发Django项目的时候,很多时候都是使用一个数据库,即settings中只有default数据库,但是有一些项目确实也需要使用多个数据库,这样的项目,在数据库配置和使用的时候,就比较麻烦一点。二、Django使用多个数据库中settings中的DATABASES的设置2.1默认只是用一......
  • 全平台数据(数据库)管理工具 DataCap 管理 Rainbond 上的所有数据库
    DataCap是用于数据转换、集成和可视化的集成软件,支持多种数据源、文件类型、大数据相关数据库、关系数据库、NoSQL数据库等。通过该DataCap可以实现对多个数据源的管理,对数据源下的数据进行各种操作转换,制作数据图表,监控数据源等功能。在Rainbond上部署DataCap前提安装Ra......
  • springmvc 链接数据库错误
    1.Causedby:org.xml.sax.SAXParseException:cos-all-limited.1.2:An''all''modelgroupmustappearinaparticlewith'{'minoccurs'}'='{'maxoccurs'}'=1,andthatparticlemustbepartofapa......
  • app逆向之安卓native层安全逆向分析(二):unidbg+ida使用+过签名校验
    前言继续跟着龙哥的unidbg学习:SO逆向入门实战教程二:calculateS_so逆向_白龙~的博客-CSDN博客还是那句,我会借鉴龙哥的文章,以一个初学者的角度,加上自己的理解,把内容丰富一下,尽量做到不在龙哥的基础上画蛇添足,哈哈。感谢观看的朋友分析 首先抓包分析: 其中,里面的s就是今天......
  • 在线CTF工具箱--端口扫描--杂项--密码学--编码和解码
    这是为CTF发烧者准备的的工具套件,助你过关斩将、攻克难关。目前基础功能和一部分高级功能已经完成,可以在GitHub上查看工具列表和开发进度。 CTFer:https://ctfever.uniiem.com/ 项目地址:https://github.com/UniiemStudio/CTFever ......
  • 数据库关联查询(左连接、右连接)
    在项目中用到多表联合查询,发现2个现象,今天解决这2个疑问:1、left join连接2张表,on后的条件第一个生效,用and连接的其他条件不生效;2、一旦加上where,则显示的结果等同于inner join;先写结论:过滤条件放在:where后面:是先连接然生成临时查询结果,然后再筛选on后面:先根据条件过滤筛选......
  • MFC-GetNativeSystemInfo获取当前CPU信息
     CStringstr;SYSTEM_INFOlpSystemInfo;GetNativeSystemInfo(&lpSystemInfo);//获取当前CPU信息/*在一个64位的应用中调用此函数,那它等效于GetSystemInfo*/WORDw=lpSystemInfo.wProcessorArchitecture;//处理器的体系结构......