navicat工具中生存的数据库密码如何检察

[复制链接]
发表于 2025-5-16 23:52:46 | 显示全部楼层 |阅读模式
描述

最近公司有被上海卓威信息技能有限公司扫描到,说是公司软件侵权,至于原因嘛,大家懂的都懂。肯定是因为没有购买人家的正版,都是使用破解版本的。所以公司先自查了一遍,通知禁止使用非正版的navicat工具,但是公司有比较抠不乐意花钱去购买授权的软件,所以只能找别的的客户端工具进行替代,但是入职公司几年了项目中使用的数据库毗连密码又都是加密的,而且另有不是项目中使用的数据库,又不想去找之前的记录去查询这些信息,在这种情况下怎么办,下面给大家保举一种获取navicat毗连信息的方式,包括密码的明文。
起首辈入navicat导出需要解密的毗连配置信息

进入navicat,点击左上角以一个菜单“文件”,选择“导出毗连”

将你需要的检察的配置毗连信息导出,会天生一个以.ncx结尾文件,然后用富文本编辑器打开,找到每个毗连中的“Password”后面的密文
打开在线代码运行工具

网址:https://toolin.cn/run-php8,选择PHP8,将一下php代码复制粘贴进去
  1. <?php
  2. namespace FatSmallTools;
  3. class NavicatPassword
  4. {
  5.     protected $version = 0;
  6.     protected $aesKey = 'libcckeylibcckey';
  7.     protected $aesIv = 'libcciv libcciv ';
  8.     protected $blowString = '3DC5CA39';
  9.     protected $blowKey = null;
  10.     protected $blowIv = null;
  11.     public function __construct($version = 12)
  12.     {
  13.         $this->version = $version;
  14.         $this->blowKey = sha1('3DC5CA39', true);
  15.         $this->blowIv = hex2bin('d9c7c3c8870d64bd');
  16.     }
  17.     public function encrypt($string)
  18.     {
  19.         $result = FALSE;
  20.         switch ($this->version) {
  21.             case 11:
  22.                 $result = $this->encryptEleven($string);
  23.                 break;
  24.             case 12:
  25.                 $result = $this->encryptTwelve($string);
  26.                 break;
  27.             default:
  28.                 break;
  29.         }
  30.         return $result;
  31.     }
  32.     protected function encryptEleven($string)
  33.     {
  34.         $round = intval(floor(strlen($string) / 8));
  35.         $leftLength = strlen($string) % 8;
  36.         $result = '';
  37.         $currentVector = $this->blowIv;
  38.         for ($i = 0; $i < $round; $i++) {
  39.             $temp = $this->encryptBlock($this->xorBytes(substr($string, 8 * $i, 8), $currentVector));
  40.             $currentVector = $this->xorBytes($currentVector, $temp);
  41.             $result .= $temp;
  42.         }
  43.         if ($leftLength) {
  44.             $currentVector = $this->encryptBlock($currentVector);
  45.             $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
  46.         }
  47.         return strtoupper(bin2hex($result));
  48.     }
  49.     protected function encryptBlock($block)
  50.     {
  51.         return openssl_encrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);
  52.     }
  53.     protected function decryptBlock($block)
  54.     {
  55.         return openssl_decrypt($block, 'BF-ECB', $this->blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);
  56.     }
  57.     protected function xorBytes($str1, $str2)
  58.     {
  59.         $result = '';
  60.         for ($i = 0; $i < strlen($str1); $i++) {
  61.             $result .= chr(ord($str1[$i]) ^ ord($str2[$i]));
  62.         }
  63.         return $result;
  64.     }
  65.     protected function encryptTwelve($string)
  66.     {
  67.         $result = openssl_encrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
  68.         return strtoupper(bin2hex($result));
  69.     }
  70.    
  71.     public function decrypt($string)
  72.     {
  73.         $result = FALSE;
  74.         switch ($this->version) {
  75.             case 11:
  76.                 $result = $this->decryptEleven($string);
  77.                 break;
  78.             case 12:
  79.                 $result = $this->decryptTwelve($string);
  80.                 break;
  81.             default:
  82.                 break;
  83.         }
  84.         return $result;
  85.     }
  86.    
  87.     protected function decryptEleven($upperString)
  88.     {
  89.         $string = hex2bin(strtolower($upperString));
  90.         $round = intval(floor(strlen($string) / 8));
  91.         $leftLength = strlen($string) % 8;
  92.         $result = '';
  93.         $currentVector = $this->blowIv;
  94.         for ($i = 0; $i < $round; $i++) {
  95.             $encryptedBlock = substr($string, 8 * $i, 8);
  96.             $temp = $this->xorBytes($this->decryptBlock($encryptedBlock), $currentVector);
  97.             $currentVector = $this->xorBytes($currentVector, $encryptedBlock);
  98.             $result .= $temp;
  99.         }
  100.         if ($leftLength) {
  101.             $currentVector = $this->encryptBlock($currentVector);
  102.             $result .= $this->xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);
  103.         }
  104.         return $result;
  105.     }
  106.     protected function decryptTwelve($upperString)
  107.     {
  108.         $string = hex2bin(strtolower($upperString));
  109.         return openssl_decrypt($string, 'AES-128-CBC', $this->aesKey, OPENSSL_RAW_DATA, $this->aesIv);
  110.     }
  111. }
  112. use FatSmallTools\NavicatPassword;
  113. //需要指定版本,11或12
  114. //$navicatPassword = new NavicatPassword(12);
  115. $navicatPassword = new NavicatPassword(12);
  116. //解密
  117. $decode = $navicatPassword->decrypt('2767CA55F9557DE');
  118. echo $decode."\n";
复制代码
简朴修改以上代码后,点击运行

1.修改navicat的版本,如果版本比较老,就用11,否则就用12
2.修改代码中解密的密文,将代码中的密文替换成自己需要解密的密文
3.点击运行,会打印输出密码对应的明文

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
继续阅读请点击广告

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复

使用道具 举报

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5

GMT+8, 2025-7-4 05:57 , Processed in 0.094733 second(s), 31 queries 手机版|qidao123.com技术社区-IT企服评测▪应用市场 ( 浙ICP备20004199 )|网站地图

快速回复 返回顶部 返回列表