{"id":12310,"date":"2024-06-05T19:28:02","date_gmt":"2024-06-05T19:28:02","guid":{"rendered":"https:\/\/www.nicekj.com\/answer\/12310.html"},"modified":"2024-06-05T19:28:02","modified_gmt":"2024-06-05T19:28:02","slug":"puteulanus-6-bucuodeshifan-yushiwozhaomaohuahujingguoyue-5-lunai","status":"publish","type":"answer","link":"https:\/\/www.nicekj.com\/answer\/12310.html","title":{"rendered":"@Puteulanus #6 \u4e0d\u9519\u7684\u793a\u8303 \ud83d\ude04\u4e8e\u662f\u6211\u7167\u732b\u753b\u864e\uff0c\u7ecf\u8fc7\u7ea6 5 \u8f6e\u7684\u5bf9\u8bdd\uff0c\u514d\u8d39\u7684 GPT 3.5 \u4e3a\u6211\u5199\u4e86\u4e2a\u80fd &hellip;"},"content":{"rendered":"<p>@Puteulanus #6 \u4e0d\u9519\u7684\u793a\u8303 \ud83d\ude04\u4e8e\u662f\u6211\u7167\u732b\u753b\u864e\uff0c\u7ecf\u8fc7\u7ea6 5 \u8f6e\u7684\u5bf9\u8bdd\uff0c\u514d\u8d39\u7684 GPT 3.5 \u4e3a\u6211\u5199\u4e86\u4e2a\u80fd work \u7684 PHP \u7248\u672c\uff1a&#8220;` $responseIP\\n&#8221;; }}\/\/ \u89e3\u6790 DNS \u8bf7\u6c42function dns_parse_message($data){ $dnsHeader = unpack(&#8216;nid\/nflags\/nqdcount\/nancount\/nnscount\/narcount&#8217;, substr($data, 0, 12)); $question = []; $offset = 12; for ($i = 0; $i  rtrim($questionName, &#8216;.&#8217;), &#8216;qtype&#8217; =&gt; isset(unpack(&#8216;ntype&#8217;, substr($data, $offset, 2))[&#8216;type&#8217;]) ? unpack(&#8216;ntype&#8217;, substr($data, $offset, 2))[&#8216;type&#8217;] : &#8221;, ]; $offset += 4; } return [ &#8216;header&#8217; =&gt; $dnsHeader, &#8216;question&#8217; =&gt; $question, ];}\/\/ \u6784\u5efa DNS \u54cd\u5e94function dns_build_response($request, $ip){ $header = pack(&#8216;nnnnnn&#8217;, $request[&#8216;header&#8217;][&#8216;id&#8217;], 0x8180, 1, 1, 0, 0); $question = &#8221;; foreach ($request[&#8216;question&#8217;] as $q) { $question .= dns_compress_name($q[&#8216;qname&#8217;]) . pack(&#8216;nn&#8217;, 1, 1); } $answer = dns_compress_name($request[&#8216;question&#8217;][0][&#8216;qname&#8217;]) . pack(&#8216;n*&#8217;, 1, 1, 0, 1, 0, 4); \/\/ \u54cd\u5e94\u7c7b\u578b\u4e3a A \u8bb0\u5f55\uff0cTTL \u4e3a 0 \uff0c\u6570\u636e\u957f\u5ea6\u4e3a 4 $answer .= inet_pton($ip); \/\/ \u5c06 IP \u5730\u5740\u8f6c\u6362\u4e3a\u4e8c\u8fdb\u5236\u683c\u5f0f return $header . $question . $answer;}\/\/ \u8f85\u52a9\u51fd\u6570\uff0c\u68c0\u67e5\u5b57\u7b26\u4e32\u7ed3\u5c3efunction endsWith($haystack, $needle){ return substr($haystack, -strlen($needle)) === $needle;}\/\/ \u8f85\u52a9\u51fd\u6570\uff0c\u538b\u7f29 DNS \u6d88\u606f\u4e2d\u7684\u57df\u540dfunction dns_compress_name($name){ $parts = explode(&#8216;.&#8217;, $name); $compressedName = &#8221;; foreach ($parts as $part) { $compressedName .= chr(strlen($part)) . $part; } return $compressedName . &#8220;\\x00&#8221;;}?&gt;&#8220;`<\/p>\n","protected":false},"excerpt":{"rendered":"<p>@Puteulanus #6 \u4e0d\u9519\u7684\u793a\u8303 \ud83d\ude04\u4e8e\u662f\u6211\u7167\u732b\u753b\u864e\uff0c\u7ecf\u8fc7\u7ea6 5 \u8f6e\u7684\u5bf9\u8bdd\uff0c\u514d\u8d39\u7684 GPT 3.5 \u4e3a\u6211\u5199\u4e86\u4e2a\u80fd work \u7684 PHP \u7248\u672c\uff1a&#8220;` $responseIP\\n&#8221;; }}\/\/ \u89e3\u6790 DNS \u8bf7\u6c42function dns_parse_message($data){ $dnsHeader = unpack(&#8216;nid\/nflags\/nqdcount\/nancount\/nnscount\/narcount&#8217;, substr($data, 0, 12)); $<\/p>\n","protected":false},"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","class_list":["post-12310","answer","type-answer","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.nicekj.com\/nicekj2024\/wp\/v2\/answer\/12310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nicekj.com\/nicekj2024\/wp\/v2\/answer"}],"about":[{"href":"https:\/\/www.nicekj.com\/nicekj2024\/wp\/v2\/types\/answer"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nicekj.com\/nicekj2024\/wp\/v2\/comments?post=12310"}],"wp:attachment":[{"href":"https:\/\/www.nicekj.com\/nicekj2024\/wp\/v2\/media?parent=12310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}