{"id":7125,"date":"2024-11-14T15:06:57","date_gmt":"2024-11-14T07:06:57","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7125\/"},"modified":"2024-11-14T15:06:57","modified_gmt":"2024-11-14T07:06:57","slug":"wireshark-%e5%a6%82%e4%bd%95%e8%af%86%e5%88%ab%e6%95%b0%e6%8d%ae%e5%8c%85%e5%b1%9e%e4%ba%8e-mysql-%e5%8d%8f%e8%ae%ae%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7125\/","title":{"rendered":"Wireshark \u5982\u4f55\u8bc6\u522b\u6570\u636e\u5305\u5c5e\u4e8e MySQL \u534f\u8bae\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173046205890755.jpg\" class=\"aligncenter\" title=\"Wireshark \u5982\u4f55\u8bc6\u522b\u6570\u636e\u5305\u5c5e\u4e8e MySQL \u534f\u8bae\uff1f\u63d2\u56fe\" alt=\"Wireshark \u5982\u4f55\u8bc6\u522b\u6570\u636e\u5305\u5c5e\u4e8e MySQL \u534f\u8bae\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>wireshark \u8bc6\u522b  \u534f\u8bae\u7684\u539f\u7406<\/strong><\/p>\n<p>\u5728 wireshark \u4e2d\uff0c\u901a\u8fc7\u8f93\u5165\u7279\u5b9a\u534f\u8bae\u540d\u79f0\uff08\u5982 mysql\u3001amqp \u7b49\uff09\u8fdb\u884c\u8fc7\u6ee4\uff0c\u53ef\u4ee5\u7b5b\u9009\u51fa\u76f8\u5e94\u7684\u7f51\u7edc\u6570\u636e\u5305\u3002\u90a3\u4e48\uff0cwireshark \u662f\u5982\u4f55\u8bc6\u522b\u4e00\u4e2a\u6570\u636e\u5305\u662f\u5426\u5c5e\u4e8e mysql \u534f\u8bae\u7684\u5462\uff1f<\/p>\n<p><strong>\u7c97\u66b4\u5374\u6709\u6548\u7684\u65b9\u6cd5<\/strong><\/p>\n<p>wireshark \u91c7\u7528\u4e86\u4e00\u79cd\u7b80\u5355\u800c\u6709\u6548\u7684\u65b9\u6cd5\u6765\u8bc6\u522b mysql \u534f\u8bae\uff1a<\/p>\n<ol>\n<li> <strong>\u5148\u5224\u65ad\u662f\u5426\u662f tcp \u534f\u8bae\uff1a<\/strong>wireshark \u4f1a\u9996\u5148\u68c0\u67e5\u6570\u636e\u5305\u662f\u5426\u5c5e\u4e8e tcp \u534f\u8bae\u3002<\/li>\n<li> <strong>\u518d\u5224\u65ad\u7aef\u53e3\u662f\u5426\u662f 3306\uff1a<\/strong>\u5982\u679c\u6570\u636e\u5305\u662f tcp \u534f\u8bae\uff0cwireshark \u4f1a\u8fdb\u4e00\u6b65\u68c0\u67e5\u5176\u7aef\u53e3\u53f7\u662f\u5426\u4e3a 3306\uff0c\u56e0\u4e3a mysql \u9ed8\u8ba4\u4f7f\u7528 3306 \u7aef\u53e3\u3002<\/li>\n<\/ol>\n<p>\u5982\u679c\u524d\u4e24\u4e2a\u6761\u4ef6\u90fd\u6ee1\u8db3\uff0cwireshark \u4f1a\u8ba4\u4e3a\u8be5\u6570\u636e\u5305\u53ef\u80fd\u662f mysql \u534f\u8bae\u3002<\/p>\n<p><strong>\u89e3\u6790\u5c1d\u8bd5<\/strong><\/p>\n<p>\u5728\u5224\u65ad\u4e3a\u6f5c\u5728\u7684 mysql \u534f\u8bae\u540e\uff0cwireshark \u4f1a\u5c1d\u8bd5\u89e3\u6790\u8be5\u6570\u636e\u5305\u7684\u5185\u5bb9\u3002\u5982\u679c\u89e3\u6790\u6210\u529f\uff0c\u5219\u786e\u8ba4\u8be5\u6570\u636e\u5305\u5c5e\u4e8e mysql \u534f\u8bae\u3002\u89e3\u6790\u4e0d\u6210\u529f\uff0c\u5219 wireshark \u4f1a\u5c06\u8be5\u6570\u636e\u5305\u4ea4\u7ed9\u5176\u4ed6\u6ee1\u8db3\u6761\u4ef6\u7684\u89e3\u6790\u5668\u7ee7\u7eed\u89e3\u6790\uff0c\u76f4\u5230\u65e0\u6cd5\u518d\u89e3\u6790\u3002<\/p>\n<p><strong>\u4ee3\u7801\u8be6\u89e3<\/strong><\/p>\n<p>wireshark \u7684\u6e90\u7801\u4e2d\u63d0\u4f9b\u4e86\u5bf9\u89e3\u6790\u8fc7\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u5728 epan\/dissectors\/packet-mysql.c \u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u627e\u5230\u76f8\u5173\u7684\u89e3\u6790\u4ee3\u7801\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u4e0b\u8ff0\u4ee3\u7801\u5224\u65ad\u6570\u636e\u5305\u662f\u5426\u662f tcp \u534f\u8bae\u4e14\u7aef\u53e3\u53f7\u662f 3306\uff1a<\/p>\n<pre>if (!pinfo-&gt;fd-&gt;flags.visited &amp;&amp; pinfo-&gt;ptype == PT_TCP &amp;&amp;\n    pinfo-&gt;destport == mysql_tcp_port) {\n    return 1;  \/\/ \u53ef\u80fd\u662f MySQL \u534f\u8bae\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u8be5\u5224\u65ad\u4e3a\u771f\uff0cwireshark \u5c06\u7ee7\u7eed\u5c1d\u8bd5\u89e3\u6790\u6570\u636e\u5305\u7684\u5185\u5bb9\uff0c\u786e\u8ba4\u5176\u662f\u5426\u771f\u6b63\u5c5e\u4e8e mysql \u534f\u8bae\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fWireshark \u5982\u4f55\u8bc6\u522b\u6570\u636e\u5305\u5c5e\u4e8e MySQL \u534f\u8bae\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>wireshark \u8bc6\u522b \u534f\u8bae\u7684\u539f\u7406 \u5728 wireshark \u4e2d\uff0c\u901a\u8fc7\u8f93\u5165\u7279\u5b9a\u534f\u8bae\u540d\u79f0\uff08\u5982 mysql\u3001amqp \u7b49\uff09\u8fdb\u884c\u8fc7\u6ee4\uff0c\u53ef\u4ee5\u7b5b\u9009\u51fa\u76f8\u5e94\u7684\u7f51\u7edc\u6570\u636e\u5305\u3002\u90a3\u4e48\uff0cwireshark \u662f\u5982\u4f55\u8bc6\u522b\u4e00\u4e2a\u6570\u636e\u5305\u662f\u5426\u5c5e\u4e8e mysql \u534f\u8bae\u7684\u5462\uff1f \u7c97\u66b4\u5374\u6709\u6548\u7684\u65b9\u6cd5 wireshark \u91c7\u7528\u4e86\u4e00\u79cd\u7b80\u5355\u800c\u6709\u6548\u7684\u65b9\u6cd5\u6765\u8bc6\u522b mysql \u534f\u8bae\uff1a \u5148\u5224\u65ad\u662f\u5426\u662f tcp \u534f\u8bae\uff1awireshark \u4f1a\u9996\u5148\u68c0\u67e5\u6570\u636e\u5305\u662f\u5426\u5c5e\u4e8e tcp \u534f\u8bae\u3002 \u518d\u5224\u65ad\u7aef\u53e3\u662f\u5426\u662f 3306\uff1a\u5982\u679c\u6570\u636e\u5305\u662f tcp \u534f\u8bae\uff0cwireshark \u4f1a\u8fdb\u4e00\u6b65\u68c0\u67e5\u5176\u7aef\u53e3\u53f7\u662f\u5426\u4e3a 3306\uff0c\u56e0\u4e3a mysql \u9ed8\u8ba4\u4f7f\u7528 3306 \u7aef\u53e3\u3002 \u5982\u679c\u524d\u4e24\u4e2a\u6761\u4ef6\u90fd\u6ee1\u8db3\uff0cwireshark \u4f1a\u8ba4\u4e3a\u8be5\u6570\u636e\u5305\u53ef\u80fd\u662f mysql \u534f\u8bae\u3002 \u89e3\u6790\u5c1d\u8bd5 \u5728\u5224\u65ad\u4e3a\u6f5c\u5728\u7684 mysql \u534f\u8bae\u540e\uff0cwireshark \u4f1a\u5c1d\u8bd5\u89e3\u6790\u8be5\u6570\u636e\u5305\u7684\u5185\u5bb9\u3002\u5982\u679c\u89e3\u6790\u6210\u529f\uff0c\u5219\u786e\u8ba4\u8be5\u6570\u636e\u5305\u5c5e\u4e8e mysql \u534f\u8bae\u3002\u89e3\u6790\u4e0d\u6210\u529f\uff0c\u5219 wireshark \u4f1a\u5c06\u8be5\u6570\u636e\u5305\u4ea4\u7ed9\u5176\u4ed6\u6ee1\u8db3\u6761\u4ef6\u7684\u89e3\u6790\u5668\u7ee7\u7eed\u89e3\u6790\uff0c\u76f4\u5230\u65e0\u6cd5\u518d\u89e3\u6790\u3002 \u4ee3\u7801\u8be6\u89e3 wireshark \u7684\u6e90\u7801\u4e2d\u63d0\u4f9b\u4e86\u5bf9\u89e3\u6790\u8fc7\u7a0b\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u5728 epan\/dissectors\/packet-mysql.c \u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u627e\u5230\u76f8\u5173\u7684\u89e3\u6790\u4ee3\u7801\u3002 \u4f8b\u5982\uff0c\u4e0b\u8ff0\u4ee3\u7801\u5224\u65ad\u6570\u636e\u5305\u662f\u5426\u662f tcp \u534f\u8bae\u4e14\u7aef\u53e3\u53f7\u662f 3306\uff1a if [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7125","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=7125"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7125\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}