{"id":796,"date":"2024-11-07T08:16:47","date_gmt":"2024-11-07T00:16:47","guid":{"rendered":"https:\/\/fwq.ai\/blog\/796\/"},"modified":"2024-11-07T08:16:47","modified_gmt":"2024-11-07T00:16:47","slug":"python%e7%88%ac%e8%99%abjs%e6%80%8e%e4%b9%88%e8%a7%a3%e5%af%86","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/796\/","title":{"rendered":"python\u722c\u866bjs\u600e\u4e48\u89e3\u5bc6"},"content":{"rendered":"<blockquote><p>\n  python\u722c\u866b\u4e2d\u9047\u5230js\u6df7\u6dc6\u6216\u52a0\u5bc6\u9875\u9762\u5185\u5bb9\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528js\u89e3\u5bc6\u5de5\u5177\u89e3\u51b3\uff1a\u8bc6\u522b\u52a0\u5bc6\uff1a\u68c0\u67e5\u6e90\u4ee3\u7801\u6216\u4f7f\u7528\u7f51\u7edc\u5206\u6790\u5de5\u5177\u3002\u89e3\u5bc6\u65b9\u6cd5\uff1a\u624b\u52a8\u89e3\u5bc6\uff08\u6280\u672f\u8981\u6c42\u9ad8\uff09\u6216\u4f7f\u7528js\u89e3\u5bc6\u5de5\u5177\uff08\u5982pyexecjs\u3001jaywalking\uff09\u3002pyexecjs\u4f7f\u7528\uff1a\u5bfc\u5165\u5e93\u3001\u7f16\u8bd1js\u4ee3\u7801\u3001\u6267\u884c\u89e3\u5bc6\u51fd\u6570\u3002jaywalking\u4f7f\u7528\uff1a\u5bfc\u5165\u5e93\u3001\u6a21\u62df\u6d4f\u89c8\u5668\u3001\u6267\u884c\u89e3\u5bc6\u811a\u672c\u3002\u6ce8\u610f\uff1a\u53cd\u722c\u866b\u673a\u5236\u3001\u52a0\u5bc6\u7b97\u6cd5\u66f4\u65b0\u3001\u6548\u7387\u95ee\u9898\u3002\n<\/p><\/blockquote>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1108\" src=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/2024101816122398523.jpg\" width=\"800\" height=\"320\" srcset=\"https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/2024101816122398523.jpg 800w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/2024101816122398523-300x120.jpg 300w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/2024101816122398523-768x307.jpg 768w, https:\/\/fwq.ai\/blog\/wp-content\/uploads\/2024\/11\/2024101816122398523-670x268.jpg 670w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" title=\"python\u722c\u866bjs\u600e\u4e48\u89e3\u5bc6\u63d2\u56fe\" alt=\"python\u722c\u866bjs\u600e\u4e48\u89e3\u5bc6\u63d2\u56fe\" \/><\/p>\n<p><strong>Python\u722c\u866b\u4e2d\u7684JS\u89e3\u5bc6<\/strong><\/p>\n<p>\u5728\u7f51\u7edc\u722c\u53d6\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u4f1a\u9047\u5230\u88abJavaScript\u6df7\u6dc6\u6216\u52a0\u5bc6\u7684\u9875\u9762\u5185\u5bb9\uff0c\u7ed9\u6570\u636e\u63d0\u53d6\u5e26\u6765\u56f0\u96be\u3002Python\u722c\u866b\u53ef\u4ee5\u7ed3\u5408JS\u89e3\u5bc6\u5de5\u5177\u6765\u89e3\u51b3\u6b64\u95ee\u9898\u3002<\/p>\n<p><strong>1. \u8bc6\u522bJS\u52a0\u5bc6<\/strong><\/p>\n<p>\u9996\u5148\u9700\u8981\u5224\u65ad\u9875\u9762\u5185\u5bb9\u662f\u5426\u88abJS\u52a0\u5bc6\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201cPython\u514d\u8d39\u5b66\u4e60\u7b14\u8bb0\uff08\u6df1\u5165\uff09\u201d\uff1b<\/p>\n<ul>\n<li> <strong>\u67e5\u770b\u9875\u9762\u6e90\u4ee3\u7801\uff1a<\/strong>\u5982\u679c\u9875\u9762\u6e90\u4ee3\u7801\u4e2d\u5305\u542b\u5927\u91cf\u6df7\u6dc6\u7684JavaScript\u4ee3\u7801\uff0c\u5219\u53ef\u80fd\u5b58\u5728\u52a0\u5bc6\u3002<\/li>\n<li> <strong>\u4f7f\u7528\u7f51\u7edc\u5206\u6790\u5de5\u5177\uff1a<\/strong>\u5982Fiddler\u6216Charles\uff0c\u53ef\u4ee5\u5728HTTP\u54cd\u5e94\u4e2d\u67e5\u770b\u9875\u9762\u5185\u5bb9\u662f\u5426\u88ab\u52a0\u5bc6\u3002<\/li>\n<\/ul>\n<p><strong>2. \u89e3\u5bc6\u65b9\u6cd5<\/strong><\/p>\n<p>\u5982\u679c\u786e\u5b9a\u9875\u9762\u5185\u5bb9\u88ab\u52a0\u5bc6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6cd5\u8fdb\u884c\u89e3\u5bc6\uff1a<\/p>\n<ul>\n<li> <strong>\u624b\u52a8\u89e3\u5bc6\uff1a<\/strong>\u901a\u8fc7\u5206\u6790JS\u4ee3\u7801\uff0c\u627e\u5230\u52a0\u5bc6\u7b97\u6cd5\u5e76\u624b\u52a8\u7f16\u5199\u89e3\u5bc6\u4ee3\u7801\u3002\u8fd9\u79cd\u65b9\u6cd5\u8017\u65f6\u4e14\u9700\u8981\u8f83\u9ad8\u7684\u6280\u672f\u6c34\u5e73\u3002<\/li>\n<li> <strong>\u4f7f\u7528JS\u89e3\u5bc6\u5de5\u5177\uff1a<\/strong>\u6709\u4e00\u4e9b\u73b0\u6210\u7684JS\u89e3\u5bc6\u5de5\u5177\u53ef\u4ee5\u81ea\u52a8\u5b8c\u6210\u89e3\u5bc6\u8fc7\u7a0b\uff0c\u5982PyExecJS\u548cjaywalking\u3002<\/li>\n<\/ul>\n<p><strong>3. \u4f7f\u7528PyExecJS\u8fdb\u884c\u89e3\u5bc6<\/strong><\/p>\n<p>PyExecJS\u662f\u4e00\u4e2aPython\u5e93\uff0c\u53ef\u4ee5\u6267\u884cJavaScript\u4ee3\u7801\u3002\u5b83\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u4f7f\u7528\u6765\u89e3\u5bc6JS\u6df7\u6dc6\u7684\u9875\u9762\uff1a<\/p>\n<pre>import pyexecjs\ncontext = pyexecjs.compile(\"\"\"\n    function decrypt(encrypted) {\n        \/\/ \u89e3\u5bc6\u7b97\u6cd5\n    }\n\"\"\")\ndecrypted = context.call(\"decrypt\", encrypted_value)<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u4f7f\u7528jaywalking\u8fdb\u884c\u89e3\u5bc6<\/strong><\/p>\n<p>jaywalking\u662f\u4e00\u4e2aPython\u5e93\uff0c\u53ef\u4ee5\u6a21\u62df\u6d4f\u89c8\u5668\u73af\u5883\u6267\u884cJavaScript\u4ee3\u7801\u3002\u5b83\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u4f7f\u7528\u6765\u89e3\u5bc6JS\u52a0\u5bc6\u7684\u9875\u9762\uff1a<\/p>\n<pre>import jaywalking\njay = jaywalking.Jaywalking()\njay.open_url(encrypted_url)\ndecrypted_value = jay.execute_script(\"decrypt(encrypted_value)\")<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u6ce8\u610f\u70b9<\/strong><\/p>\n<p>\u5728\u4f7f\u7528JS\u89e3\u5bc6\u65f6\uff0c\u9700\u8981\u8003\u8651\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<ul>\n<li> <strong>\u53cd\u722c\u866b\u673a\u5236\uff1a<\/strong>\u7f51\u7ad9\u53ef\u80fd\u91c7\u53d6\u53cd\u722c\u866b\u673a\u5236\u68c0\u6d4b\u5e76\u963b\u6b62\u89e3\u5bc6\u884c\u4e3a\u3002<\/li>\n<li> <strong>\u89e3\u5bc6\u7b97\u6cd5\u66f4\u65b0\uff1a<\/strong>\u7f51\u7ad9\u53ef\u80fd\u4f1a\u66f4\u65b0\u89e3\u5bc6\u7b97\u6cd5\uff0c\u5bfc\u81f4\u73b0\u6709\u7684\u89e3\u5bc6\u5de5\u5177\u5931\u6548\u3002<\/li>\n<li> <strong>\u6548\u7387\u95ee\u9898\uff1a<\/strong>JS\u89e3\u5bc6\u662f\u4e00\u4e2a\u8017\u65f6\u7684\u8fc7\u7a0b\uff0c\u53ef\u80fd\u5f71\u54cd\u722c\u866b\u7684\u6548\u7387\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fpython\u722c\u866bjs\u600e\u4e48\u89e3\u5bc6\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>python\u722c\u866b\u4e2d\u9047\u5230js\u6df7\u6dc6\u6216\u52a0\u5bc6\u9875\u9762\u5185\u5bb9\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528js\u89e3\u5bc6\u5de5\u5177\u89e3\u51b3\uff1a\u8bc6\u522b\u52a0\u5bc6\uff1a\u68c0\u67e5\u6e90\u4ee3\u7801\u6216\u4f7f\u7528\u7f51\u7edc\u5206\u6790\u5de5\u5177\u3002\u89e3\u5bc6\u65b9\u6cd5\uff1a\u624b\u52a8\u89e3\u5bc6\uff08\u6280\u672f\u8981\u6c42\u9ad8\uff09\u6216\u4f7f\u7528js\u89e3\u5bc6\u5de5\u5177\uff08\u5982pyexecjs\u3001jaywalking\uff09\u3002pyexecjs\u4f7f\u7528\uff1a\u5bfc\u5165\u5e93\u3001\u7f16\u8bd1js\u4ee3\u7801\u3001\u6267\u884c\u89e3\u5bc6\u51fd\u6570\u3002jaywalking\u4f7f\u7528\uff1a\u5bfc\u5165\u5e93\u3001\u6a21\u62df\u6d4f\u89c8\u5668\u3001\u6267\u884c\u89e3\u5bc6\u811a\u672c\u3002\u6ce8\u610f\uff1a\u53cd\u722c\u866b\u673a\u5236\u3001\u52a0\u5bc6\u7b97\u6cd5\u66f4\u65b0\u3001\u6548\u7387\u95ee\u9898\u3002 Python\u722c\u866b\u4e2d\u7684JS\u89e3\u5bc6 \u5728\u7f51\u7edc\u722c\u53d6\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u4f1a\u9047\u5230\u88abJavaScript\u6df7\u6dc6\u6216\u52a0\u5bc6\u7684\u9875\u9762\u5185\u5bb9\uff0c\u7ed9\u6570\u636e\u63d0\u53d6\u5e26\u6765\u56f0\u96be\u3002Python\u722c\u866b\u53ef\u4ee5\u7ed3\u5408JS\u89e3\u5bc6\u5de5\u5177\u6765\u89e3\u51b3\u6b64\u95ee\u9898\u3002 1. \u8bc6\u522bJS\u52a0\u5bc6 \u9996\u5148\u9700\u8981\u5224\u65ad\u9875\u9762\u5185\u5bb9\u662f\u5426\u88abJS\u52a0\u5bc6\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6cd5\uff1a \u7acb\u5373\u5b66\u4e60\u201cPython\u514d\u8d39\u5b66\u4e60\u7b14\u8bb0\uff08\u6df1\u5165\uff09\u201d\uff1b \u67e5\u770b\u9875\u9762\u6e90\u4ee3\u7801\uff1a\u5982\u679c\u9875\u9762\u6e90\u4ee3\u7801\u4e2d\u5305\u542b\u5927\u91cf\u6df7\u6dc6\u7684JavaScript\u4ee3\u7801\uff0c\u5219\u53ef\u80fd\u5b58\u5728\u52a0\u5bc6\u3002 \u4f7f\u7528\u7f51\u7edc\u5206\u6790\u5de5\u5177\uff1a\u5982Fiddler\u6216Charles\uff0c\u53ef\u4ee5\u5728HTTP\u54cd\u5e94\u4e2d\u67e5\u770b\u9875\u9762\u5185\u5bb9\u662f\u5426\u88ab\u52a0\u5bc6\u3002 2. \u89e3\u5bc6\u65b9\u6cd5 \u5982\u679c\u786e\u5b9a\u9875\u9762\u5185\u5bb9\u88ab\u52a0\u5bc6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6cd5\u8fdb\u884c\u89e3\u5bc6\uff1a \u624b\u52a8\u89e3\u5bc6\uff1a\u901a\u8fc7\u5206\u6790JS\u4ee3\u7801\uff0c\u627e\u5230\u52a0\u5bc6\u7b97\u6cd5\u5e76\u624b\u52a8\u7f16\u5199\u89e3\u5bc6\u4ee3\u7801\u3002\u8fd9\u79cd\u65b9\u6cd5\u8017\u65f6\u4e14\u9700\u8981\u8f83\u9ad8\u7684\u6280\u672f\u6c34\u5e73\u3002 \u4f7f\u7528JS\u89e3\u5bc6\u5de5\u5177\uff1a\u6709\u4e00\u4e9b\u73b0\u6210\u7684JS\u89e3\u5bc6\u5de5\u5177\u53ef\u4ee5\u81ea\u52a8\u5b8c\u6210\u89e3\u5bc6\u8fc7\u7a0b\uff0c\u5982PyExecJS\u548cjaywalking\u3002 3. \u4f7f\u7528PyExecJS\u8fdb\u884c\u89e3\u5bc6 PyExecJS\u662f\u4e00\u4e2aPython\u5e93\uff0c\u53ef\u4ee5\u6267\u884cJavaScript\u4ee3\u7801\u3002\u5b83\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u4f7f\u7528\u6765\u89e3\u5bc6JS\u6df7\u6dc6\u7684\u9875\u9762\uff1a import pyexecjs context = pyexecjs.compile(&#8220;&#8221;&#8221; function decrypt(encrypted) { \/\/ \u89e3\u5bc6\u7b97\u6cd5 } &#8220;&#8221;&#8221;) decrypted = context.call(&#8220;decrypt&#8221;, encrypted_value) \u767b\u5f55\u540e\u590d\u5236 4. \u4f7f\u7528jaywalking\u8fdb\u884c\u89e3\u5bc6 jaywalking\u662f\u4e00\u4e2aPython\u5e93\uff0c\u53ef\u4ee5\u6a21\u62df\u6d4f\u89c8\u5668\u73af\u5883\u6267\u884cJavaScript\u4ee3\u7801\u3002\u5b83\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u4f7f\u7528\u6765\u89e3\u5bc6JS\u52a0\u5bc6\u7684\u9875\u9762\uff1a import jaywalking jay = jaywalking.Jaywalking() jay.open_url(encrypted_url) decrypted_value = jay.execute_script(&#8220;decrypt(encrypted_value)&#8221;) \u767b\u5f55\u540e\u590d\u5236 5. \u6ce8\u610f\u70b9 \u5728\u4f7f\u7528JS\u89e3\u5bc6\u65f6\uff0c\u9700\u8981\u8003\u8651\u4ee5\u4e0b\u51e0\u70b9\uff1a \u53cd\u722c\u866b\u673a\u5236\uff1a\u7f51\u7ad9\u53ef\u80fd\u91c7\u53d6\u53cd\u722c\u866b\u673a\u5236\u68c0\u6d4b\u5e76\u963b\u6b62\u89e3\u5bc6\u884c\u4e3a\u3002 \u89e3\u5bc6\u7b97\u6cd5\u66f4\u65b0\uff1a\u7f51\u7ad9\u53ef\u80fd\u4f1a\u66f4\u65b0\u89e3\u5bc6\u7b97\u6cd5\uff0c\u5bfc\u81f4\u73b0\u6709\u7684\u89e3\u5bc6\u5de5\u5177\u5931\u6548\u3002 \u6548\u7387\u95ee\u9898\uff1aJS\u89e3\u5bc6\u662f\u4e00\u4e2a\u8017\u65f6\u7684\u8fc7\u7a0b\uff0c\u53ef\u80fd\u5f71\u54cd\u722c\u866b\u7684\u6548\u7387\u3002 \u4ee5\u4e0a\u5c31\u662fpython\u722c\u866bjs\u600e\u4e48\u89e3\u5bc6\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":[16],"tags":[],"class_list":["post-796","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/796","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=796"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/796\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}