{"id":1564,"date":"2023-04-07T17:33:57","date_gmt":"2023-04-07T09:33:57","guid":{"rendered":"http:\/\/175.24.184.226\/?p=1564"},"modified":"2025-06-04T16:14:51","modified_gmt":"2025-06-04T08:14:51","slug":"navicat%e4%b8%ad%e6%80%8e%e4%b9%88%e6%9f%a5%e7%9c%8b%e6%95%b0%e6%8d%ae%e5%ba%93%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"\/?p=1564","title":{"rendered":"Navicat\u4e2d\u600e\u4e48\u67e5\u770b\u6570\u636e\u5e93\u5bc6\u7801"},"content":{"rendered":"<p>\u5f00\u6e90\u9879\u76ee\uff1a<br \/>\n<a href=\"https:\/\/github.com\/maoxuner\/navicat-password\">https:\/\/github.com\/maoxuner\/navicat-password<\/a><\/p>\n<hr \/>\n<p>\u7b2c\u4e00\u6b65:\u5bfc\u51fa\u94fe\u63a5\uff0c\u5bfc\u51fa\u8fde\u63a5\u83b7\u53d6\u5230 connections.ncx \u6587\u4ef6<\/p>\n<p><img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/img\/20201205160538470.png\" alt=\"img\" \/> <\/p>\n<p>\u8fd9\u91cc\u9700\u8981\u52fe\u9009 \u5bfc\u51fa\u5bc6\u7801\uff01\uff01\uff01 \u4e0d\u7136\u5bfc\u51fa\u7684\u6587\u4ef6\u91cc\u4e0d\u5305\u542b\u52a0\u5bc6\u7684\u5bc6\u7801<\/p>\n<p><img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/img\/20201205160734556.png\" alt=\"img\" \/> <\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u627e\u5230\u52a0\u5bc6\u5bc6\u7801\uff0c\u8fdb\u884c\u7834\u89e3<\/p>\n<p>\u5728\u5bfc\u51fa\u7684connections.ncx\u6587\u4ef6\u4e2d\u627e\u5230password\uff0c\u7136\u540e\u590d\u5236\u51fa\u6765<\/p>\n<p><img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/img\/20201205160921782.png\" alt=\"img\" \/><\/p>\n<p>\u6253\u5f00\u8fd9\u4e2a\u7f51\u5740\uff1a<a href=\"https:\/\/tool.lu\/coderunner\uff0c\u5c06\u5982\u4e0b\u521a\u521a\u5bc6\u7801\u590d\u5236\u8fdb\u53bb\">https:\/\/tool.lu\/coderunner\uff0c\u5c06\u5982\u4e0b\u521a\u521a\u5bc6\u7801\u590d\u5236\u8fdb\u53bb<\/a>\uff0c<\/p>\n<p>$decode = $navicatPassword-&gt;decrypt('\u590d\u5236\u51fa\u6765\u7684\u5bc6\u7801');<\/p>\n<pre><code class=\"language-php\">&lt;?php\nclass NavicatPassword\n{\n    protected $version = 0;\n    protected $aesKey = &#039;libcckeylibcckey&#039;;\n    protected $aesIv = &#039;libcciv libcciv &#039;;\n    protected $blowString = &#039;3DC5CA39&#039;;\n    protected $blowKey = null;\n    protected $blowIv = null;\npublic function __construct($version = 12)\n{\n    $this-&gt;version = $version;\n    $this-&gt;blowKey = sha1(&#039;3DC5CA39&#039;, true);\n    $this-&gt;blowIv = hex2bin(&#039;d9c7c3c8870d64bd&#039;);\n}\n\npublic function encrypt($string)\n{\n    $result = FALSE;\n    switch ($this-&gt;version) {\n        case 11:\n            $result = $this-&gt;encryptEleven($string);\n            break;\n        case 12:\n            $result = $this-&gt;encryptTwelve($string);\n            break;\n        default:\n            break;\n    }\n\n    return $result;\n}\n\nprotected function encryptEleven($string)\n{\n    $round = intval(floor(strlen($string) \/ 8));\n    $leftLength = strlen($string) % 8;\n    $result = &#039;&#039;;\n    $currentVector = $this-&gt;blowIv;\n\n    for ($i = 0; $i &lt; $round; $i++) {\n        $temp = $this-&gt;encryptBlock($this-&gt;xorBytes(substr($string, 8 * $i, 8), $currentVector));\n        $currentVector = $this-&gt;xorBytes($currentVector, $temp);\n        $result .= $temp;\n    }\n\n    if ($leftLength) {\n        $currentVector = $this-&gt;encryptBlock($currentVector);\n        $result .= $this-&gt;xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);\n    }\n\n    return strtoupper(bin2hex($result));\n}\n\nprotected function encryptBlock($block)\n{\n    return openssl_encrypt($block, &#039;BF-ECB&#039;, $this-&gt;blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);\n}\n\nprotected function decryptBlock($block)\n{\n    return openssl_decrypt($block, &#039;BF-ECB&#039;, $this-&gt;blowKey, OPENSSL_RAW_DATA|OPENSSL_NO_PADDING);\n}\n\nprotected function xorBytes($str1, $str2)\n{\n    $result = &#039;&#039;;\n    for ($i = 0; $i &lt; strlen($str1); $i++) {\n        $result .= chr(ord($str1[$i]) ^ ord($str2[$i]));\n    }\n\n    return $result;\n}\n\nprotected function encryptTwelve($string)\n{\n    $result = openssl_encrypt($string, &#039;AES-128-CBC&#039;, $this-&gt;aesKey, OPENSSL_RAW_DATA, $this-&gt;aesIv);\n    return strtoupper(bin2hex($result));\n}\n\npublic function decrypt($string)\n{\n    $result = FALSE;\n    switch ($this-&gt;version) {\n        case 11:\n            $result = $this-&gt;decryptEleven($string);\n            break;\n        case 12:\n            $result = $this-&gt;decryptTwelve($string);\n            break;\n        default:\n            break;\n    }\n\n    return $result;\n}\n\nprotected function decryptEleven($upperString)\n{\n    $string = hex2bin(strtolower($upperString));\n\n    $round = intval(floor(strlen($string) \/ 8));\n    $leftLength = strlen($string) % 8;\n    $result = &#039;&#039;;\n    $currentVector = $this-&gt;blowIv;\n\n    for ($i = 0; $i &lt; $round; $i++) {\n        $encryptedBlock = substr($string, 8 * $i, 8);\n        $temp = $this-&gt;xorBytes($this-&gt;decryptBlock($encryptedBlock), $currentVector);\n        $currentVector = $this-&gt;xorBytes($currentVector, $encryptedBlock);\n        $result .= $temp;\n    }\n\n    if ($leftLength) {\n        $currentVector = $this-&gt;encryptBlock($currentVector);\n        $result .= $this-&gt;xorBytes(substr($string, 8 * $i, $leftLength), $currentVector);\n    }\n\n    return $result;\n}\n\nprotected function decryptTwelve($upperString)\n{\n    $string = hex2bin(strtolower($upperString));\n    return openssl_decrypt($string, &#039;AES-128-CBC&#039;, $this-&gt;aesKey, OPENSSL_RAW_DATA, $this-&gt;aesIv);\n}\n};\n\n\/\/\u9700\u8981\u6307\u5b9a\u7248\u672c\u4e24\u79cd\uff0c11\u621612\n\/\/$navicatPassword = new NavicatPassword(11);\n\/\/\u8fd9\u91cc\u6211\u6307\u5b9a\u768412\u7684\u7248\u672c\uff0c\u539f\u5148\u6307\u5b9a\u768411\uff0c\u6267\u884c\u4e4b\u540e\u7684\u5bc6\u7801\u662f\u4e71\u7801\n$navicatPassword = new NavicatPassword(12);\n\n\/\/\u89e3\u5bc6\n\/\/$decode = $navicatPassword-&gt;decrypt(&#039;15057D7BA390&#039;);\n$decode = $navicatPassword-&gt;decrypt(&#039;\u590d\u5236\u51fa\u6765\u7684\u5bc6\u7801&#039;);\necho $decode.&quot;\\n&quot;;\n?&gt;<\/code><\/pre>\n<p><img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/img\/20201205161314364.png\" alt=\"img\" \/><\/p>\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<br \/>\n\u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3aCSDN\u535a\u4e3b\u300c\u8fd9\u8f88\u5b50_\u5b89\u9759\u7684\u52aa\u529b\u7740\u300d\u7684\u539f\u521b\u6587\u7ae0\uff0c\u9075\u5faaCC 4.0 BY-SA\u7248\u6743\u534f\u8bae\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u53ca\u672c\u58f0\u660e\u3002<br \/>\n\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/blog.csdn.net\/qq_35868412\/article\/details\/110694727\">https:\/\/blog.csdn.net\/qq_35868412\/article\/details\/110694727<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f00\u6e90\u9879\u76ee\uff1a https:\/\/github.com\/maoxuner\/navicat-password \u7b2c\u4e00\u6b65:\u5bfc\u51fa\u94fe\u63a5\uff0c\u5bfc\u51fa\u8fde\u63a5\u83b7\u53d6\u5230    \u2026 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[136],"tags":[],"_links":{"self":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts\/1564"}],"collection":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1564"}],"version-history":[{"count":1,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/1564\/revisions"}],"predecessor-version":[{"id":1565,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/1564\/revisions\/1565"}],"wp:attachment":[{"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1564"},{"taxonomy":"post_tag","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}