{"id":28543,"date":"2024-11-25T08:14:08","date_gmt":"2024-11-25T00:14:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28543\/"},"modified":"2024-11-25T08:14:08","modified_gmt":"2024-11-25T00:14:08","slug":"%e5%be%ae%e4%bf%a1%e4%bc%81%e4%b8%9a%e5%8f%b7%e5%bc%80%e5%8f%91%e5%bc%80%e5%90%af%e5%9b%9e%e8%b0%83%e6%a8%a1%e5%bc%8f-python%e5%88%a4%e6%96%ad%e4%bf%a1%e6%81%af-%e5%9b%9e%e5%a4%8d%e6%8c%87%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28543\/","title":{"rendered":"\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801"},"content":{"rendered":"<p>1 \u6ce8\u518c\u5fae\u4fe1\u4f01\u4e1a\u53f7\u7684\u6b65\u9aa4\u5c31\u7701\u7565\u4e86\u3002\u5f88\u7b80\u5355\u3002<\/p>\n<p>\u9009\u62e9\u4e0b\u9762\u7684\u5e94\u7528\u4e2d\u5fc3\uff0c\u4f01\u4e1a\u5c0f\u52a9\u624b\uff0c\u9009\u62e9\u56de\u8c03\u6a21\u5f0f\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/268\/280\/179\/1490168627945640.png\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u63d2\u56fe\" \/><\/p>\n<p>\u9009\u62e9\u968f\u673a\u751f\u6210token &nbsp;AESKEY\u3002\u5730\u5740\u8f93\u5165\u4f60\u7684\u670d\u52a1\u5668\u5730\u5740\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/638\/840\/844\/1490168655809629.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u63d2\u56fe1\" \/><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u9009\u62e9\u8bbe\u7f6e\uff0c\u65b0\u5efa\u7ba1\u7406\u7ec4\uff0c\u7136\u540e\u5c31\u80fd\u770b\u5230COPID\u548cSecret<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/826\/217\/499\/1490168670723989.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u63d2\u56fe2\" alt=\"\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u63d2\u56fe2\" \/><\/p>\n<p>\u628a\u4e0a\u9762\u76844\u4e2a\u53c2\u6570\uff0c\u5199\u5230\u4e0b\u9762\u7684\u6587\u4ef6\u91cc\u9762\u3002<\/p>\n<pre>python3&nbsp;-m&nbsp;pip&nbsp;&nbsp;install&nbsp;&nbsp;itchatmp&nbsp;&nbsp;&nbsp;&nbsp;###python3\u5b89\u88c5\u6a21\u5757&nbsp;&nbsp;\r\n&nbsp;\r\n\u5177\u4f53\u53ef\u767e\u5ea6itchatmp\u5b98\u65b9\u6587\u6863\r\n&nbsp;\r\n&nbsp;\r\n&nbsp;\r\nvim&nbsp;main.py\r\n&nbsp;\r\nimport&nbsp;itchatmp\r\nfrom&nbsp;itchatmp.content&nbsp;import&nbsp;TEXT\r\nitchatmp.update_config(itchatmp.WechatConfig(\r\n&nbsp;&nbsp;&nbsp;&nbsp;token='xxxxxxxxxxxx',\r\n&nbsp;&nbsp;&nbsp;&nbsp;copId&nbsp;=&nbsp;'xxxxxxxxxxxxx',\r\n&nbsp;&nbsp;&nbsp;&nbsp;appSecret&nbsp;=&nbsp;'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\r\n&nbsp;&nbsp;&nbsp;&nbsp;encryptMode=itchatmp.content.SAFE,\r\n&nbsp;&nbsp;&nbsp;&nbsp;encodingAesKey='xxxxxxxxxxxxxxxxxxxxxxxxxxxx',))\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\r\ni='\u4f55\u5168'\r\n@itchatmp.msg_register(itchatmp.content.TEXT)\r\ndef&nbsp;text_reply(msg):\r\n&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;msg['Content']&nbsp;==&nbsp;i&nbsp;:\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msg['Content']&nbsp;=&nbsp;'\u59d3\u540d:{}'.format(i)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;msg['Content']\r\n&nbsp;&nbsp;&nbsp;&nbsp;else:\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(23333)\r\nitchatmp.run()<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>python&nbsp;&nbsp;main.py&nbsp;&nbsp;##\u8fd0\u884c\u6d4b\u8bd5\u4e86\u3002\u3002\u3002\u3002<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>\u4fee\u6539\u7aef\u53e3\u53f7\uff1aitchatmp.run(port=8888)\r\n&nbsp;\r\n\u8bb0\u5f97\u4fee\u6539\u9632\u706b\u5899\uff0c\u8fd9\u91cc\u6211\u5c31\u88ab\u5751\u4e86\u3002&nbsp;&nbsp;\u5fae\u4fe1\u56de\u8c03\u6a21\u5f0f\u652f\u6301&nbsp;&nbsp;x.x.x.x:8888\r\n&nbsp;\r\niptable&nbsp;&nbsp;&nbsp;-A&nbsp;INPUT&nbsp;-p&nbsp;tcp&nbsp;-m&nbsp;tcp&nbsp;--dport&nbsp;8888&nbsp;-j&nbsp;ACCEPT<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7ed3\u679c\uff1a<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;\u5f53\u5fae\u4fe1\u4f01\u4e1a\u53f7\uff0c\u6536\u5230\u56de\u590d\u4f55\u5168\uff0c\u8fd4\u56de \u59d3\u540d\uff1a\u4f55\u5168<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1 \u6ce8\u518c\u5fae\u4fe1\u4f01\u4e1a\u53f7\u7684\u6b65\u9aa4\u5c31\u7701\u7565\u4e86\u3002\u5f88\u7b80\u5355\u3002 \u9009\u62e9\u4e0b\u9762\u7684\u5e94\u7528\u4e2d\u5fc3\uff0c\u4f01\u4e1a\u5c0f\u52a9\u624b\uff0c\u9009\u62e9\u56de\u8c03\u6a21\u5f0f\u3002 \u9009\u62e9\u968f\u673a\u751f\u6210token &nbsp;AESKEY\u3002\u5730\u5740\u8f93\u5165\u4f60\u7684\u670d\u52a1\u5668\u5730\u5740\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u9009\u62e9\u8bbe\u7f6e\uff0c\u65b0\u5efa\u7ba1\u7406\u7ec4\uff0c\u7136\u540e\u5c31\u80fd\u770b\u5230COPID\u548cSecret \u628a\u4e0a\u9762\u76844\u4e2a\u53c2\u6570\uff0c\u5199\u5230\u4e0b\u9762\u7684\u6587\u4ef6\u91cc\u9762\u3002 python3&nbsp;-m&nbsp;pip&nbsp;&nbsp;install&nbsp;&nbsp;itchatmp&nbsp;&nbsp;&nbsp;&nbsp;###python3\u5b89\u88c5\u6a21\u5757&nbsp;&nbsp; &nbsp; \u5177\u4f53\u53ef\u767e\u5ea6itchatmp\u5b98\u65b9\u6587\u6863 &nbsp; &nbsp; &nbsp; vim&nbsp;main.py &nbsp; import&nbsp;itchatmp from&nbsp;itchatmp.content&nbsp;import&nbsp;TEXT itchatmp.update_config(itchatmp.WechatConfig( &nbsp;&nbsp;&nbsp;&nbsp;token=&#8217;xxxxxxxxxxxx&#8217;, &nbsp;&nbsp;&nbsp;&nbsp;copId&nbsp;=&nbsp;&#8216;xxxxxxxxxxxxx&#8217;, &nbsp;&nbsp;&nbsp;&nbsp;appSecret&nbsp;=&nbsp;&#8216;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#8217;, &nbsp;&nbsp;&nbsp;&nbsp;encryptMode=itchatmp.content.SAFE, &nbsp;&nbsp;&nbsp;&nbsp;encodingAesKey=&#8217;xxxxxxxxxxxxxxxxxxxxxxxxxxxx&#8217;,)) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i=&#8217;\u4f55\u5168&#8217; @itchatmp.msg_register(itchatmp.content.TEXT) def&nbsp;text_reply(msg): &nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;msg[&#8216;Content&#8217;]&nbsp;==&nbsp;i&nbsp;: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msg[&#8216;Content&#8217;]&nbsp;=&nbsp;&#8216;\u59d3\u540d:{}&#8217;.format(i) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;msg[&#8216;Content&#8217;] &nbsp;&nbsp;&nbsp;&nbsp;else: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(23333) itchatmp.run() \u767b\u5f55\u540e\u590d\u5236 python&nbsp;&nbsp;main.py&nbsp;&nbsp;##\u8fd0\u884c\u6d4b\u8bd5\u4e86\u3002\u3002\u3002\u3002 \u767b\u5f55\u540e\u590d\u5236 \u4fee\u6539\u7aef\u53e3\u53f7\uff1aitchatmp.run(port=8888) &nbsp; \u8bb0\u5f97\u4fee\u6539\u9632\u706b\u5899\uff0c\u8fd9\u91cc\u6211\u5c31\u88ab\u5751\u4e86\u3002&nbsp;&nbsp;\u5fae\u4fe1\u56de\u8c03\u6a21\u5f0f\u652f\u6301&nbsp;&nbsp;x.x.x.x:8888 &nbsp; iptable&nbsp;&nbsp;&nbsp;-A&nbsp;INPUT&nbsp;-p&nbsp;tcp&nbsp;-m&nbsp;tcp&nbsp;&#8211;dport&nbsp;8888&nbsp;-j&nbsp;ACCEPT \u767b\u5f55\u540e\u590d\u5236 \u7ed3\u679c\uff1a &nbsp;&nbsp;&nbsp;&nbsp;\u5f53\u5fae\u4fe1\u4f01\u4e1a\u53f7\uff0c\u6536\u5230\u56de\u590d\u4f55\u5168\uff0c\u8fd4\u56de \u59d3\u540d\uff1a\u4f55\u5168 \u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u4f01\u4e1a\u53f7\u5f00\u53d1:\u5f00\u542f\u56de\u8c03\u6a21\u5f0f\/Python\u5224\u65ad\u4fe1\u606f-\u56de\u590d\u6307\u5b9a\u5185\u5bb9\u793a\u4f8b\u4ee3\u7801\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-28543","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28543","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=28543"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28543\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}