描述
最近公司有被上海卓威信息技能有限公司扫描到,说是公司软件侵权,至于原因嘛,大家懂的都懂。肯定是因为没有购买人家的正版,都是使用破解版本的。所以公司先自查了一遍,通知禁止使用非正版的navicat工具,但是公司有比较抠不乐意花钱去购买授权的软件,所以只能找别的的客户端工具进行替代,但是入职公司几年了项目中使用的数据库毗连密码又都是加密的,而且另有不是项目中使用的数据库,又不想去找之前的记录去查询这些信息,在这种情况下怎么办,下面给大家保举一种获取navicat毗连信息的方式,包括密码的明文。
起首辈入navicat导出需要解密的毗连配置信息
进入navicat,点击左上角以一个菜单“文件”,选择“导出毗连”
将你需要的检察的配置毗连信息导出,会天生一个以.ncx结尾文件,然后用富文本编辑器打开,找到每个毗连中的“Password”后面的密文
打开在线代码运行工具
网址:https://toolin.cn/run-php8,选择PHP8,将一下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(12);
- //解密
- $decode = $navicatPassword->decrypt('2767CA55F9557DE');
- echo $decode."\n";
复制代码 简朴修改以上代码后,点击运行
1.修改navicat的版本,如果版本比较老,就用11,否则就用12
2.修改代码中解密的密文,将代码中的密文替换成自己需要解密的密文
3.点击运行,会打印输出密码对应的明文
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
|