@Puteulanus #6 不错的示范 😄于是我照猫画虎,经过约 5 轮的对话,免费的 GPT 3.5 为我写了个能 work 的 PHP 版本:“` $responseIP\n”; }}// 解析 DNS 请求function dns_parse_message($data){ $dnsHeader = unpack(‘nid/nflags/nqdcount/nancount/nnscount/narcount’, substr($data, 0, 12)); $question = []; $offset = 12; for ($i = 0; $i rtrim($questionName, ‘.’), ‘qtype’ => isset(unpack(‘ntype’, substr($data, $offset, 2))[‘type’]) ? unpack(‘ntype’, substr($data, $offset, 2))[‘type’] : ”, ]; $offset += 4; } return [ ‘header’ => $dnsHeader, ‘question’ => $question, ];}// 构建 DNS 响应function dns_build_response($request, $ip){ $header = pack(‘nnnnnn’, $request[‘header’][‘id’], 0x8180, 1, 1, 0, 0); $question = ”; foreach ($request[‘question’] as $q) { $question .= dns_compress_name($q[‘qname’]) . pack(‘nn’, 1, 1); } $answer = dns_compress_name($request[‘question’][0][‘qname’]) . pack(‘n*’, 1, 1, 0, 1, 0, 4); // 响应类型为 A 记录,TTL 为 0 ,数据长度为 4 $answer .= inet_pton($ip); // 将 IP 地址转换为二进制格式 return $header . $question . $answer;}// 辅助函数,检查字符串结尾function endsWith($haystack, $needle){ return substr($haystack, -strlen($needle)) === $needle;}// 辅助函数,压缩 DNS 消息中的域名function dns_compress_name($name){ $parts = explode(‘.’, $name); $compressedName = ”; foreach ($parts as $part) { $compressedName .= chr(strlen($part)) . $part; } return $compressedName . “\x00”;}?>“`
幸运之星正在降临...
点击领取今天的签到奖励!
恭喜!您今天获得了{{mission.data.mission.credit}}积分
我的优惠劵
-
¥优惠劵使用时效:无法使用使用时效:
之前
使用时效:永久有效优惠劵ID:×
没有优惠劵可用!
















![[Release] Tree Of Savior](https://www.nicekj.com/wp-content/uploads/replace/4f98107ca1ebd891ea38f390f1226e45.png)



![[一键安装] 手游-天道情缘](https://www.nicekj.com/wp-content/uploads/replace/b441383e0c7eb3e52c9980e11498e137.png)
![[一键安装] 霸王大陆EP8-5.0 虚拟机+源码+大背包+商城-最新整理](https://www.nicekj.com/wp-content/uploads/thumb/replace/fill_w372_h231_g0_mark_0d204bcf457d56afaeacf1e97e86ee45.png)

![[一键安装] 龙之谷手游飓风龙单机版一键端 完整GM后台局域网](https://www.nicekj.com/wp-content/uploads/thumb/replace/fill_w372_h231_g0_mark_77ae8bb495cba3dd592ef131cc7aea5f.jpeg)






