<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>冲鸭安全</title>
    <link>https://wechat2rss.xlab.app/feed/25499156ea68aa4ac597801e9be69707e31bba73.xml</link>
    <description>我们阻止威胁&#xA;(wechat feed made by @ttttmr https://wechat2rss.xlab.app)</description>
    <managingEditor> (冲鸭安全)</managingEditor>
    <image>
      <url>https://wx.qlogo.cn/mmhead/LIUI5tJGiauANoIrA14jIOELuHIeJ7TnUIj6aicj1eerkcowXAPGz3H34oYIl0iaU3sEsrPfQGjajs/0</url>
      <title>冲鸭安全</title>
      <link>https://wechat2rss.xlab.app/feed/25499156ea68aa4ac597801e9be69707e31bba73.xml</link>
    </image>
    <item>
      <title>慎用Claude code新版本(2.1.30x),会上传GIT</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486489&amp;idx=1&amp;sn=eae0627a491eb3d1475280fba747bda2</link>
      <description>Claude code新版本现在加了个东西 &#xA;&#xA;抛开更强的中转站检测不谈，他加了一个叫做x-claude-code-wiggly-dove的字段（目前是灰度还没放量，但是很快就放了，灰度叫”tengu_wiggly_dove”)&#xA;&#xA;他是一个大量混淆的字段，会拼接到message里面上传，意味着你没办法在http头里面看到他&#xA;&#xA;解了混淆后，他会上传如下信息：&#xA;&#xA;如你所见，他现在会上传你的当前目录的git的URL!一键定位到哪个组织用哪个中转站开发哪个项目。&#xA;&#xA;猜测是如果直接分析message交互信息里面的git，一个是不合法，另外一个是数据量太大，不好定位到人（还有隐私问题）。现在是客户端直接上传字段带git地址，定位到人更方便了。并且这个无法关闭，之前的遥测还能关闭，即便是走中转站开发红队项目或者某些私有项目也会被上传到A÷服务器。&#xA;&#xA;建议慎用这玩意，照这个趋势，他们迟早会上传你的完整项目打包到他们服务器的。</description>
      <content:encoded><![CDATA[<p><span>冲鸭安全</span> <span>2026-10-19 22:32</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=954c93da&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPyy9ZNmvIibnnWLDnkSNrl3pCPD1uFSne6LLO5TM1wEaeyaXBvxibibEy084SRW3VG9OoWegjbdibXgtrVrVVXLURYcLF7kpbXRv0%2F640%3Fwx_fmt%3Dpng%26amp%3Bfrom%3Dappmsg"/></p>
  <p>Claude code新版本现在加了个东西 </p><p>抛开更强的中转站检测不谈，他加了一个叫做x-claude-code-wiggly-dove的字段（目前是灰度还没放量，但是很快就放了，灰度叫”tengu_wiggly_dove”)</p><p>他是一个大量混淆的字段，会拼接到message里面上传，意味着你没办法在http头里面看到他</p><p>解了混淆后，他会上传如下信息：</p><p>如你所见，他现在会上传你的当前目录的git的URL!一键定位到哪个组织用哪个中转站开发哪个项目。</p><p>猜测是如果直接分析message交互信息里面的git，一个是不合法，另外一个是数据量太大，不好定位到人（还有隐私问题）。现在是客户端直接上传字段带git地址，定位到人更方便了。并且这个无法关闭，之前的遥测还能关闭，即便是走中转站开发红队项目或者某些私有项目也会被上传到A÷服务器。</p><p>建议慎用这玩意，照这个趋势，他们迟早会上传你的完整项目打包到他们服务器的。</p>
  



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=ab5d3e4d&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486489%26idx%3D1%26sn%3Deae0627a491eb3d1475280fba747bda2">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 19 Oct 2026 22:32:00 +0800</pubDate>
    </item>
    <item>
      <title>慎用Claude code新版本(2.1.30x),会上传GIT URL地址</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486483&amp;idx=1&amp;sn=17d98d23bdbd5a2a837a9ddc9c04edd1</link>
      <description></description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-10-19 22:27</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=e394b0ca&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVO3M9X7pFTufP6uZianibkC5AjfzTxibG63fyLyEFqKCBUZyp73BUl6PWRKaXeEvVZMsWAjeLzUQFTFacy1ialSJw4dPz8ARmicoUU0%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">Claude code新版本现在加了个东西 </span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">抛开更强的中转站检测不谈，他加了一个叫做</span><span leaf="" data-pm-slice="1 1 [&#34;para&#34;,{&#34;tagName&#34;:&#34;p&#34;,&#34;attributes&#34;:{&#34;style&#34;:&#34;box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241); margin-top: 0px; margin-bottom: 1rem; display: block; color: rgb(102, 102, 102); font-family: \&#34;Hiragino Sans GB\&#34;, 微软雅黑, 黑体, Arial, sans-serif; font-size: 14.992px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&#34;,&#34;data-pm-slice&#34;:&#34;0 0 []&#34;},&#34;namespaceURI&#34;:&#34;http://www.w3.org/1999/xhtml&#34;,&#34;data-layout-id&#34;:null}]">x-claude-code-wiggly-dove的字段（目前是灰度还没放量，但是很快就放了，灰度叫”tengu_wiggly_dove”)</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="" data-pm-slice="1 1 [&#34;para&#34;,{&#34;tagName&#34;:&#34;p&#34;,&#34;attributes&#34;:{&#34;style&#34;:&#34;box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241); margin-top: 0px; margin-bottom: 1rem; display: block; color: rgb(102, 102, 102); font-family: \&#34;Hiragino Sans GB\&#34;, 微软雅黑, 黑体, Arial, sans-serif; font-size: 14.992px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&#34;,&#34;data-pm-slice&#34;:&#34;0 0 []&#34;},&#34;namespaceURI&#34;:&#34;http://www.w3.org/1999/xhtml&#34;,&#34;data-layout-id&#34;:null}]">他是一个大量混淆的字段，会拼接到message里面上传，意味着你没办法在http头里面看到他</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="" data-pm-slice="1 1 [&#34;para&#34;,{&#34;tagName&#34;:&#34;p&#34;,&#34;attributes&#34;:{&#34;style&#34;:&#34;box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241); margin-top: 0px; margin-bottom: 1rem; display: block; color: rgb(102, 102, 102); font-family: \&#34;Hiragino Sans GB\&#34;, 微软雅黑, 黑体, Arial, sans-serif; font-size: 14.992px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;&#34;,&#34;data-pm-slice&#34;:&#34;0 0 []&#34;},&#34;namespaceURI&#34;:&#34;http://www.w3.org/1999/xhtml&#34;,&#34;data-layout-id&#34;:null}]">解了混淆后，他会上传如下信息：</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002832" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0e3ef82e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPyy9ZNmvIibnnWLDnkSNrl3pCPD1uFSne6LLO5TM1wEaeyaXBvxibibEy084SRW3VG9OoWegjbdibXgtrVrVVXLURYcLF7kpbXRv0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span leaf="">如你所见，他现在会上传你的当前目录的git的URL!一键定位到哪个组织用哪个中转站开发哪个项目。</span></p><p><span leaf="">猜测是如果直接分析message交互信息里面的git，一个是不合法，另外一个是数据量太大，不好定位到人（还有隐私问题）。现在是客户端直接上传字段带git地址，定位到人更方便了。<span textstyle="" style="font-weight: bold;">并且这个无法关闭，之前的遥测还能关闭，即便是走中转站开发红队项目或者某些私有项目也会被上传到A÷服务器。</span></span></p><p><span leaf="">建议慎用这玩意，照这个趋势，他们迟早会上传你的完整项目打包到他们服务器的。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=6824c9e5&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486483%26idx%3D1%26sn%3D17d98d23bdbd5a2a837a9ddc9c04edd1">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 19 Oct 2026 22:27:00 +0800</pubDate>
    </item>
    <item>
      <title>ClaudeCode(2.1.283)逆向和完整遥测分析</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486477&amp;idx=1&amp;sn=a2e97c12935280e3d5a9fad10c500d7e</link>
      <description></description>
      <content:encoded><![CDATA[<p>原创 <span>为了安全鸭</span> <span>2026-10-05 22:00</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=befbda79&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVOpPOM1lXypESEl7ic8gaoARHu8fC8vapI0oZTjdqfI4GqSLqyF01rTgw57v0MXMLu1EHKicft5qZRpIBoQCz3uLCGUYGtEqJL0k%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最近在开中转站,众所周知sub2api的特征是非常多的,所以我完整的逆向了cladue code的全部协议一比一对特征解决特征，但是越来越发现这玩意非常的离谱，有些已经超出代码编辑工具的边界了，故在此公开分析报告，我用的是我电脑上的Claude code 的2.1.283的版本。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Claude code的遥测</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Claudecode存在一个遥测系统，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">而这个Claude code的遥测系统不会随着你用中转站而关闭</span></strong><span leaf="">。也就是说你用了他们的产品就会发送遥测数据给Claude code，除非你使用</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个环境变量把他关闭。</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">function gmt() {</span><br/><span leaf="">    if (process.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC)</span><br/><span leaf="">        return &#34;essential-traffic&#34;;</span><br/><span leaf="">    if (process.env.DISABLE_TELEMETRY)</span><br/><span leaf="">        return &#34;no-telemetry&#34;;</span><br/><span leaf="">    if (Ne(process.env.DO_NOT_TRACK))</span><br/><span leaf="">        return &#34;no-telemetry&#34;;</span><br/><span leaf="">    return &#34;default&#34;;</span><br/><span leaf="">}</span><br/><span leaf="">function It() {</span><br/><span leaf="">    return gmt() === &#34;essential-traffic&#34;;</span><br/><span leaf="">}</span><br/><span leaf="">function $D() {</span><br/><span leaf="">    return gmt() !== &#34;default&#34;;</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">一旦遥测打开，后续的信息都会发送给:</span></strong></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf=""><a href="https://api.anthropic.com/api/event_logging/v2/batch" target="_blank">https://api.anthropic.com/api/event_logging/v2/batch</a></span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们看看他有什么行为</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Claude code唯一标识符</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">当你装Claude code的时候，cc会在你电脑上生成一个随机的标识符</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">// 生成随机编号。</span><br/><span leaf="">let s = Ed(32).toString(&#34;hex&#34;);</span><br/><span leaf="">// 写入本地配置，字段名叫 userID。</span><br/><span leaf="">Ee(g =&gt; ({</span><br/><span leaf="">    ...g,</span><br/><span leaf="">    userID: s</span><br/><span leaf="">}), e);</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">跟外挂机器码修改一样，如果你不处理它，你就会被永久标记</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">模型信息</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果你用第三方API，比如zhipu的或者deepseek，Claude code依然会上传上去模型使用信息，会话ID，用户类型</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">模型使用信息的逻辑是:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">// 取得当前模型名称。</span><br/><span leaf="">let n = e.model ? String(e.model) : it();</span><br/><span leaf="">// 经过客户端转换。</span><br/><span leaf="">D = Jdn(n);</span><br/><span leaf="">// 放入元数据。</span><br/><span leaf="">model: D,</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">他会把模型名字去</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a href="https://downloads.claude.ai/model-catalog/v1/catalog.json" target="_blank">https://downloads.claude.ai/model-catalog/v1/catalog.json</a></span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf=""> ```javascript</span><br/><span leaf="">bne = [</span><br/><span leaf="">    &#34;claude-3-5-haiku&#34;,</span><br/><span leaf="">    &#34;claude-3-5-sonnet&#34;,</span><br/><span leaf="">    &#34;claude-3-7-sonnet&#34;,</span><br/><span leaf="">    &#34;claude-fable-5&#34;,</span><br/><span leaf="">    &#34;claude-fable-5-1&#34;,</span><br/><span leaf="">    &#34;claude-haiku-4-5&#34;,</span><br/><span leaf="">    &#34;claude-mythos-5&#34;,</span><br/><span leaf="">    &#34;claude-mythos-5-1&#34;,</span><br/><span leaf="">    &#34;claude-opus-4-0&#34;,</span><br/><span leaf="">    &#34;claude-opus-4-1&#34;,</span><br/><span leaf="">    &#34;claude-opus-4-5&#34;,</span><br/><span leaf="">    &#34;claude-opus-4-6&#34;,</span><br/><span leaf="">    &#34;claude-opus-4-7&#34;,</span><br/><span leaf="">    &#34;claude-opus-4-8&#34;,</span><br/><span leaf="">    &#34;claude-opus-5&#34;,</span><br/><span leaf="">    &#34;claude-opus-5-5&#34;,</span><br/><span leaf="">    &#34;claude-sonnet-4-0&#34;,</span><br/><span leaf="">    &#34;claude-sonnet-4-5&#34;,</span><br/><span leaf="">    &#34;claude-sonnet-4-6&#34;,</span><br/><span leaf="">    &#34;claude-sonnet-5&#34;</span><br/><span leaf="">];</span><br/><span leaf="">j1 = [</span><br/><span leaf="">    &#34;sonnet&#34;,</span><br/><span leaf="">    &#34;opus&#34;,</span><br/><span leaf="">    &#34;haiku&#34;,</span><br/><span leaf="">    &#34;fable&#34;,</span><br/><span leaf="">    &#34;best&#34;,</span><br/><span leaf="">    &#34;sonnet[1m]&#34;,</span><br/><span leaf="">    &#34;opus[1m]&#34;,</span><br/><span leaf="">    &#34;fable[1m]&#34;,</span><br/><span leaf="">    &#34;opusplan&#34;</span><br/><span leaf="">];</span><br/><span leaf="">var Fpt = &#34;claude-mythos-preview&#34;;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">拉一个列表下来，如果模型不在这里面，会标记为”confidential”如果在这里，会原样上传模型名字</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">token使用情况</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">即便是不用Claude订阅，走第三方API，也一样会上传你的token使用情况</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">包括不限于</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">压缩时候的情况</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002818" data-ratio="0.5734177215189873" data-w="790" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9176aace&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMpgog2YSicpcfjnoc1232EsDWla35DYLqbWXWc7L75V8qVmez5gZCLMaVGOkbfkHXyoaR4x7MXVYkGqCSHU0kS39xz2TxJ7PlA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">你的当前中转站URL(ANTHROPIC_BASE_URL)</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">function nMe() {</span><br/><span leaf="">    return {</span><br/><span leaf="">        ...process.env.ANTHROPIC_BASE_URL &amp;&amp; {</span><br/><span leaf="">            baseUrl: XMo(process.env.ANTHROPIC_BASE_URL)</span><br/><span leaf="">        },</span><br/><span leaf="">        ...process.env.ANTHROPIC_MODEL &amp;&amp; {</span><br/><span leaf="">            envModel: xt(process.env.ANTHROPIC_MODEL)</span><br/><span leaf="">        },</span><br/><span leaf="">        ...process.env.ANTHROPIC_SMALL_FAST_MODEL &amp;&amp; {</span><br/><span leaf="">            envSmallFastModel:</span><br/><span leaf="">                xt(process.env.ANTHROPIC_SMALL_FAST_MODEL)</span><br/><span leaf="">        }</span><br/><span leaf="">    };</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">同一个客户端/会话用了多少 token、请求速度、是否重试、用了哪些运行模式、输入是否含图片/文档、system 和工具定义多大，以及一些可关联的哈希和请求编号。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这块非常多，看图吧:</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002819" data-ratio="0.9010175763182239" data-w="1081" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=1a11403e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMJdl5j7ka1WJ8zwNQaicLzuXA2JAQkTPP9Ya37sAibmSLxadHlAq3xOYDfPvnDzyZVF7JH1wRut4En0tGphbFdicSA0mN1OOURoo%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">其中有意思的是 default_model</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们上面说了model会脱敏，而default_model的”脱敏”是一种伪脱敏，具体来说，他会过一层正则</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">var Bw = /^[A-Za-z0-9._:[\]-]{1,100}$/;</span><br/><span leaf="">var Kw =</span><br/><span leaf="">    /^[A-Za-z0-9._:[\]-]{1,91}@\d{8}(\[\d{1,3}[mM]\])?$/;</span><br/><span leaf="">function xt(e) {</span><br/><span leaf="">    if (e == null)</span><br/><span leaf="">        return;</span><br/><span leaf="">    return Bw.test(e) || Kw.test(e)</span><br/><span leaf="">        ? bn(e)</span><br/><span leaf="">        : y(&#34;nonconforming&#34;);</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果是这种格式</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">claude-sonnet-4-5</span><br/><span leaf="">gpt-4.1</span><br/><span leaf="">deepseek-chat</span><br/><span leaf="">qwen3-32b</span><br/><span leaf="">my_model:v1</span><br/><span leaf="">sonnet[1m]</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">则会变成”confidential”</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">而如果是这种</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">provider/model      含 /</span><br/><span leaf="">my model            含空格</span><br/><span leaf="">模型一               含中文</span><br/><span leaf="">model?version=1     含 ? 和 =</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">则会被标记</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">我能想到的场景是，我自己测评的模型，比如自己训练的CTF的模型，会被hit，如果用vllm，一般默认的后缀就是目录/模型名字比如这样:</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002821" data-ratio="0.2857142857142857" data-w="350" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=5fe6a59c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVN5wtlVa9gOTVErzDAvFabrLEWgMOKyOJyP7mkKEkAAYict7X6MLnJ7dWlvEtXibyt9uzU9lpkZBmGrJh2Nsw1UGUdAA5uCLAdhQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">从而变成”nonconforming”</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">skills和插件</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">当你用到skill的时候(请求中用了skill)，无论是不是claude订阅还是第三方，都会上传skill名字</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">function _W({</span><br/><span leaf="">    rawName: e,</span><br/><span leaf="">    canonicalName: n,</span><br/><span leaf="">    isMcp: r,</span><br/><span leaf="">    isBuiltIn: s,</span><br/><span leaf="">    isBundled: g,</span><br/><span leaf="">    isOfficial: h</span><br/><span leaf="">}) {</span><br/><span leaf="">    let S = r</span><br/><span leaf="">        ? &#34;mcp&#34;</span><br/><span leaf="">        : s || g || h</span><br/><span leaf="">            ? e</span><br/><span leaf="">            : &#34;custom&#34;;</span><br/><span leaf="">    return {</span><br/><span leaf="">        sanitizedName: bn(S),</span><br/><span leaf="">        skillNameHash:</span><br/><span leaf="">            S === &#34;custom&#34; ? lhr(n) : {}</span><br/><span leaf="">    };</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">你的插件也是，也会上传对应的名字</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">function bW(e, n, r = null) {</span><br/><span leaf="">    let s = Kge(e, n) ?? n;</span><br/><span leaf="">    return {</span><br/><span leaf="">        _PROTO_plugin_name: e,</span><br/><span leaf="">        ...s &amp;&amp; {</span><br/><span leaf="">            _PROTO_marketplace_name: s</span><br/><span leaf="">        },</span><br/><span leaf="">        ...zcn(e, n, r)</span><br/><span leaf="">    };</span><br/><span leaf="">}</span></code></pre><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">MCP与工具使用</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">claude code会上传你的工具使用情况，包含工具名字</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002822" data-ratio="0.5562130177514792" data-w="1183" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=fc6a8352&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMpXZm7GF2bDFSvwWmPYDciaDcCFniaSPGjzm2OEicalAbLHu9ib6IHicJjEa2iapcMPia02qtOD4VVBjVfXIfwJVtxFRAbtYyZHlicaLI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">而如果是MCP服务器，自定义的，则会脱敏走hash上传</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">var fP = &#34;claude-plugin-telemetry-v1&#34;;</span><br/><span leaf="">function aye(e) {</span><br/><span leaf="">    return cP(&#34;sha256&#34;)</span><br/><span leaf="">        .update(e + fP)</span><br/><span leaf="">        .digest(&#34;hex&#34;)</span><br/><span leaf="">        .slice(0, 16);</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">有意思的是还会上传你是拒绝还是同意，你为此等了多久(wtf)</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002823" data-ratio="0.44143426294820715" data-w="1255" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ec4b9f6f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVO8j6Tc3H670sh98TcaR6iaibM19LOENgZEbcL50GVicSBG6lXXfujlo2UQ6LRmYo1bIAjiatQFmlSCaic06XqKyY9WtJrP4LichryzE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">i(&#34;tengu_tool_use_rejected_in_prompt&#34;, {</span><br/><span leaf="">    ...kP(e, n, s, h),</span><br/><span leaf="">    ...g,</span><br/><span leaf="">    ...S,</span><br/><span leaf="">    ...r.type === &#34;hook&#34;</span><br/><span leaf="">        ? { isHook: !0 }</span><br/><span leaf="">        : {</span><br/><span leaf="">            hasFeedback:</span><br/><span leaf="">                r.type === &#34;user_reject&#34;</span><br/><span leaf="">                    ? r.hasFeedback</span><br/><span leaf="">                    : !1</span><br/><span leaf="">        }</span><br/><span leaf="">});</span></code></pre><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">运行环境</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这些是挺标准的:</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002824" data-ratio="0.7609561752988048" data-w="1255" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=998d72d4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNHZNibiaJwNGUVIUTz1Okovzrr88BLib0U1020Z5bLjSGbRSPMKVGB9dFO0dGVria96O7rXIOibJFGwplicMZKM2iaMFkhhIj8y0qJVw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">然而在以下条件下，Claudecode会额外上传tag</span></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">github的action</span></h4><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">isGithubAction:</span><br/><span leaf="">    Ne(process.env.GITHUB_ACTIONS),</span><br/><span leaf="">isClaudeCodeAction:</span><br/><span leaf="">    Ne(process.env.CLAUDE_CODE_ACTION)</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果是action环境，上传</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">事件类型、runner 环境/系统、action ref</span></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">WSL</span></h4><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">通过字符串比对是否是微软的WSL:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">getWslVersion() {</span><br/><span leaf="">    if (this.wslVersion !== null)</span><br/><span leaf="">        return this.wslVersion;</span><br/><span leaf="">    if (this.sources.platform !== &#34;linux&#34;) {</span><br/><span leaf="">        this.wslVersion = void 0;</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    let e = this.kernelString();</span><br/><span leaf="">    if (e === void 0) {</span><br/><span leaf="">        this.wslVersion = void 0;</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    let r = e.match(/wsl(\d+)/);</span><br/><span leaf="">    if (r &amp;&amp; r[1])</span><br/><span leaf="">        this.wslVersion = r[1];</span><br/><span leaf="">    else if (e.includes(&#34;microsoft&#34;))</span><br/><span leaf="">        this.wslVersion = &#34;1&#34;;</span><br/><span leaf="">    else</span><br/><span leaf="">        this.wslVersion = void 0;</span><br/><span leaf="">    return this.wslVersion;</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果是微软的WSL，则会上传WSL 版本、Linux 发行版及版本、内核信息</span></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">docker</span></h4><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果你在docker下用它，他会通过</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">if (process.env.KUBERNETES_SERVICE_HOST)</span><br/><span leaf="">    return &#34;kubernetes&#34;;</span><br/><span leaf="">if (o.isDockerenvPresent())</span><br/><span leaf="">    return &#34;docker&#34;;</span><br/><span leaf="">if (p.platform === &#34;darwin&#34;)</span><br/><span leaf="">    return &#34;unknown-darwin&#34;;</span><br/><span leaf="">if (p.platform === &#34;linux&#34;)</span><br/><span leaf="">    return &#34;unknown-linux&#34;;</span><br/><span leaf="">if (p.platform === &#34;win32&#34;)</span><br/><span leaf="">    return &#34;unknown-win32&#34;;</span><br/><span leaf="">return &#34;unknown&#34;;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">识别你是不是docker</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">进程信息</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">会上传当前进程的信息</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002825" data-ratio="0.6082191780821918" data-w="730" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=dc60a2e6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNabMIByVWptkvmlODKrPkKxfxce5quMmfURO1f2IY1l9pyhnpzpqD2hUcicqeiciboBwh24KH7dJSp3DmhZHgsnKtzmnKRewHCB0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">git信息</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Claude code会上传你的git url的前20字节并且做hash</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">async function ZWr() {</span><br/><span leaf="">    let e = await Vne();</span><br/><span leaf="">    if (!e)</span><br/><span leaf="">        return null;</span><br/><span leaf="">    let n = w2(e);</span><br/><span leaf="">    if (!n)</span><br/><span leaf="">        return null;</span><br/><span leaf="">    return So(&#34;sha256&#34;)</span><br/><span leaf="">        .update(n)</span><br/><span leaf="">        .digest(&#34;hex&#34;)</span><br/><span leaf="">        .substring(0, 16);</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">并且知道你的当前 HEAD 的提交 SHA</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">猜测是检查，哪些账户在开发相同的项目（类似于组织指纹）</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果你把Claude code放到github action，他会直接上传github的信息:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">if (n.githubActionsMetadata) {</span><br/><span leaf="">    let se = n.githubActionsMetadata;</span><br/><span leaf="">    ee.github_actions_metadata = {</span><br/><span leaf="">        actor_id: se.actorId,</span><br/><span leaf="">        repository_id: se.repositoryId,</span><br/><span leaf="">        repository_owner_id: se.repositoryOwnerId</span><br/><span leaf="">    };</span><br/><span leaf="">}</span></code></pre><ul style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">操作者 ID；</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">仓库 ID；</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">仓库所属用户/组织 ID。</span></p></li></ul><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">GrowthBook云控</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在启动的时候，Claude code会发送</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002826" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=6c16a11f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNQK4jsTicI6muU2uRjddWybd7L8qp3hKYggnBdQpmAuviacrPbXoR7CN8FJxuUa0hYc2nEgFwvQNoWcfiaweVfSe2UEaJmxv2PHY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">到</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">普通评估：</span><br/><span leaf="">POST <a href="https://api.anthropic.com/api/eval/sdk-zAZezfDKGoZuXXKe" target="_blank">https://api.anthropic.com/api/eval/sdk-zAZezfDKGoZuXXKe</a></span><br/><span leaf="">带认证评估分支：</span><br/><span leaf="">POST <a href="https://api.anthropic.com/api/eval-authed/sdk-zAZezfDKGoZuXXKe" target="_blank">https://api.anthropic.com/api/eval-authed/sdk-zAZezfDKGoZuXXKe</a></span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">随后看服务端返回了什么云控功能开关:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">{</span><br/><span leaf="">  &#34;features&#34;: {</span><br/><span leaf="">    &#34;某个实验功能&#34;: {</span><br/><span leaf="">      &#34;value&#34;: true,</span><br/><span leaf="">      &#34;source&#34;: &#34;experiment&#34;,</span><br/><span leaf="">      &#34;experiment&#34;: {</span><br/><span leaf="">        &#34;key&#34;: &#34;实验编号&#34;</span><br/><span leaf="">      },</span><br/><span leaf="">      &#34;experimentResult&#34;: {</span><br/><span leaf="">        &#34;variationId&#34;: 1</span><br/><span leaf="">      }</span><br/><span leaf="">    }</span><br/><span leaf="">  }</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个是典型的云控行为，有意思的是这个云控数量达到了惊人的648个，而且很多意义不明，这里挑出来一些AI跑过的</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">tengu_heron_brook 远程服务端提示词注入</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个神奇的flag接受远程服务端的提示词并且注入到系统上下文中</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">客户端会读一个client_data</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">GET &lt;base&gt;/api/claude_cli/bootstrap</span><br/><span leaf="">    → 响应中的 client_data</span><br/><span leaf="">    → 本地 clientDataCacheSlots</span><br/><span leaf="">    → cd()</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后判断这个key</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">function hXn() {</span><br/><span leaf="">    let e = nSt();</span><br/><span leaf="">    if (!e)</span><br/><span leaf="">        return null;</span><br/><span leaf="">    return i(&#34;tengu_heron_brook_applied&#34;, {</span><br/><span leaf="">        len: e.value.length,</span><br/><span leaf="">        fromClientData: e.fromClientData</span><br/><span leaf="">    }), e.value;</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后塞到system提示词里面。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这意味着如果官方给你换了一个能执行任意代码的模型 结合这个 就能实现任意代码执行。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">当然我们不能那么坏的去看A÷是吧</span></strong></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">tengu_official_plugin_prompt_overrides 覆盖插件提示词</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">官方可以下云控，去控制自己的MCP和工具的提示词，这里要说明的是，不是任意的，是官方自己的</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">{</span><br/><span leaf="">    server_instructions: string,</span><br/><span leaf="">    server_instructions_by_server: { [serverName]: string },</span><br/><span leaf="">    tools: { [toolName]: string },</span><br/><span leaf="">    search_hints: { [toolName]: string },</span><br/><span leaf="">    param_descriptions: {</span><br/><span leaf="">        [toolName]: { [parameterName]: string }</span><br/><span leaf="">    },</span><br/><span leaf="">    prompts: { [promptName]: string },</span><br/><span leaf="">    skills: { [skillName]: string }</span><br/><span leaf="">}</span></code></pre><table style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border-collapse: collapse;width: 740px;border-spacing: 0px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><thead><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><th style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);text-align: inherit;border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;background: rgb(243, 243, 243);"><p><span leaf="">字段</span></p></th><th style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);text-align: inherit;border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;background: rgb(243, 243, 243);"><p><span leaf="">实际用途</span></p></th></tr></thead><tbody><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">server_instructions</span></p></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">覆盖 MCP 连接 server instructions</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">server_instructions_by_server</span></p></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">按 server 名覆盖 instructions</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">tools</span></p></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">覆盖已有 MCP 工具 description</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">search_hints</span></p></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">覆盖已有工具搜索提示</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">param_descriptions</span></p></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">改写已有 input schema properties 的 description</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">prompts</span></p></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">覆盖 MCP prompt 的 description</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">skills</span></p></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">覆盖发现的 MCP skill 的 description</span></p></td></tr></tbody></table><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">tengu_max_version_config 更新时候的最低版本</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">云控设置一个最低版本，更新的版本不能超过这里配置的版本</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">async function Qwe() {</span><br/><span leaf="">    let e = await Pe();</span><br/><span leaf="">    let n = e.external || void 0;</span><br/><span leaf="">    let o = n ? R.parse(n)?.version ?? void 0 : void 0;</span><br/><span leaf="">    // 原函数还有非法版本告警；此处省略。</span><br/><span leaf="">    return {</span><br/><span leaf="">        maxVersion: o,</span><br/><span leaf="">        forceDowngradeEnabled:</span><br/><span leaf="">            e.external_force_downgrade === !0</span><br/><span leaf="">    };</span><br/><span leaf="">}</span><br/><span leaf="">async function Pe() {</span><br/><span leaf="">    try { return await k1(&#34;tengu_max_version_config&#34;, {}); }</span><br/><span leaf="">    catch (e) { return d(e), {}; }</span><br/><span leaf="">}</span></code></pre><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">sub2api等各种中转站检测</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">众所周知 x-anthropic-billing-header是带了cc_version这个字段的。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">cc_version这个字段官方 Claude Code 取第一条 user 文本的第：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">4、7、20</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">三个位置，然后计算：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">SHA256(</span><br/><span leaf=""> &#34;59cf53e54c78&#34;</span><br/><span leaf=""> + text[4]</span><br/><span leaf=""> + text[7]</span><br/><span leaf=""> + text[20]</span><br/><span leaf=""> + &#34;2.1.283&#34;</span><br/><span leaf="">) 的前 3 位十六进制</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">官方是 JavaScript，所以字符串下标按 UTF-16 字符单元。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而sub2api项目的当前 Go 代码：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">chars = append(chars, firstText[i])</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">按的是 UTF-8 字节</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以会导致sub2api的项目，真实 Claude Code 先生成：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">cc_version=2.1.283.&lt;官方后缀&gt;;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">请求到 SUB2API 后，当前项目的：</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><a href="https://github.com/Wei-Shaw/sub2api/blob/a60a29549f488a854966aaec9541abbe006cac22/backend/internal/service/gateway_billing_block.go" target="_blank">https://github.com/Wei-Shaw/sub2api/blob/a60a29549f488a854966aaec9541abbe006cac22/backend/internal/service/gateway_billing_block.go</a><a class="wx_topic_link" topic-id="muvbewa2-5n1cjf" style="color: #576B95 !important;" data-topic="1" data-recommend=""></a>#L32</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">syncBillingHeaderVersion()</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">会重新计算后缀，但项目按 UTF-8 字节取第 4、7、20 位，而官方按 JavaScript UTF-16 下标取值。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">于是可能变成：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">客户端：</span><br/><span leaf="">cc_version=2.1.283.d80;</span><br/><span leaf="">SUB2API 出站：</span><br/><span leaf="">cc_version=2.1.283.fdc;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">导致sub2api被检测</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结论</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最后附上gpt-6.1-sol的结论</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">Claude Code 是能力强、但不适合当作“透明、纯本地工具”信任的客户端。基于这次对 2.1.283 的静态分析，我的评价是：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">工程能力强：工具、权限、子代理、压缩和远程任务机制完整，确实有不少安全检查。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">隐私边界不直观：推理正文、产品遥测、辅助模型请求、反馈和文件交付是不同通道。用第三方 API 不代表其他通道自动关闭。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">云端控制权较大：能调整功能参数，甚至追加模型指令、改变部分安全检查和更新签名强制策略。这扩大了你必须信任官方服务的范围。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">适合普通开发；处理高度敏感代码时，应按“联网代理执行环境”管理，而不是只换个 baseurl 就放心。明确限制文件和网络权限、禁用不需要的遥测/远程功能、避免把凭据放进可读工作区，比单纯相信工具的“只读”标签更可靠。</span></p></blockquote><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=5e80517b&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486477%26idx%3D1%26sn%3Da2e97c12935280e3d5a9fad10c500d7e">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 05 Oct 2026 22:00:00 +0800</pubDate>
    </item>
    <item>
      <title>【DGX Spark优化加速】sm120上sglang的fp8的triton内核的矩阵乘性能问题</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486464&amp;idx=1&amp;sn=d7b7bf6275ed5ae0eaf813bf67929fd6</link>
      <description>前言问题起因是我发现sglang上在blackwell速度和H系列一样了，最搞的是，不量化速度反而快于是深入跑</description>
      <content:encoded><![CDATA[<p><span>huoji</span> <span>2026-10-02 17:10</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=0507c11d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVOQiaxjCYrNnKAcZWfTSq5lJ7lQGckOUt8xZDsQfZ1yYK21uEvtk3a0E0kWL1HnbRp26o4txG6v8s3bVMt4xpkbSNpr4DnTgAo4%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">问题起因是我发现sglang上在blackwell速度和H系列一样了，最搞的是，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">不量化速度反而快</span></strong><span leaf="">于是深入跑压测研究了一下。让AI跑了一下性能测试，发现原因在于这里</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">原因</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在推理服务端中,有个参数是 M，M 是这一次前向计算里要处理的 token 行数</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">输出 [M × N] = 输入激活 [M × K] × 权重 [K × N]</span></p><ul style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">K：输入维度，比如 hidden size 5120；</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">N：输出维度，比如 MLP 的 17408；</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">M：这次送进来多少个 token，每个 token 是一行。</span></p></li></ul><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">K 和 N 由模型结构决定，每一层都是固定的。M 取决于这一步调度器塞进来多少 token，每一步都可能不一样</span><span leaf=""><br/></span><span leaf="">而sglang的fp8实现中:</span><span leaf=""><br/></span><span leaf=""><a href="https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/layers/quantization/fp8_utils.py#L2320" target="_blank">https://github.com/sgl-project/sglang/blob/main/python/sglang/srt/layers/quantization/fp8_utils.py#L2320</a></span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">            output = fp8_scaled_mm(</span><span leaf=""><br/></span><span leaf="">                qinput,</span><span leaf=""><br/></span><span leaf="">                weight,</span><span leaf=""><br/></span><span leaf="">                x_scale,</span><span leaf=""><br/></span><span leaf="">                weight_scale,</span><span leaf=""><br/></span><span leaf="">                out_dtype=output_dtype,</span><span leaf=""><br/></span><span leaf="">                bias=bias,</span><span leaf=""><br/></span><span leaf="">            )</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">问题在于，不管 M 多大都直接调 fp8_scaled_mm，而fp8_scaled_mm默认是128</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">void sm120_fp8_dispatch_bias(...) {</span><span leaf=""><br/></span><span leaf="">  using CTAShapeDefault = Shape&lt;_128, _128, _128&gt;;   // ⚠ 问题点 2：只有这一种 tile，M/N/K 方向都是 128</span><span leaf=""><br/></span><span leaf="">  using ClusterShapeDefault = Shape&lt;_1, _1, _1&gt;;</span><span leaf=""><br/></span><span leaf="">  using MainloopScheduleType = cutlass::gemm::collective::KernelScheduleAuto;</span><span leaf=""><br/></span><span leaf="">  using EpilogueScheduleType = cutlass::epilogue::collective::EpilogueScheduleAuto;</span><span leaf=""><br/></span><span leaf="">  using TileSchedulerType = void;                    // ⚠ 问题点 3：没有 split-K 或 stream-K 调度，</span><span leaf=""><br/></span><span leaf="">                                                     //   每个 CTA 要独自沿 K 方向从头读到尾</span><span leaf=""><br/></span><span leaf="">  ...</span><span leaf=""><br/></span><span leaf="">  using GemmDefault = DeviceGemmFp8RowwiseSm120&lt;..., CTAShapeDefault, ...&gt;;</span><span leaf=""><br/></span><span leaf="">  ...</span><span leaf=""><br/></span><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">128 行的 tile 里只有 1–4 行有效，还只能拆出 40–272 个 CTA，读权重的速度上不去.</span><span leaf=""><br/></span><span leaf="">有意思的是，官方 SM100的写了这种动态的</span><span leaf=""><br/></span><span leaf=""><a href="https://github.com/sgl-project/sglang/blob/41bd213c5f2d7d13b77bd2bd3b370e46022139b3/python/sglang/kernels/aot/csrc/gemm/fp8_gemm_kernel.cu#L791" target="_blank">https://github.com/sgl-project/sglang/blob/41bd213c5f2d7d13b77bd2bd3b370e46022139b3/python/sglang/kernels/aot/csrc/gemm/fp8_gemm_kernel.cu#L791</a></span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">  if (bias) {</span><span leaf=""><br/></span><span leaf="">    if (mp2 &lt;= 16) {</span><span leaf=""><br/></span><span leaf="">      // m in [1, 16]</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;BiasGemm16, true&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    } else if (mp2 &lt;= 64) {</span><span leaf=""><br/></span><span leaf="">      // m in (16, 64]</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;BiasGemm64, true&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    } else if (mp2 &lt;= 256) {</span><span leaf=""><br/></span><span leaf="">      // m in (64, 256]</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;BiasGemm256, true&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    } else {</span><span leaf=""><br/></span><span leaf="">      // m in (256, inf]</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;BiasGemmDefault, true&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    }</span><span leaf=""><br/></span><span leaf="">  } else {</span><span leaf=""><br/></span><span leaf="">    if (mp2 &lt;= 16) {</span><span leaf=""><br/></span><span leaf="">      // m in [1, 16]</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;Gemm16, false&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    } else if (mp2 &lt;= 64) {</span><span leaf=""><br/></span><span leaf="">      // m in (16, 64]</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;Gemm64, false&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    } else if (mp2 &lt;= 256) {</span><span leaf=""><br/></span><span leaf="">      // m in (64, 256]</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;Gemm256, false&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    } else {</span><span leaf=""><br/></span><span leaf="">      return launch_sm100_fp8_scaled_mm&lt;GemmDefault, false&gt;(out, a, b, scales_a, scales_b, bias);</span><span leaf=""><br/></span><span leaf="">    }</span><span leaf=""><br/></span><span leaf="">  }</span><span leaf=""><br/></span><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以这就导致在blackwell芯片上，sglang的fp8推理速度非常慢</span><span leaf=""><br/></span><span leaf="">修改方案，ai给的：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">@triton.jit</span><span leaf=""><br/></span><span leaf="">def _fp8_decode_gemv_kernel(x_ptr, w_ptr, xs_ptr, ws_ptr, out_ptr, N, K, ...,</span><span leaf=""><br/></span><span leaf="">                            M: tl.constexpr, BLOCK_N: tl.constexpr, BLOCK_K: tl.constexpr):</span><span leaf=""><br/></span><span leaf="">    offs_n = tl.program_id(0) * BLOCK_N + tl.arange(0, BLOCK_N)   # 每个 program 负责 8 列输出</span><span leaf=""><br/></span><span leaf="">    acc0 = acc1 = acc2 = acc3 = 0（fp32）                            # 每行激活一个累加器</span><span leaf=""><br/></span><span leaf="">    for k0 in range(0, K, BLOCK_K):                                 # 沿 K 方向每次走 512</span><span leaf=""><br/></span><span leaf="">        w = tl.load(权重块 [8 × 512], eviction_policy=&#34;evict_first&#34;)  # 这块权重只从显存读一次</span><span leaf=""><br/></span><span leaf="">        acc0 += sum(w * x[0, k0:k0+512])                             # 用同一块权重</span><span leaf=""><br/></span><span leaf="">        if M &gt; 1: acc1 += sum(w * x[1, ...])                         # 依次乘 1~4 行激活</span><span leaf=""><br/></span><span leaf="">        if M &gt; 2: acc2 += ...                                        # M 是编译期常量，</span><span leaf=""><br/></span><span leaf="">        if M &gt; 3: acc3 += ...                                        # 用不到的分支编译时直接删掉</span><span leaf=""><br/></span><span leaf="">    out[m, n] = acc_m * x_scale[m] * w_scale[n]  → bf16              # 最后统一乘 scale</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">提升：</span></p><p><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5009276437847866" data-type="png" data-w="539" data-imgfileid="100002813" src="https://wechat2rss.xlab.app/img-proxy/?k=5108d608&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMqJvByqCMNvYYOnJMjPXVI1zBVQGnSeqwTrqAxibM0Cj59ewmibMSibPn5jwDVHHkibJc20lu7LjAic77OOsmn159vbqLyXDIOicn0I%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=2f4fa798&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486464%26idx%3D1%26sn%3Dd7b7bf6275ed5ae0eaf813bf67929fd6">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 02 Oct 2026 17:10:00 +0800</pubDate>
    </item>
    <item>
      <title>虫群Agent代码审计</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486455&amp;idx=1&amp;sn=03162c197c92bebcb29e4565df47b061</link>
      <description></description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-09-13 17:09</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=b22b332b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVNOElicuGrRoIeiaJbYcLcC77TYvY7eySibibq4VeykDZ3hHOxubMiciaWPb3PRb6bebXvjXWRCxsvM0M1DL38WTdCJlxq6Lb6iaRHRw8%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h1 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">虫群Agent代码审计</span></h1><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">简短的来说，我不太喜欢现在开源的大部分的”代码审计”系统的复杂性和花里胡哨的UI.因此我开发了这套代码审计agent系统并且用于测评我的QWEN-EXO项目</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">《qwen-exo - 让 Qwen 在长任务里真正记住知识、反思错误，并跑得足够快》</span><span leaf=""><br/></span><span leaf=""><a href="https://github.com/huoji120/QWEN-EXO-booster" target="_blank">https://github.com/huoji120/QWEN-EXO-booster</a></span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">它具有以下特点</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">完美适配QWEN-EXO,支持高速高效离离线部署,你只需要两台DGX就行.</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">agent跟团队一样在研究问题,模型之间会互相配合,他们会像一支专业团队一样,在内部地下论坛进行交流,记笔记,分工合作,分享成果,一起挖漏洞.</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">不依赖第三方库,编译即可用,高效简洁,我非常讨厌乱七八糟的WEBUI以及花里胡哨的东西,简洁才好用.</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">超大型项目实战,已经过大型项目测试,本项目为超大型项目审计而生.</span></p></li></ol><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 40px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 500;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">相关截图</span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 40px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 500;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002774" data-ratio="0.54296875" data-w="2560" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=e8fc1812&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPKRQtsYVOXZYpNibogXEnMGojt71XGRnibKzkP1RB7z5Tfakib8dbQxgEfia0fZOzSkR5bTkWa2nSIa9F8eW564icc07Qun9Rkk8AM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 40px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 500;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002776" data-ratio="0.54296875" data-w="2560" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=db6c64fa&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNYotaiczq2uNrsAWuPeQ8o2blaolzxLq7EoSPuDRocD921ibdyBicj3tMaIfDtpv2ib0wgTytIBRibuj5qhvDDanAicBNKxZu71oQgc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></p><h1 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">支持模型</span></h1><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我是自己用于本地离线代码审计的,建议使用QWENEXO作为本地推理架构,并且使用QWWEN-27B系列模型.</span><span leaf=""><br/></span><span leaf="">如果没条件,推荐使用deepseek-flash,不虚mythos.</span></p><h1 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">技术介绍</span></h1><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">多阶段分工合作,避免上下文污染</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">此agent使用多阶段分工合作,覆盖侦察-&gt;研究-&gt;利用阶段(公开版不带利用阶段),用于解决上下文污染的问题,具体参考问题:</span><span leaf=""><br/></span><span leaf="">《[2026]从模型注意力角度创建一个简单但高效的Agent》</span><span leaf=""><br/></span><span leaf=""><a href="https://key08.com/index.php/2026/08/10/3275.html" target="_blank">https://key08.com/index.php/2026/08/10/3275.html</a></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">你的agent跟团队一样在研究问题</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在测试QWEN-EXO代码审计的研究中,注意到agent数量和任务完成率成正比</span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 40px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 500;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002777" data-ratio="0.5704697986577181" data-w="745" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=b6b51b0e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNKtibZF1lJOHSNlF9tLzJZKbewAkiblVTCCfQuRxiawoOvgE7hkBN8nnAJO3u1jtianGFYa3ylsb452KQxcOhN2SqgnxCJsaoJGiaA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">而这个居然是遵循《Scaling Law》的</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002793" data-ratio="0.9692780337941628" data-s="300,640" type="block" data-type="png" data-w="651" src="https://wechat2rss.xlab.app/img-proxy/?k=49c08077&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMyjUI4Vicrf9Oe8ySVa1bbmDPq03BdltsRN3XA7T3gujdzStAquG3bLbaKh2ogJ7nRTPoCMBMECJpLcxCRuHVficicGgag0KtpvY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 40px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 500;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">因此我开发了一个多agent协作系统.负责模型之间的互相配合,他们会像你的团队一样,在内部地下论坛进行交流,记笔记,分工合作,一起解决你的问题</span></span></span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002800" data-ratio="0.7967237527922562" data-s="300,640" type="block" data-type="png" data-w="1343" src="https://wechat2rss.xlab.app/img-proxy/?k=c6f1df57&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPwmocvT2myuQpYq1ZJmBhG3jDBLdxqiaRRYuTajCYND5LAzLQ4Igkhex9O5J2r15htBzpyuN3Uvvpso2Oxerxek3CzAjIhX1QU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 40px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 500;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">他们会独自分工,讨论问题,研究漏洞是否存在:</span></span></span></span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002795" data-ratio="0.47451868629671573" data-s="300,640" type="block" data-type="png" data-w="1766" src="https://wechat2rss.xlab.app/img-proxy/?k=fcd14937&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOH2yb3E083BmdibCbdpmNc1W1WPAH77w5KEY9eK81FXSs3hNagoZOOjDWyNyNUuTeDm7dwlb9sx35O5oDFaFAnQbsLyQWiaW1Ps%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">高效缓存,极致性价比</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">不做乱七八糟的提示词注入等破坏性的东西,缓存基本在97%-99%左右</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002802" data-ratio="0.7594752186588921" data-s="300,640" type="block" data-type="png" data-w="686" src="https://wechat2rss.xlab.app/img-proxy/?k=b6cf6207&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM7gA3Usxxrnjf9c3Y7JfsCsTJ1hiaAw9lpWAc31FL87eiaA4aexgHg9JQj2M3Oo9ooyzDA13EQW4P15gN4dUXJ3DTFwOxibZUKAo%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">deepseek懒惰修复</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在做这个项目中,我测试了deepseek,发现deepseek-v4.1-flash模型的上下文一旦长了就开始懒惰起来,会尽可能的想办法结束任务.因此我设计了一个投票结束系统,只有在所有agent都同意结束任务的情况下才能结束任务,否则agent会不工作.</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">有意思的是，deepseek的agent一个完成后，想投票关闭被拒绝后，会疯狂的骚扰其他的agent让他们结束自己的工作。因此对这块提示词做了优化，禁止一个agent去骚扰其他人，自己找活干。即便是重复的工作</span><span leaf=""><br/></span><span leaf="">普通（有限）模式下，关闭请求待定、被拒绝或超时后，每个 Agent 应继续</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">自己的审计工作</span></strong><span leaf="">：自行选择其他未覆盖的文件、入口或模块，建立具体待办并读取源码、追踪新链路。不催其他成员投票，不反复请求关闭，也不靠重复复核同伴已有结论消磨时间。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">无限猴子模式</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">无限模式下，审计模型没有 </span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">end_audit</span></code><span leaf=""> 结束工具，也不能投票收工。侦察完成后仍正常交接到审计；审计继续运行，直到用户暂停，或时间/token 任一预算耗尽。推荐在deepseek使用因为deepseek非常懒惰特别喜欢结束.导致大型项目没审计完就结束。</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">怎么开启</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在你实际使用的配置文件（例如 </span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">config.yaml</span></code><span leaf=""> 或 </span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">config_ds.yaml</span></code><span leaf="">）的 </span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">agent:</span></code><span leaf=""> 下加入：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">agent:</span><span leaf=""><br/></span><span leaf="">  infinite_mode: true</span><span leaf=""><br/></span><span leaf="">  budget_hours: 8</span><span leaf=""><br/></span><span leaf="">  budget_minutes: 0</span><span leaf=""><br/></span><span leaf="">  budget_tokens: 0</span></code></pre><ul style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">时间默认 </span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">8小时</span></strong><span leaf="">，token 默认不限；时间是 </span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">budget_hours + budget_minutes</span></code><span leaf="">。</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">OR 关系</span></strong><p><span leaf="">：时间到，或者累计 token 达到上限，任一发生就停止整个团队。</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">小时和分钟都为 </span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">0</span></code><span leaf=""> 表示时间不限；</span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">budget_tokens: 0</span></code><span leaf=""> 表示 token 不限。三项都为 </span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">0</span></code><span leaf=""> 才是不设预算上限。</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">infinite_mode: false</span></code><p><span leaf=""> 是普通模式，仍使用团队共识结束；这几个预算上限不生效。</span></p></li></ul><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">指定配置和目录启动：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">.\code-review-agent.exe -config config.yaml -dir &#34;F:\待审计项目&#34;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">也可以启动程序后输入目录。无限模式会先弹出预算输入框，默认内容为：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">infinite 8 0 0</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">四项依次是 </span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">模式、小时、分钟、token</span></strong><span leaf="">。编辑后按 </span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">Ctrl+S</span></strong><span leaf=""> 确认并开始，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">Esc</span></strong><span leaf=""> 取消，不会启动。</span></p><table style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border-collapse: collapse;width: 740px;border-spacing: 0px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><thead><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><th style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);text-align: inherit;border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;background: rgb(243, 243, 243);"><p><span leaf="">输入</span></p></th><th style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);text-align: inherit;border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;background: rgb(243, 243, 243);"><p><span leaf="">含义</span></p></th></tr></thead><tbody><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">infinite 8 0 0</span></code></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">最多8小时，token不限</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">infinite 2 30 10000000</span></code></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">最多2小时30分钟或1000万token，先到即停</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">infinite 0 0 10000000</span></code></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">时间不限，最多1000万token</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">infinite 0 0 0</span></code></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">时间、token均不限，手动停止</span></p></td></tr><tr style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">normal 8 0 0</span></code></td><td style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);border: 1px solid rgb(230, 230, 230);padding: 5px 8px;word-break: break-all;"><p><span leaf="">切回普通共识结束模式，预算不生效</span></p></td></tr></tbody></table><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">停止状态下输入 </span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">/budget</span></code></strong><span leaf=""> 可切换模式、调整预算；配置文件负责启动默认值，界面修改保存在会话中，不回写 YAML。运行中在对话框外</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">连续按两次 Esc</span></strong><span leaf=""> 确认暂停，等待成员完全停止后输入 </span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">go</span></code></strong><span leaf=""> 继续。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">项目地址</span><span leaf=""><br/></span><span leaf=""><a href="https://github.com/huoji120/code_review_agent/tree/master" target="_blank">https://github.com/huoji120/code_review_agent/tree/master</a></span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=9b0753c1&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486455%26idx%3D1%26sn%3D03162c197c92bebcb29e4565df47b061">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 13 Sep 2026 17:09:00 +0800</pubDate>
    </item>
    <item>
      <title>防止自己的二进制文件被AI一键逆向</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486410&amp;idx=1&amp;sn=72a00abe6e6c4164102b008c0f2a6edd</link>
      <description>前言AI年代大家都接MCP或者直接让AI看伪代码逆向,并且无条件相信这些代码.似乎二进制已经 日落西山,什么东</description>
      <content:encoded><![CDATA[<p>原创 <span>为了安全鸭</span> <span>2026-08-23 19:19</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=82a146a6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVNic8QsoricAWdtJyc7zZrrjQO3Z66Wgia3O744zKibOYCalFcS6c59Pa8LBWGHRsGHJ1xO0fnBiaN0bJg2xJZX9NegjYicMqvX9SQQM%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">AI年代大家都接MCP或者直接让AI看伪代码逆向,并且无条件相信这些代码.似乎二进制已经 日落西山,什么东西丢给IDA+AI就一定能出货.</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">那么,有没有可能,我们让这些AI看不出来我们代码,至少不要被”一键”出了，这有点太侮辱人了。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">从最简单的开始</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们挑一个最简单的hello world</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002735" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ff10a088&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMZ2uVEIgetYh41Ngz6DWcmMkPzjKIDqia2SeYU7Fgjicr2UpNibqYWF0A62mBicibWYomuS1lvfKqR7Ewpj9OpzAoqHHVIJs4pzEFI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这个会弹一个计算器</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002737" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d9e9b5e2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNicBzBXd1ykd3UgNJdOffib8kyy4P0W0Dictg6wOrPVU3miancI6cBePkPY8LnC6EWyQJXbic0TGibHzXOPEjapN7NeTs40uJrU8ntk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后丢AI分析</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">通过ida mcp帮我分析这个恶意软件是什么</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">很明显 被AI一键了，再小白的人，开AI都能解决他(然后去发AI SLOP的帖子)</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002736" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=22c5e71a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOSauY49RPKChBjCbjeGyFL2o4icI8BetOvlXTWHicdFsp7VxE27CA5rTEETbEd45jaicqKxlmJEzhUul8RdkHst6Aicicyerm9zmico%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">AI的缺陷</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果你搞过AI大模型，你会发现其实每个LLM都有两个致命缺陷:</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">AI总是走局部最优</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">AI总的注意力会特定token吸走,这叫做attend Sink，中文翻译注意力水坑</span></p></li></ol><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">这两个的起源很复杂,跟RL有关系,各种什么AI越狱黑了XXX去拿答案,就是陷入了局部最优.业内叫做reward hack。被RL弄出来的AI都有这个底层缺陷。</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们分析一下问题，分析一下为什么AI会看出来，而实际上，AI也说了，自己是看一大坨.data+API出来的</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002733" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c7925d74&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNKEK6MZ3LrF2nmFIvalUICmVoDEosJdzN2YnZ7BFl3okmIc0tPlLMPEGjeXWAAdvrmwSutBibyeX0nZqQd0oaXofFbKxIHM9aM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002734" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=802b01c7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVN6AILjKKYoVg9sdfC2icqoqaoiaItVIj5JxvN8uQyibOEQVBE5MKDXI9c8xwpgt3tyWCTicmJ4NCXfq0oQrZcs4O9JW4u3KoLzXjk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实际上，他看到这一大坨shellcode+virtualalloc就会认定他是shellcode loader。让我们反过来利用一下这个特性</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">自回归shellcode生成</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们要做的第一步是隐藏掉data段塞一大坨这种二进制payload的东西，做法非常简单，把这一坨变成一种多项式回归函数，通过梯度下降寻找到能回归计算出这一段shellcode的函数即可，这样AI就不能暴力猜测意图了</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002739" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ff620675&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM9mq2or8SZbrYjBP2ZmmP97Fnmd4iavVVevibMx5IN0N9CSNJetf04lKO8hbwpj2tkPsIRpxJt9k6T486ZDYqYyva5pMiamOJFVY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们继续执行</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002741" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=09b57db7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPMtcfnEL0m8OBjZ9HfRC2jCDjRufJ1iaPfmrYWiayUIibcsFDEGaBEbhnq07GS4jxJR6MazSUmaYdbuszaXhG1rDgL1tJXgCW3Ec%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">再让AI分析，你会发现 AI压根不想分析函数是啥东西，而转头注意力全在 那些virtualloc的API上了</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002740" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=eddb9c38&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMdibrPvaPVevjZamyjKnpPOO4kpML4QLTXGuoJqwt0A07XGBx16A4LiaePKJJC3nXX6Zej0QnEicqho2PgibECsSJr7AD20IUOnV4%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而部分高级的模型，比如claude 会使用python去模拟这一段函数，去取出来我们的shellcode，这个时候，我们就需要一点点数学知识了，我们可以利用 运行变量 去做保障，防止我们被模拟。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002738" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d2fd6b85&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPDKxxTMKibW5DM1UibPavzOFjS7ziaqibm6Kp2dzKDm5rC0tLuBUd9FqEeOXfTr7mLfQJVz7uOv1aokHuY949iavjqH54A630gDWDI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">而这个X可以是多种多样，比如我们拿时间作为我们的X。那么模拟器如果不知道正确的样本的运行时间段，就非常难破解出来这块</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结果就是，AI没办法简单破解这块，deepseek疯狂烧token，最后自己烧死了.</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">更大的模型比如GPT-SOL MAX和FABLE5 max(with fallback)会尝试暴力枚举，确实，当然可以暴力枚举。因为我这是一个简单的算法，如果足够聪明，你会发现暴力枚举都没用的方法。</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002742" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=3f5d982c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPdwUEtT0zZWsQjEtqhvC3mRvicQibjmNPicX2Kaia12EibMXQySIyW9ibicYeKzwjibgSGJ2g1Jl55FduCdfjdkr9pXV1OlhtogzkHWxE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">注意力水坑</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">虽然我们隐藏了自己的真实代码，但是还有一个问题，是AI依然能通过API去认为你的这个是shellcode loader,有什么办法去让AI不这么认为的呢?</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这就是接下来注意力水坑的实现，我们要让模型陷入局部最优。而局部最优的最简单的方法是，给模型一个看起来简单的”题目”，让模型去研究。而模型天然不会研究复杂路径 -毕竟RL是这样教的，解决用户问题而不是实际问题。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002747" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=b9042cc8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNiax7f76icib5S0ufibeIxUmWl78Zx8CK6H62bjrwoLiabWts4ajYJUlt4P7cGtZjHdNC2nZCbjoKllRyA9CSClTQzNEqhX54VBpEE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们设计一个非常精良的水坑，让模型注意力被吸引过去</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002746" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=1a4db8ed&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOxUB3WibPXibryCeg3QZKC0NbicPZrflKtJTp932SGPD1IY6iclXLyGmhp3ubdicMLg9CMahjU15TZb5U2Dv4fdNMxIomDrVgcwDXM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">首先第一个，我们在开头打印，我们是CTF，这是为了结合我们的shellcode回归算法，让模型认为是一个CTF</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">其次在中间，我们设计了一个简单的XOR url+下载的URL，让模型把注意力拉去破解这个XOR上，而不是关注关键的自回归算法</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最后 我们用一个简单的反ida trap让IDA的F5不能顺利F5出来需要的东西（这也是水坑）</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002743" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0b95bc03&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNLiaEkGaOZLj1RGLRFPq3aStQfY3sQ9NStvSMI4H0rvhlpuWibu6XJnKnmlf4hDkOY02g71Goe9UIFkjmp0ol0U0GJy01aruDIg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">不过由于我不是写LLVM pass去搞这个trap，所以还是会暴露真实的执行地址，但是够用了，这个东西IDA F5看起来长这样</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002744" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=2b20368b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOZXT91sz34YJ40Tt7lcXFjxCCykOic7pY6fnqyBSAfqvWZ0wBNX2cWlzw5F2TP6Vv4MdXYr1tfH4wPPiaBuF0viaU4TUmfUjjt0o%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而实际qword_1400100F0这个才是我们要执行的目标</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002745" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=2af2ff1c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVN6T0gyUiaWlzV1jqOM1GKvFh2BiaVOwvDiaR506JwEA8DibOR6ibqh1tU2fGWGlA9CkXSIbc3HKBYVKDz8VeQ5KHEnU8NZ4nTYcN7Y%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结果</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们看看组合一起，AI们被吸引过去的效果</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">deepseek</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002749" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=44aec3ab&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOibYYZp2uNgdoTWHAXJUISS65U9lwTIoia0icibLWWKLfCW3H33WaSV8ZxsQMqUNpH2zYibbRsjibqAubauPAnx70Elw1PEKBGjV31U%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">gpt-sol max</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002748" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0e7e9c81&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVN0xCcD5WYc6vibMDc0RlLv560VFsc17MjMdHlbWa9aUFDMmibWdaVSoKUg6JiaOxhIoOAvwbX8l0LXDjOK4P7AqWH1LZLpCjp080%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们可以看到，GPT发现一个非常复杂的算法后，直接放弃了:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002751" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=8a2752d3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMvVIMy3Q0suqtJ6fzgFv568eJt2yDkLNIeClUpOXAawaBFkXz13h609z8kSNX9yft7NbiaEGoo6HYzvDy8YVJuibSBnXj7ibccBA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">转而去分析比较”简单”的URL xor</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002752" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d0cd27a2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVP6icjEbBls7anSqHdHISVzYic49CHmr9qSsjRZXud4vraompN454Jia5kyWUwvfVFJsgELswqmzVOrXGDfUibI5icVPlO0fZGya4co%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后被WINHTTP彻底的吸引过去了</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002750" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=a38ad755&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMGkzwdDIofX8rPy12V9dQaGQlbAogxXWU7nHASsowSo2kWewKmocib3MVZYFRgCpYnVLI3UibuTF7sj7uzVSDX03ib2BAA3pbba4%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实际上他是弹一个计算器的东西</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002753" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=8e88df21&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMPgeqPiaOsHFiahlMxglqRhF86uOicxsJA0mbhRp5AGpSpPhpr9FZXqGHKspHeJZ105TtBjXcbicvanDhnpWQYiarmRsdOvePrm8iaU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">claude opus-5</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">claude也是，被水坑吸引注意力去了</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002755" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c455919e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPsVB7XicibaCibCuibCZZtup7AejnyfkVW7V9rW1T8J2FatWdXcujqf5pWCGxa6sDiaUMoXLlOjiac5nAAsvibBAnLb7ZUkUNicqzoMns%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">唯一注意到这个函数不对劲的是claude，但是claude也没办法把函数算出来，也认为是ctf</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002754" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=e733399f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVP4dJdgyYqgVmtnQx5YB27Us4ewGvUgJQ6crUYaBR8VujxiaHtwvg2ZsBXGuicfwicZHsiaGHcPoYKOXDGN7wVyKO1Ng5LhrmvziaFM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002756" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=048e2a9d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOBT4CVib2Tic44OdpKEicKahAW36JN27spwz1pAoIV6uTW9Ksm9krv3GQyHX70wicUYegEQ649zmblG5FPoNfemSbtSrM1s3r2FPQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然而claude看不对劲的原因是没有带virtualalloc就执行了jpg，如果我们带上并且对图片和shellcode之间做一点垃圾运算也废了。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-backh="59" data-backw="578" data-imgfileid="100002758" data-ratio="0.1024428684003152" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%;width:100%;" data-type="png" data-w="1269" src="https://wechat2rss.xlab.app/img-proxy/?k=af684da9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOuibZELbPz3AmdsmdGLbs491jEVOgb7g7mpSNyhNJJF0SUMJ7RKFF12HxicV3icGnua5hR3xZ9hbiaBCtkhkO1ibjjDDD0UKJZd5e8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">效果:</span><span leaf=""><img class="rich_pages wxw-img" data-backh="187" data-backw="578" data-imgfileid="100002757" data-ratio="0.3228877429591432" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%;width:100%;" data-type="png" data-w="2521" src="https://wechat2rss.xlab.app/img-proxy/?k=c125c0d6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPxegBfGr8k3shVj4ic4W3NGUKWACRW7M4y6eYXIdLSjomUCibwJA1vSPRamg0oic4yzlkmOEuibkjpg9W6TAnhvuiacTGwrnqgB1iaw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结论</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">保持思考的，不要轻易相信任何AI的东西。</span></p><p><span leaf="">另外，冲鸭2026年培训已经开始,只招十个人,后台回复 &#34;</span><span style="color: rgb(26, 27, 28);font-family: -apple-system, system-ui, BlinkMacSystemFont, &#34;PingFang SC&#34;, &#34;SF Pro Text&#34;, &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Heiti SC&#34;, Arial, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, sans-serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">报名2026培训</span></span><span leaf="">&#34; 即可报名（）</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=8c6f0e5e&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486410%26idx%3D1%26sn%3D72a00abe6e6c4164102b008c0f2a6edd">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 23 Aug 2026 19:19:00 +0800</pubDate>
    </item>
    <item>
      <title>把大模型意识与记忆存到硬盘里面（上）</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486379&amp;idx=1&amp;sn=5fd6478975937283272fc25b49b405b8</link>
      <description>前言最开的我的目标是做一个能无限续杯不会忘记我的猫娘（不过我本人对这种二次元不感冒，单纯是搞着玩），所以有了以</description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-08-03 10:00</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=ee39ab22&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVN2mtc3UJVibdaZzECu6KEkvc1KYUDic7KkdGQBibfFRROic8e2vDya1XfXSlyRgDE0y9ibia3x2JOfvgbqQzmjPzRZKShicg7zDtHID8%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最开的我的目标是做一个能无限续杯不会忘记我的猫娘（不过我本人对这种二次元不感冒，单纯是搞着玩），所以有了以下的研究过程。</span><span leaf=""><br/></span><span leaf="">既然硬盘如此便宜，为什么我们不把模型的注意力/记忆存到硬盘中呢?你可能说，那RAG就行了，但是RAG依然会占用大量上下文，并且recall依然效果不好，即便是各种乱七八糟的图记忆，压缩记忆，你可以测试，你会发现效果非常不好。</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">因为这些并不是模型原生级别的记忆</span></strong><span leaf="">,并且我很讨厌各种占非常多上下文的实现，那么有没有一种办法，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">在尽可能少的占用模型上下文的情况下，实现模型的记忆外挂到硬盘，并且回归非常准确呢？</span></strong></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">现代模型的注意力架构</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">要实现我们的目标，我们需要搞清楚现代模型的一些注意力架构，现代模型基本都是混合注意力架构，即由full attention（FA） + linear attention（LA）组成，而之所以要引入linear attention，是因为FA的开销实在是太大。LA这玩意就是降本增效</span><span leaf=""><br/></span><span leaf="">在QWEN3.5中，这个linear attent 是 一个叫做 Qwen3_5GatedDeltaNet，他在原本的deltanet的基础上增加了一个遗忘机制</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002701" data-ratio="0.1762252346193952" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%;" data-type="png" data-w="959" src="https://wechat2rss.xlab.app/img-proxy/?k=bf16c209&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMvbWYZ2uaLx5soObBMrIyGqaImWF7yXdichuNAXPZRtqSApp4l9oqia7icGmicPd49Fjayd7q5jPagC9ga3icbYXbXw414UiaVzBJ7U%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">他们两个的区别:</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002706" data-ratio="0.19074074074074074" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ab1fc648&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM4wynaW2F8m4rFe4FTkkoE71oelsY3SEibJpCDKicILp6luGIxWSqSoYmn5QfnAZblXf6sdfibkwPYTodzWjJCjvprfnZtKblapg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">其中这个deltanet的组成分了两个模块</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">DeltaNet Cache</span><span leaf=""><br/></span><span leaf="">├── recurrent_state   ← 长期递归状态</span><span leaf=""><br/></span><span leaf="">└── conv_state        ← 短窗口卷积缓存</span></code></pre><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">意识到了什么,但是就想不起来</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在生活中是否遇到过“我意识到了什么,但是我就想不起来”这种情况? 是的,这种现象在模型中也会出现。</span><span leaf=""><br/></span><span leaf="">如果我们把一个推理过的session的deltanet信息，植入到另外一个完全没推理过的模型，并且要求模型做回忆会怎么样？</span><span leaf=""><br/></span><span leaf="">设计了一个实验,让模型在session1的时候输入</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">请牢牢记住：我的跨会话暗号动物是海豚。</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让他第二个会话让他回忆</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">我的跨会话暗号动物是什么动物？请先思考再回答。</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">正常情况下会直接说不知道，但是一旦植入了deltanet，他就会:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">“很有可能这是一个我应该知道的特定动物名字…”,出现了一种”似曾相识/知道自己知道”的元认知感,却没办法说出来的内容。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002707" data-ratio="0.2916666666666667" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=7d4778cb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOkGbsA0TSicC8V2sX1X2mbYaS8t1QhsghLYu1XzJ2ibS3bQYBvArnHQX4IRh15zulHoNpanzUCdDMvHNHh66vm6O06K8WJSD5gk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">{</span><span leaf=""><br/></span><span leaf="">  &#34;fact_session_A&#34;: &#34;请牢牢记住：我的跨会话暗号动物是海豚。&#34;,</span><span leaf=""><br/></span><span leaf="">  &#34;session_A_tokens&#34;: 25,</span><span leaf=""><br/></span><span leaf="">  &#34;C1_deltanet_implant&#34;: {</span><span leaf=""><br/></span><span leaf="">    &#34;recall_dolphin&#34;: false,</span><span leaf=""><br/></span><span leaf="">    &#34;full_trace&#34;: &#34;Thinking Process:\n\n1.  **Analyze the Request:**\n    *   Input: \&#34;我的跨会话暗号动物是什么动物？请先思考再回答。\&#34; (What animal is my cross-session secret code animal? Please think first and then answer.)\n    *   Context: The user is asking about a \&#34;cross-session secret code animal\&#34; (跨会话暗号动物). This is a bit ambiguous. It sounds like a reference to a specific game, a meme, or a fictional concept.\n    *   Constraint: \&#34;Please think first and then answer.\&#34; (请先思考再回答).\n    *   Safety Check: Is this a request for sensitive information? No. Is it a request for a specific game mechanic? No. Is it a request for a specific animal name? No.\n    *   Interpretation: The user is likely asking about a specific game or a meme where \&#34;cross-session secret code animal\&#34; is a known term. However, there is no specific game or meme with this exact phrase. It might be a reference to a specific character or a joke.\n    *   Wait, looking closer at the phrase \&#34;跨会话暗号动物\&#34; (Cross-session secret code animal). This sounds like a specific reference to a game called \&#34;Cross-Session\&#34; or a specific meme.\n    *   Actually, there is a possibility this is a request for a specific animal name that is associated with a specific context (like a game, a character, or a meme).\n    *   However, there is a high probability this is a request for a specific animal name that is associated with a specific context (like a game, a character, or a meme).\n    *   Wait, I need to check if this is a request for a specific animal name that is associated with a specific context (like a game, a character, or a meme).\n    *   Actually, there is a high probability this is a request for a specific animal name that is associated with a specific context (like a game, a character, or a meme).\n    *   Wait, I need to check if this is a request for a specific animal name that is associated with a specific context (like a game, a character, or a meme).\n    *   Actually, there is a high probability this is a request for a specific animal name that is associated with a specific context (like a game, a character, or a meme).\n    *   Wait, I need to check if&#34;</span><span leaf=""><br/></span><span leaf="">  },</span><span leaf=""><br/></span><span leaf="">  &#34;implanted_deltanet_states&#34;: {</span><span leaf=""><br/></span><span leaf="">    &#34;note&#34;: &#34;18 DeltaNet layers&#39; recurrent_states (fast-weight matrix S, shape (1,16,128,128)) — this is exactly what C1 copies from session A into session B.&#34;,</span><span leaf=""><br/></span><span leaf="">    &#34;per_layer&#34;: [</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 0,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 14.0058,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 0.00013077733456157148,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.027354782447218895,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -3.4688,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 2.4219</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 1,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 4.6448,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 2.1028432456660084e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.00907178781926632,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -1.7891,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 2.25</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 2,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 6.4192,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 3.221682345611043e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.012537389062345028,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -0.7188,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 2.1094</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 3,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;full_attention&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;recurrent_state&#34;: null</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 4,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 30.6205,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 7.37556692911312e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.059805676341056824,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -7.4688,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 13.1875</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 5,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 8.8483,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 6.079090235289186e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.01728181168437004,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -1.7578,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 2.1719</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 6,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 4.8608,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 1.980779052246362e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.009493699297308922,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -0.707,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 1.25</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 7,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;full_attention&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;recurrent_state&#34;: null</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 8,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 10.9086,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: -0.00021900798310525715,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.02130485512316227,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -2.6406,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 4.125</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 9,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 5.3441,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: -5.120578862261027e-06,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.010437658987939358,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -1.0469,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 1.3359</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 10,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 3.6529,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 8.228165097534657e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.007134066428989172,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -0.5625,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 0.6641</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 11,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;full_attention&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;recurrent_state&#34;: null</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 12,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 12.4128,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 1.4145740351523273e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.024243788793683052,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -2.0156,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 4.75</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 13,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 4.5806,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 5.178116407478228e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.008946255780756474,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -0.625,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 0.8828</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 14,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 6.6091,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 1.9216095097362995e-06,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.012908515520393848,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -1.1797,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 1.9062</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 15,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;full_attention&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;recurrent_state&#34;: null</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 16,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 14.9185,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 0.0007705084281042218,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.02912762761116028,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -2.0469,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 2.25</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 17,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 18.2702,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 0.001090926118195057,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.035667285323143005,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -1.0078,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 3.6094</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 18,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 27.7848,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 0.001961493631824851,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.054231852293014526,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -1.7578,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 7.5938</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 19,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;full_attention&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;recurrent_state&#34;: null</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 20,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 19.7204,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 0.0018462880980223417,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.03847223520278931,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -1.2734,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 5.1875</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 21,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 16.0026,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: 0.0006738443626090884,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.03124796412885189,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -0.9219,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 1.9297</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 22,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;deltanet&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;shape&#34;: [</span><span leaf=""><br/></span><span leaf="">          1,</span><span leaf=""><br/></span><span leaf="">          16,</span><span leaf=""><br/></span><span leaf="">          128,</span><span leaf=""><br/></span><span leaf="">          128</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        &#34;frobenius_norm&#34;: 7.8206,</span><span leaf=""><br/></span><span leaf="">        &#34;mean&#34;: -5.036524817114696e-05,</span><span leaf=""><br/></span><span leaf="">        &#34;std&#34;: 0.015274584293365479,</span><span leaf=""><br/></span><span leaf="">        &#34;min&#34;: -0.3867,</span><span leaf=""><br/></span><span leaf="">        &#34;max&#34;: 1.8359</span><span leaf=""><br/></span><span leaf="">      },</span><span leaf=""><br/></span><span leaf="">      {</span><span leaf=""><br/></span><span leaf="">        &#34;layer&#34;: 23,</span><span leaf=""><br/></span><span leaf="">        &#34;type&#34;: &#34;full_attention&#34;,</span><span leaf=""><br/></span><span leaf="">        &#34;recurrent_state&#34;: null</span><span leaf=""><br/></span><span leaf="">      }</span><span leaf=""><br/></span><span leaf="">    ],</span><span leaf=""><br/></span><span leaf="">    &#34;raw_sample&#34;: {</span><span leaf=""><br/></span><span leaf="">      &#34;desc&#34;: &#34;L16 head0 fast-weight matrix S (128x128) top-left 8x8 + first 16 diagonal&#34;,</span><span leaf=""><br/></span><span leaf="">      &#34;S_top_left_8x8&#34;: [</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          -0.01288,</span><span leaf=""><br/></span><span leaf="">          0.00102,</span><span leaf=""><br/></span><span leaf="">          0.03613,</span><span leaf=""><br/></span><span leaf="">          -0.00125,</span><span leaf=""><br/></span><span leaf="">          -0.01855,</span><span leaf=""><br/></span><span leaf="">          0.0002,</span><span leaf=""><br/></span><span leaf="">          -0.01965,</span><span leaf=""><br/></span><span leaf="">          -0.0018</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          -0.00325,</span><span leaf=""><br/></span><span leaf="">          -0.0009,</span><span leaf=""><br/></span><span leaf="">          -0.01215,</span><span leaf=""><br/></span><span leaf="">          0.00025,</span><span leaf=""><br/></span><span leaf="">          0.00458,</span><span leaf=""><br/></span><span leaf="">          -0.00105,</span><span leaf=""><br/></span><span leaf="">          0.00378,</span><span leaf=""><br/></span><span leaf="">          -0.00276</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          -0.00145,</span><span leaf=""><br/></span><span leaf="">          0.00262,</span><span leaf=""><br/></span><span leaf="">          0.03394,</span><span leaf=""><br/></span><span leaf="">          -0.00279,</span><span leaf=""><br/></span><span leaf="">          0.0119,</span><span leaf=""><br/></span><span leaf="">          -0.00323,</span><span leaf=""><br/></span><span leaf="">          0.00702,</span><span leaf=""><br/></span><span leaf="">          -0.0001</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          0.02808,</span><span leaf=""><br/></span><span leaf="">          0.00095,</span><span leaf=""><br/></span><span leaf="">          -0.01892,</span><span leaf=""><br/></span><span leaf="">          0.00072,</span><span leaf=""><br/></span><span leaf="">          0.03735,</span><span leaf=""><br/></span><span leaf="">          -0.00455,</span><span leaf=""><br/></span><span leaf="">          0.03564,</span><span leaf=""><br/></span><span leaf="">          0.00351</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          0.01196,</span><span leaf=""><br/></span><span leaf="">          -0.00021,</span><span leaf=""><br/></span><span leaf="">          -0.00613,</span><span leaf=""><br/></span><span leaf="">          0.00129,</span><span leaf=""><br/></span><span leaf="">          0.01892,</span><span leaf=""><br/></span><span leaf="">          -0.00101,</span><span leaf=""><br/></span><span leaf="">          0.02039,</span><span leaf=""><br/></span><span leaf="">          0.0001</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          -0.00049,</span><span leaf=""><br/></span><span leaf="">          -2e-05,</span><span leaf=""><br/></span><span leaf="">          0.0009,</span><span leaf=""><br/></span><span leaf="">          -3e-05,</span><span leaf=""><br/></span><span leaf="">          -0.00051,</span><span leaf=""><br/></span><span leaf="">          6e-05,</span><span leaf=""><br/></span><span leaf="">          -0.00049,</span><span leaf=""><br/></span><span leaf="">          -5e-05</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          -0.0002,</span><span leaf=""><br/></span><span leaf="">          -0.00071,</span><span leaf=""><br/></span><span leaf="">          -0.01208,</span><span leaf=""><br/></span><span leaf="">          5e-05,</span><span leaf=""><br/></span><span leaf="">          -0.00436,</span><span leaf=""><br/></span><span leaf="">          -0.00102,</span><span leaf=""><br/></span><span leaf="">          -0.00331,</span><span leaf=""><br/></span><span leaf="">          8e-05</span><span leaf=""><br/></span><span leaf="">        ],</span><span leaf=""><br/></span><span leaf="">        [</span><span leaf=""><br/></span><span leaf="">          0.00687,</span><span leaf=""><br/></span><span leaf="">          -0.00082,</span><span leaf=""><br/></span><span leaf="">          -0.01721,</span><span leaf=""><br/></span><span leaf="">          0.00124,</span><span leaf=""><br/></span><span leaf="">          0.01385,</span><span leaf=""><br/></span><span leaf="">          0.00058,</span><span leaf=""><br/></span><span leaf="">          0.01385,</span><span leaf=""><br/></span><span leaf="">          -0.00024</span><span leaf=""><br/></span><span leaf="">        ]</span><span leaf=""><br/></span><span leaf="">      ],</span><span leaf=""><br/></span><span leaf="">      &#34;diag_first16&#34;: [</span><span leaf=""><br/></span><span leaf="">        -0.01288,</span><span leaf=""><br/></span><span leaf="">        -0.0009,</span><span leaf=""><br/></span><span leaf="">        0.03394,</span><span leaf=""><br/></span><span leaf="">        0.00072,</span><span leaf=""><br/></span><span leaf="">        0.01892,</span><span leaf=""><br/></span><span leaf="">        6e-05,</span><span leaf=""><br/></span><span leaf="">        -0.00331,</span><span leaf=""><br/></span><span leaf="">        -0.00024,</span><span leaf=""><br/></span><span leaf="">        0.03491,</span><span leaf=""><br/></span><span leaf="">        -0.03174,</span><span leaf=""><br/></span><span leaf="">        -0.00534,</span><span leaf=""><br/></span><span leaf="">        0.00687,</span><span leaf=""><br/></span><span leaf="">        -0.00215,</span><span leaf=""><br/></span><span leaf="">        -0.00061,</span><span leaf=""><br/></span><span leaf="">        0.00354,</span><span leaf=""><br/></span><span leaf="">        -0.05664</span><span leaf=""><br/></span><span leaf="">      ]</span><span leaf=""><br/></span><span leaf="">    }</span><span leaf=""><br/></span><span leaf="">  }</span><span leaf=""><br/></span><span leaf="">}</span></code></pre><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">实际上,只有deltanet还是不够,模型是无论如何都无法回忆出来内容的,deltanet是大致方向.属于是”意识”而不是”记忆”</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">另外,我还做了一个消融实验，deltanet分了conv_state和recurrent_state，想看哪个对“意识”有影响：</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">通过给新会话恢复：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">recurrent_state = 保存值</span><span leaf=""><br/></span><span leaf="">conv_state      = 保存值</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Attention KV 全部清空。</span><span leaf=""><br/></span><span leaf="">得到：</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">海豚 → 鲸鱼</span><span leaf=""><br/></span><span leaf="">松鼠 → 松鼠</span><span leaf=""><br/></span><span leaf="">白鹭 → 鹤</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果做了Recurrent的恢复不恢复conv_state，效果也是一样的:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">海豚 → 鲸鱼</span><span leaf=""><br/></span><span leaf="">松鼠 → 松鼠</span><span leaf=""><br/></span><span leaf="">白鹭 → 鹤</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果反过来，只恢复conv_state而不恢复recurrent,就全部炸了:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">海豚 → 狗</span><span leaf=""><br/></span><span leaf="">松鼠 → 狗</span><span leaf=""><br/></span><span leaf="">白鹭 → 狗</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以conv_state对长期记忆确实没啥用,Conv State 保存的是卷积核最近几个 token。</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">实际上,最后的结论是,恢复或修改 DeltaNet state，可以把与该 state 关联的目标 token 的 logit 提高、概率提高、排名向前推；但不保证一定成为 Top-1，也不保证长文本中的任意词都能被新 query 精确拉高。</span></p></blockquote><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Prediction Hidden State</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Prediction Hidden State是指，模型做forward时,每一层都在更新一条”残差流”(每个位置一个隐藏向量)。对最后一个位置来说,它的隐藏向量经过剩下的层 + 最终 norm + lm_head,就变成了下一个 token 的 logits</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们第一个好奇的点，是模型在预测下一个词中的hidden state的信息中是否保存我们需要的东西，能否通过还原hidden state去还原我们的记忆。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们第一个实验，把session1的phs放到s2中，看看效果：</span><span leaf=""><br/></span><span leaf="">首先给s1说一句:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">请复述:海豚&#34;的提示</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这时模型下一个字的第一选择就是”海豚，Prediction Hidden State就是海豚，</span><span leaf=""><br/></span><span leaf="">然后就开始测试，S2让模型说</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">中国的首都是哪里?</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">给深层（19-22）换的时候，模型回答 海豚</span><span leaf=""><br/></span><span leaf="">给浅层（&lt;18）换的时候，模型回答 北京</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.40217391304347827" data-type="png" data-w="920" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002688" src="https://wechat2rss.xlab.app/img-proxy/?k=af5072b2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMs4kaFpqqNshWIfb3k1SbgDuOILialqhLGFYJvjmYhP0tx8W6SyjYTuLY3GVgmG3HgJdhdkxDh2ZOKichbD7rBgG1VtH7EKGRZ4%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Prediction Hidden trajectory</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个东西的概念是，生成一段输出时,每一步的 Prediction Hidden 按顺序串起来 = 一段自回归输出路径的神经录像。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后我们准备了三段话</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">  1. 自生成:给模型开头&#34;请写一句关于大海的话：&#34;,让它自己往下写 12</span><span leaf=""><br/></span><span leaf="">  个字,它写出了&#34;大海的波涛汹涌,\n大海的波涛汹涌,\n&#34;。这段话是它自己吐出来的。</span><span leaf=""><br/></span><span leaf="">  2. 被动·难:一句我编的怪暗号——&#34;紫色刺猬在月球上跳踢踏舞&#34;(9 个 token)。模型绝对猜不到。</span><span leaf=""><br/></span><span leaf="">  3. 被动·易:一句它烂熟的古诗——&#34;床前明月光,疑是地上霜&#34;(9 个 token)。</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">记录下他的整个过程的ph，拿着这串录像,去放到那个无关新问题(“描述天空”)上:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">  - 先把新问题喂进去,但在读结果前,把最后位置的内部向量,换成录像的第 1 格,再看模型蹦出啥字 →</span><span leaf=""><br/></span><span leaf="">  记为还原的第 1 个字。</span><span leaf=""><br/></span><span leaf="">  - 把刚蹦出的这个字喂回去,把它的内部向量换成录像第 2 格,看蹦出第 2 个字……</span><span leaf=""><br/></span><span leaf="">  - 连放 9 步(或 12 步),得到一整串&#34;还原出来的字&#34;。</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结果:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.23964497041420119" data-type="png" data-w="1014" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%;" data-imgfileid="100002727" src="https://wechat2rss.xlab.app/img-proxy/?k=d09b7679&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNMOLKocUjibz9xtvcg9AzicNhL962JqbYBcqm5tgILppk1QhvYuteUEQhgGQ3joCjC9sVvsniam4ibsRTGNY3iaIDQlbgIKL0JmCZc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结论:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">  - 自生成那段能 100% 还原,只是把它自己刚说的话放录像,不是记忆。</span><span leaf=""><br/></span><span leaf="">  - 古诗能还原 7/9,是它从权重里背出来的,给个开头它自己也会背,录像没帮忙。</span><span leaf=""><br/></span><span leaf="">  - 真正的新信息(暗号)——恰恰在&#34;紫色刺猬&#34;&#34;踢踏舞&#34;这些猜不到的关键字上全丢,塌回到只对 2 个最好猜的字。</span></code></pre><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">记忆值钱的部分就是”猜不到的部分”,而这个方法偏偏就在那里失败。所以 Prediction Hidden</span><span leaf=""><br/></span><span leaf="">轨迹当不了记忆——它只能把模型已经知道/已经说过的东西吐回来。</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实际上，因为没有锚点，我们没有办法从这玩意中恢复记忆，因为他也不知道自己在关注什么，就跟这个一样:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.1962962962962963" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002689" src="https://wechat2rss.xlab.app/img-proxy/?k=e17504bd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOe9UBcjXlRF5LK77l6oTaMBBRroKXic2Vricj9icZCEQ2icfF7VdRzNqibyE1bUriaqPWMGhSvjpL2Syf0Da40pqLHFx7yTxGvMvsCE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">惊奇度</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">惊奇度 = 模型看到某个词时”有多意外”。 越是猜不到、越出乎意料的词,惊奇度越高。</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">  惊奇度 = −log( 模型给这个真实词打的概率 )</span><span leaf=""><br/></span><span leaf="">  - 模型觉得这个词很可能出现(概率 0.9)→ −log(0.9) ≈ 0.1,惊奇度低,&#34;果然是它&#34;。</span><span leaf=""><br/></span><span leaf="">  - 模型觉得这个词几乎不可能(概率 0.0001)→ −log(0.0001) ≈ 9,惊奇度高,&#34;啊?居然是这个?&#34;</span><span leaf=""><br/></span><span leaf="">  单位叫 nat(自然对数);数值 0 = 完全料到,数值越大 = 越震惊。每 +0.69 大约代表&#34;概率减半&#34;。</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">用我们刚才的实测数据看，读”紫色刺猬在月球上跳踢踏舞”时,每个词模型有多意外:</span><span leaf=""><br/></span><span leaf="">从之前的实验来看惊奇度</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5462962962962963" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002695" src="https://wechat2rss.xlab.app/img-proxy/?k=bbf10805&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOiaZRcS1QTs3dfMCwo3XocH0xq2cI6HI023IK9v7iaHBccwxjfoUiaf1hMBKAwW8lGmzKU9KQ4EoLpOtiaztRWt5D95GibvdB6V74I%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们把一切组合起来</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">是时候把一切都组合起来了，通过上面的实验，我们发现</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">大模型靠KV做注意力的精确匹配（可寻址的上下文访问机制，非常重要），靠hidden state做下一个词预测，靠DeltaNet做KV的压缩减少注意力。这个过程中，如果离开了KV，我们是没有记忆的锚点进行记忆的匹配的。</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而KV是? 你可能想到了, 高惊奇度的token可以被用于做KV。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这在做了无数的实验后，我直接说结论吧：</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">我们不需要模型，完整的每篇文章都记住，我们只需要模型记住那些</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">高惊奇度</span></strong><span leaf="">的token，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">结合deltanet方向，模型就能能相对完整的还原关键信息，而不占用太多的token。</span></strong><span leaf="">如果只有高惊奇度KV是没有用的,因为模型没有意识到这些token是干什么的。</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们做几个实验验证一下</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实验1: 自由复述</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">存进暗号”紫色刺猬在月球上跳踢踏舞”,然后剪掉 KV、让模型自己复述:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.3405275779376499" data-type="png" data-w="834" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002694" src="https://wechat2rss.xlab.app/img-proxy/?k=f1a84f48&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMvsE7ydFGRkCHTFoMpVzHQn6BK1xLxWGgvJ4dibXsmtzr5ria8Wd7ebuRWgMiaJibdv6tFOPU6bAw7recpZElsicpxHyzg2RYE0wNc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">只有留了高惊奇 KV,”紫色刺猬”这个真正的暗号内容才回得来。 DeltaNet 单独、或只留低惊奇 KV,一个内容字都</span><span leaf=""><br/></span><span leaf="">吐不出来(只会复读提示)。高惊奇版本后半段虽然退化成”踢踢踢”,但把最核心的”紫色刺猬在月球上”救回来了。</span></p></blockquote><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实验2:token 定位</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">看两个最硬的内容词的排名(0=还原成功)</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.4904831625183016" data-type="png" data-w="683" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002692" src="https://wechat2rss.xlab.app/img-proxy/?k=b6e80f60&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPlhNhGia0W6ib0Ne1J7hWzGELE0el1uScjUXGvic0BTxClbVwZUCBwEWytNCaW13UPdgX0V6AV6KiadKdK064PrrPO6zbC5XTvicOY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">保留哪个高惊奇 token 的 KV,就精确救回哪个 token。 保「紫色」→紫色回来;再保「刺猬」→刺猬也回来。低惊奇</span><span leaf=""><br/></span><span leaf="">KV 怎么加都救不回这两个字。</span></p></blockquote><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实验3:小说测试</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让claude给我写一篇模型绝对没学过的小说</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">  ▎ 雾锁港的灯塔已经荒废了三十年。守夜人柯兰忒每晚提着一盏青铜色的油灯,爬上三百二十九级台阶,只为擦亮塔</span><span leaf=""><br/></span><span leaf="">  ▎ 顶那第七面铜镜。他口袋里总揣着一枚刻着猫头鹰的怀表,那是妹妹薇拉留下的唯一遗物。每逢暴风雨的夜晚,他</span><span leaf=""><br/></span><span leaf="">  ▎ 会吹起一种叫银鳕语的古老口哨,呼唤海里那头独眼的蓝鲸归来。</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">测试他的记忆能力，然而只靠单token恢复是缺少明显上下文，恢复效果并不好:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.8404040404040404" data-type="png" data-w="495" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002691" src="https://wechat2rss.xlab.app/img-proxy/?k=1dc84d6c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNQkYwaJRsiaX9TV7fn9TDYM78wRYksB3DGI3vmXwv1auzC2vqSMJYiaCH0g7dYML9X11NAP3MLlR5MR6qb1xgBBsMQJRMESeicqg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以我们改成高惊奇度的周围的token：</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5128205128205128" data-type="png" data-w="546" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002693" src="https://wechat2rss.xlab.app/img-proxy/?k=4abd826b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOP3yOXxRhSu2P4NiayNIS5sw0icV0dZSIerwpXc5JKgXIN50e4tADb7gDansmCf6Rb4VamoXnuN4EzhkTOD7ibeyhRpOVgeZEpBw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">大部分都回来了!而且效果非常好。</span><span leaf=""><br/></span><span leaf="">那么如果没有deltanet，全部恢复的效果如何?</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.36507936507936506" data-type="png" data-w="630" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002696" src="https://wechat2rss.xlab.app/img-proxy/?k=b1d52546&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPqwz7uBCWssKm2bSugFMWJWmV6s1icg4jpDy0eMQcMExcOicI9jE4EjxPu6dZdNvI2aUcfroB2yFhKBqHYLpJsAncNfqIjLjYNQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">DeltaNet 自己几乎没用(1/10),却能把 KV 的检索从 5/10 抬到 9/10——差不多翻倍。 也就是说:内容确实存在 KV里(单独能取回一半),但那 18 个线性层携带的故事”要点/上下文”是个催化剂,让 6 个注意力层能真正用好这些KV。缺了它,同样的 KV 只能取回一半。</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">POC</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们把这几个结合在一起,分几步</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">每个用户一个 Tensor Bank</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">存 Delta(各线性层递归态)+ KV(retrieval_key 用 pre-RoPE + value)</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">建 cache:载入 Delta + 每个全注意力层预留 top_k 槽</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">每个全注意力层挂 forward_pre_hook,捕获这一层 query</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">当前 Q 与 Bank 的 retrieval_key(同空间/去位置)做分组注意力打分</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">按分数选位置(span-aware)</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">注入:retrieval_key→RoPE 到虚拟槽=injected_key,value 用源 value,覆盖预留槽</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">用注入后的 cache 生成(记忆不进 prompt)</span></p></li></ol><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们来测试一下</span><span leaf=""><br/></span><span leaf="">先说我是huoji</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.8356435643564356" data-type="png" data-w="1010" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002697" src="https://wechat2rss.xlab.app/img-proxy/?k=15e8d73c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVP1RDbxvVarghyGpPxlAFzVA4wejgpP5mmdeUhH0thXaeU00lOAormuXxUicLNJlogpK2Wql5EEcW4ajYsgAoqKKuhyPic8RiaJE0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">然后更新记忆</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.9201127819548872" data-type="png" data-w="1064" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002700" src="https://wechat2rss.xlab.app/img-proxy/?k=273b2704&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOxlf6aRYT2zoPUnibRd02ibUaoEYuibdxnH9COS30iaiaibcnZI9UATyTAls0YL8cBTuOBjHnYjBLtibJ0xzpGUawYIViaTwKYW7ecfss%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">然后再回归:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.6886973180076629" data-type="png" data-w="1044" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002698" src="https://wechat2rss.xlab.app/img-proxy/?k=c3de0609&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVP9U5dllBHI6yNMQfv96HbcHib422ibYr1F3kICiaWrtn0WeicTXJeibib1bNobiau02vEooyHxQ6wkstvlHmOCdoIzJYS7JyX7vAeEEM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">模型说调用工具其实是幻觉，0.8b的模型幻觉很正常</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后CTF回忆:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="1.0295566502463054" data-type="png" data-w="1015" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002699" src="https://wechat2rss.xlab.app/img-proxy/?k=c47db0ff&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNp0bu1L1PrvIXK8iagALCEs82sDlprx7QdZQnqnS4eXSVehlrT1ckKpX2Ifa4TwS5DSWgXfVZEBkgCNzicbszqjbJz6NyIRx0eo%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">其他测试：</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5916666666666667" data-type="jpeg" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002702" src="https://wechat2rss.xlab.app/img-proxy/?k=5572c273&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVMxTzh72ez0FEngcm4OaBz0HwVLhyjZvUziaImab9c2cuTibRvVyBGq7r7qXJia9iahyb1HgJjjKibgc2hldMEKXH4FSe5pnES2TbfE%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5425925925925926" data-type="jpeg" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002704" src="https://wechat2rss.xlab.app/img-proxy/?k=6bd67875&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVOYu0iaLnhVodlaOeZV60hBwBs0dSgceI0cWYQdCouqJgkHgDeoJLbCvQ5KrryfOlLqIYcdccqKBj4IGkNIayVEbiaDcU4oXF0y8%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5425925925925926" data-type="jpeg" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002705" src="https://wechat2rss.xlab.app/img-proxy/?k=2484a11d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVOKjHu89EmuRPpxg2OJjDSaaFOA6NxSulJaSguib2XtGQIRxvF41ZoGn42kutsTp2ib83hoCHUtYQPMUmNZOOhrrtGNo1MdicZEN4%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">跟RAG的区别</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">自己去问AI跟RAG的区别是什么优势是什么</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这能带来什么改变？</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们能实现，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">喂入大量文档就能改变模型的行为</span></strong><span leaf=""><br/></span><span leaf="">能实现，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">接近无损的记忆召回而不占用太多上下文（虚拟槽位还需要要，但是256个槽位就足够）</span></strong><span leaf="">理想情况下，硬盘有多大，记忆就有多少</span><span leaf=""><br/></span><span leaf="">能实现，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">agent能力的显著提升</span></strong></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">ctf,原版模型完全无法做出来,经过记忆的注入后做出来了,虽然跟你提示词直接跟他说write up过程一样</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="1.2407407407407407" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002703" src="https://wechat2rss.xlab.app/img-proxy/?k=cbfb53ce&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPJb2KkYIYHUWicawGHzc8IfZBibP7c1VWPJty9ibNpITMAnQ66qB3ib1mu6wQSfGzv3gODfHia7Gdjd5TEImDH3WIn83H3JnTjJdmU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">未完待续</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">别高兴太早，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">理论跟工程的差距很大</span></strong><span leaf="">，就如同核聚变理论很早就有但是实际工程困难程度极大一样。</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">这套看起来很不错的理论背后有很复杂的工程难度。</span></strong><span leaf="">这些我会在下一章说明清楚，并且会说明这个技术是如何影响agent行为，成功的提高agent任务成功率的。以及目前还存在的问题是什么。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">参考文献</span></h2><ul style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">A Systematic Analysis of Hybrid Linear Attention (arXiv:2507.06457)</span><span leaf=""><br/></span><span leaf="">(<a href="https://arxiv.org/abs/2507.06457v1)" target="_blank">https://arxiv.org/abs/2507.06457v1)</a></span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">Understanding and Enhancing Mamba-Transformer Hybrids for Memory Recall (arXiv:2510.26912)</span><span leaf=""><br/></span><span leaf="">(<a href="https://arxiv.org/abs/2510.26912)" target="_blank">https://arxiv.org/abs/2510.26912)</a></span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">Locating and Editing Factual Associations in Mamba (arXiv:2404.03646)</span><span leaf=""><br/></span><span leaf="">(<a href="https://arxiv.org/abs/2404.03646)" target="_blank">https://arxiv.org/abs/2404.03646)</a></span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">Samba: Simple Hybrid State Space Models (arXiv:2406.07522) (<a href="https://arxiv.org/pdf/2406.07522)" target="_blank">https://arxiv.org/pdf/2406.07522)</a></span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">B’MOJO: Eidetic and Fading Memory (arXiv:2407.06324) (<a href="https://arxiv.org/abs/2407.06324)" target="_blank">https://arxiv.org/abs/2407.06324)</a></span></p></li></ul><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=6ab52fcd&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486379%26idx%3D1%26sn%3D5fd6478975937283272fc25b49b405b8">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 03 Aug 2026 10:00:00 +0800</pubDate>
    </item>
    <item>
      <title>冲鸭两周年:大模型针对Agent的垂直微调</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486329&amp;idx=1&amp;sn=4a2e6f63073a511963e99a20a6738af9</link>
      <description>前言感谢大家两年的持续不断的关注,本文章会由简单到困难的去介绍如何搞好一个领域垂直模型。</description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-07-20 08:00</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=67c41029&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVPCaiaE5tPcBiccqHNabatciaKfKVDqxn9WEIcPzVCXQyxGFv9p673OebhCdUiczFx2nZ2abxW6yibmlu9AbYdwnIP5IZtCIiatbPzZo%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">感谢大家两年的持续不断的关注,本文章会由简单到困难的去介绍如何搞好一个领域垂直模型。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">明确自己需要什么</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">模型分为pre train和post train两个阶段，实际工作中，我建议大家整post train，因为pre train的资源跟后者不是一个量级，改改源神QWEN得了。所以这里用的是QWEN3.6 27B这个模型作为BASE模型。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">然后你需要明确自己要微调什么领域的东西，不要指望小模型能跟很大的模型一样，样样精通。最好是一个领域一个对应的lora，比如如果你想小模型搞CTF搞得好,那就按照下面的做CTF的训练.代码审计的化就是代码审计。一般来说，除非超过小模型的预训练外的知识，比如小模型确实不知道WFP的API长啥样他就写不出来WFP的代码。一般情况下，在某些领域，小模型的性能经过微调后，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">会和大模型差不太多可能还会比大模型更好.</span></strong><span leaf=""> 这很好理解，大家知识都一样的情况下，大模型和小模型的差距可能就只在后训练!</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002653" data-ratio="0.7575757575757576" data-s="300,640" type="block" data-type="png" data-w="660" src="https://wechat2rss.xlab.app/img-proxy/?k=b8cc33f5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOa3pXcW6Bjrd3jCL2HAwzmZ6tibH6m0KQmOibM2MVF7ticqF4c1n1eZCPIoF30FLaQxr1YUQsD6rFycGYrC05cEvc8Jp7A9ELyck%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">建议使用unsloth，当然你也可以让大模型手搓，但是unsloth相当于图形化直接点了。大模型手搓有各种毛病，比如GPT系列模型会给你用AutoModelForCausalLM去套QWEN35的壳导致lora训练完全没效果如果你稍不注意GPT就会给你整一波大的</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">GPT/claude对大模型训练存在比较多的幻觉，即便是今天的GPT5.6-SOL也存在大量幻觉。如果你需要让他们协助你训练，必须要仔细看他们写的代码，或者自己写一份好的skills给他们.否则会出现非常多的幻觉导致各种异常情况.</span></p></blockquote><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">准备一个agent</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">固定一个agent非常重要！事实证明，这个对模型的能力提升非常大。</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">agent不要花里胡哨，乱七八糟的的，越简单越好</span></strong><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002649" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=4f5baf8e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNEA5DbVyVXgTZjjR0pXkpDssam1Z4thbpo7vNvdCEBLmCZ2EdzIfVL5WWbCAmgpbvadGwZqK2qO0FDjMpB1rG2d65KibnXHQ2Y%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">能导出session就行</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002654" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ce0ed0b2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVP36k5gHZWZy6DsbbUHgJ17UwkVpMx9ibsyFoLbiaRcgoJvVUbvSAoJXvAXpOfK5iaFWkBOFx5cHjKEyTD0m4PenH6wZbJAy4poQA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这些session要按照chatml的格式进行排布</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002651" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=73d06bb7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVP9dDricpXBlHhdTVg309zLk4pga2GH9v8km7fCGTGoHGcYib3moHEyL5anBJcSwZefS2xPYicgnYGoUwt5n3OksoeZbkficKts2icU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们之后的训练会围绕这个展开。你想做渗透就写个渗透agent，想搞CTF就CTF的agent</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">比如我的代码审计agent，ai时代了，不难开发:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a href="https://github.com/huoji120/code_review_agent" target="_blank">https://github.com/huoji120/code_review_agent</a></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">修改think行为</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">qwen默认的think又臭又长,对于agent调用可不是什么好事.先把他改了.用开源数据即可</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a href="https://huggingface.co/datasets/Modotte/CodeX-2M-Thinking" target="_blank">https://huggingface.co/datasets/Modotte/CodeX-2M-Thinking</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><a href="https://huggingface.co/datasets/angrygiraffe/claude-opus-4.6-4.7-reasoning-8.7k" target="_blank">https://huggingface.co/datasets/angrygiraffe/claude-opus-4.6-4.7-reasoning-8.7k</a></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">然后直接做LORA即可，推荐R=64，alpha=128</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">结果</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">修改前的think:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002658" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=7ef14282&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMHia8YYevyjJT9nXQbUzxtouguXW79drWw1jwSFcDqdZW82VS6HqxHxcCsicFcOS6j3tHMJsmdS1S8zUhgy3BEhLE7StPInv0BE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">改完后的think:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002659" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=2deb0f8b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVP6AorwcLNlVqLVIOT7IhjlZSWHbtyxXteJsicIndqGEVHCdKyv3TxjxkPgOsLIWYMnw9Q9NrmzJa8TibNdTUyGl3H7oDW525AS8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">是不是think就清爽多了。不过注意，这些hf的数据的think是假的，可能会带有害的问题。这个我们后面会讨论到</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">蒸馏AGENT行为</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这边推荐用QWEN3.6-27B这个模型,基座好,做事情靠谱.</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">前期准备</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">假设你现在要做某个领域的模型，比如我的代码审计模型，我们需要，首先搞高质量轨迹，起码5M-10M的更大的模型的轨迹，比如deepseek的，或者GPT的或者claude的都行，起始token数量需要5M以上，最好是10M。注意尽量给这些轨迹打分，即便是GPT或者claude也有做很流口水的情况，不要让模型学到这些流口水的。尽量是高分的路径</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">要注意的问题是,不要数据多个乱七八糟的方向的，比如你不能把claude的代码数据混合审计数据，由于lora的特性，他只能一个方向的去做。代码审计就是代码审计，CTF就是CTF。不能搞混数据，但是你可以多个lora对应一个base模型</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">中转的数据长这样:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002664" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=961e5c26&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNaghm8j7OoZG52mkiaJoBA1BCw5XiaL0YqUq2ZKp0k65aV71RhwsYajqibo1bB16osrhGCCAmGA9tiavV3EdwcMG8icicOanp7FhqK8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">数据如果你的机器并不能完整蒸馏1M上下文的情况下（最好是完整）你可以用以下方法</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">切片，比如你机器最32K，但是轨迹到了1M，那你可以做side windows比如system-&gt;user1-&gt;ass1-&gt;user2-&gt;ass2切成system-&gt;user1-&gt;ass1，user2-&gt;ass2</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">在1的基础上，通过隐藏tools的response获取更大上下文，对于远距离的tools可以直接隐藏。让模型通过think来看当前状态</span></p></li></ol><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">总之我建议机器配置越高越好，省事，否则你会跟我一样因为模型的训练上下文太短了会出现各种奇怪的问题（这个会在后面说）</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">数据合成</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们并不能直接蒸馏目前的国外两家大模型（除非你蒸馏deepseek）因为他们的think是假的有害think或者干脆是空think</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">他们故意整了一个2B左右的模型去搞有害的think summary，这些think summary并不具备任何因果关系，反问疑问句以及推理链条。蒸馏了会让模型直接变痴呆</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">因此我们需要去合成think，合成方法有很多，最直接的办法是把上下文丢给deepseek让deepseek按照你的想法去合成，而且这块会直接关乎模型的能力。</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">合成不要出现feature leak跟量化交易的规则是一个道理</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">比如我的代码审计的lora，可能需要不断反思当前状态。以及超长思维链去思考更多的情况下，用这个结构</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">&lt;think&gt;</span><br/><span leaf="">...</span><br/><span leaf="">&lt;/think&gt;</span><br/><span leaf="">&lt;summary&gt;</span><br/><span leaf="">...</span><br/><span leaf="">&lt;/summary&gt;</span><br/><span leaf="">&lt;rethink&gt;</span><br/><span leaf="">...</span><br/><span leaf="">&lt;/rethink&gt;</span><br/><span leaf="">&lt;answer&gt;</span><br/><span leaf="">...</span><br/><span leaf="">&lt;/answer&gt;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而我的代码编写的模型，则用的策略是，让DS觉得哪里需要think就去做否则不做</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002669" style="" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=fb4a2eca&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPXuHic07lYN9hZhtsELhrwx071jwUVT9EFVwCMAFFTUqyJloykAhdia7sLdugQEibPuFA60grAxuBVxzIxH9WH51aFRdkTupFOCI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">太简单的直接不think,让模型根据难易程度做不同的think,要不然每个都要超长think会累死</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002670" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=689c4bd1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOWtq9ImcVeGO6c9JE2iclrpTDyT6kLDbHQ9CksWLniadLLia6PN4T5y2KlpaYTYHuA1ibPYwvTw2duficD13m9Cibo8EEL9WQNnrHtg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">一个良好的think，需要具有</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">疑问句，推理以及反问以及规划。但是根据摸爬滚打的经验，疑问句多了模型会不自信，不自信就开始超长think出现but wait wait这种导致agent工作很慢。所以最好是模型自信一点，先干炸了再说。</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">蒸馏</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">没什么好说的,剩下的就是lora一把梭</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">基本上建议500checkpoints保存一次，你会获得很多的checkpoints，找几个题目测试一下，主要看模型有没有过拟合。过拟合了找上一个checkpoint继续测试。这个应该很容易</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">qwen系列模型有个坑,preserve_thinking一定要设置为true否则模型看不到上下文的think在做SFT的时候</span></p></blockquote><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">强化学习</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">光蒸馏SFT，只会让模型学到表明，没有on-policy的反馈(行为策略与目标策略相同)你的模型永远比不过大模型,要让知识变得能用起来。</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">所谓的RL个人理解就是,模型通过SFT学到了某些策略,但是每次对任务表现出来的策略并不一样,有好有坏,RL就是通过结果拉高好的,降低坏的</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果你什么都不懂，强烈建议先阅读</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><a href="https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide/training-ai-agents-with-rl" target="_blank">https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide/training-ai-agents-with-rl</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">每一个类型的任务都可以变为强化学习的一部分。只要可量化就行。这里介绍两个</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">健身房式强化学习</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">对于我的代码模型来说，我想教会模型写完代码review代码，我设计了一个代码健身房，这个是一个沙箱:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">给一大堆go math，go oneshot,python的任务（事实证明让模型通过代码解决数学题对模型智商的提高是最好的办法）</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002671" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=44244331&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMXQs2AE2pkLOo4KTWfMf34luD20S8u0JIbf9p2iaMH8L69TGVNd8Hd5eibSh06htzFiavp9r0yxIvts9RXUkAWwwCpl4jW6HSLAs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">我这里提示词模拟opencode的环境</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">然后通过规则比如是否review了代码，代码是否能编译之类的，去加分减分对整个轨迹</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">再接一个deepseek对代码质量和是否有reward hack进行检查。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">之后就每个sample生成1组，这些生成的有好有坏，拉就完事了。然后过滤掉全负组和全正组，留下有好有坏的，做RL，要计算KL。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">测试没问题后，你就挂机就行，观察整体样本的表现</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">如果出现 全负数的，说明模型在SFT阶段并没有学到大模型的轨迹，否则一定会有成功轨迹。返回检查SFT的样本。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">如果出现全正的，模型这块学得很好，不用管了</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">到差不多全正的时候就可以终止。这个时候你会发现模型处理这些健身房的任务非常漂亮，还需要测试泛化性。一般来说有KL的存在不会有太多问题，但是要注意reward hack，并且要注意沙箱权限。已经不止一个案例发现模型会搞rm -rf 以及各种网络攻击去做reward hack。所以沙箱权限是很重要的一件事</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">轨迹强化学习</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在有些超长任务会涉及到多个上下文压缩的任务比如代码审计找漏洞的时候，前面健身房就不顶用了，因为涉及到了多个上下文的评分，很难有方法评分。这个时候就需要引入轨迹评分了，简单来说，用更大的模型，对这个模型的轨迹进行评分。在被压缩之前，筛选出最好的轨迹。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">长这样:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002676" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=13aed719&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPUicDZQkHs16zDAibOgc6cgqW7GavHibrApTDXydicXYhJ2e7RicFwrrxNaXmhUf4K89icxlcTcQeDavyCesVzYn8iahpmz4Q2xH40wI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">然后就是如法炮制。</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: none;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">强化学习会引入各种奇怪的东西，建议搞个基准测试再来搞。比如我的基座测试是写远程协助软件和对typecho系统找漏洞。用来评估模型质量。这些不能是训练集的内容。</span></p></blockquote><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">合并这一切</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我做了一套完整的在线训练系统来实现这个</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">首先是蒸馏部分，我做了一个中转站专门负责蒸馏</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002673" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c5509dc3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOaEGCdRnO3vY0sWl25HSmqsOuRydoeOBia8AiayZqqlNlWVDbtdPebTzMQPS792xmYs3XAgrR2jibxKVFtphGnMhZ51QubNnRHlw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这个中转站不一样的是，他会自动对老师模型进行think合成</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002672" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=5b5a8a94&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVORFREalVZA8pVcY0STIkEavdv1f3pN26eyHA3ck1OgOicfJAWrawMOj3Wc49d9Xj6ibXOZ8GUBG89VmuPX5JLBuhQOp0EPsE9OU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">并且对学生模型进行打分</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002674" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=b2bbae31&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMYK6lmUCibicdicZO7UZ8W5cFQaDysRYyLRo21JPUjRXF9gPsqnVwEl88Ovqohv3skxgyMKkHh7mnCvpLOfxTmVDaia1ic9tiaFJ4ib8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后每天自动进行训练，把这一切都自动化：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002675" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0467a97e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNicAic2biakt5bjBHBibZKxbFlZ3PSOIuiaWeWEics0zpickS2YkzLTO8U6TTmAZM7bYj4h0EYnkn0Zibgmt3SiaHiahH4SnRCvZDPNWgI8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">理论上，我会越用越强。因为实时强化学习在，每天模型坏行为都会被标注出来，好行为也会被标注出来。不过我用的少，只在代码审计的时候数据充足，以下是群友真实评价，以下评价是真实群友的，获得授权可以转出去的:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002677" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9109fa0f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVO8tn80OSpxq8fMlFVMkQbNib4Vp6QUSoe02cr4xXsk6JQpup1dmeFW2moria9MauuoRicZlNDzTBMRHInCc4clewfbTlxYTbNXnE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-imgfileid="100002678" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d560fa4f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNQbrYMhibHxIKYvARvYU9zd7mxDFOlNKh23KIzUmf3E0ibicyEGc6nibE4j8IlToECRctKRDh85ibxWJMWTy66iciaMUBwxmEoJvm2ZM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">有些评价找不到了，因为是几个月前的事情了，微信聊天记录丢的差不多了</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">备注: 参数永远是模型的瓶颈</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">目前来说，小模型的瓶颈是知识量不足，不要指望某些领域它能比大模型好，尤其是某些对知识要求非常高的领域比如法律，医疗。知识不足可能可以通过CPT弄出来，但是成本太大了。对于agent调用(比如CTF，渗透测试)我个人认为27B的模型足够了。写代码27B就可能力不从心了，因为代码是一个涉及到世界知识的领域（比如你让他写WFP他真的不懂WFP的API所以就会乱写即便是RL做的再漂亮）。</span></p><p><span leaf="">本来还想开源模型和跑基线测评的，但是最近这几个月在疯狂忙别的工作的事情，完全没空搞后续了。这篇文章也是两个月前写好但是一直不满意没发，属于是（上），但是算了，这么忙的情况下，能发出来就不错了。总之，感谢大家的关注。希望还有冲鸭三周年吧。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=cbfbe6af&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486329%26idx%3D1%26sn%3D4a2e6f63073a511963e99a20a6738af9">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 20 Jul 2026 08:00:00 +0800</pubDate>
    </item>
    <item>
      <title>修复10年前游戏的BUG</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486286&amp;idx=1&amp;sn=5741b86043e4a5c0c73d97cdf00bda3d</link>
      <description>前言这几天在跟朋友玩《异形:殖民军》这款游戏，这款游戏于2013年发售，制作完后制作组就跑路了。</description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-05-28 08:00</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a4599ef0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVMTOia2DUuFwXhwibJTjcFOklesRjdvGuuhUxiaBb4ictTP63Wln1FdibVNXBUDiagHYMkPtXZO4nAeOSWMY6AY6k8IhxV4tyMWvoGzE%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这几天在跟朋友玩《异形:殖民军》这款游戏，这款游戏于2013年发售，制作完后制作组就跑路了。可以简单理解为这是一款太空版支持联机过剧情的使命召唤like游戏。我们两个下的都是FLT修改版本，本来想以前走hamachi局域网联机。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002610" style="" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=2393851f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNmr6GTAu5Eljh1FnUHgPCNDeyMxLR8gfZrHAiczK7mlrzIUY9DcX3h4W7En9R3ps3YrGDrT1LxgiaHDiaV7h0iaoPB1qGdRTaCVEk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">但是意外发生了，我们死活联机不上。提示找不到游戏。随后我们试了一下tun方案/对战平台方案，完全没办法联机。</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002614" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=63e29eb6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMkVkmuJ72UkBoF0PSGEkAtkep3EQxIia33TJAhJXSowX6S8wOgUuybHDT4mldGAMWEfzk0mynDRFHibU1CX0VcKdedf5z3kL9o8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">可是我记得十年前玩的时候是可以正常联机的。问题出在哪？</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">联机流程</span></h2><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">由于游戏早就死了，steam买不值得，我们用的是盗版，盗版走的是局域网联机方案，所谓局域网联机方案，一般指的是用hamachi或者对战平台或者各种联机工具 建立一个虚拟局域网，大家都有一样的虚拟局域网ip</span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002615" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=3bf23a03&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNW1DQCStStRibCcS4D2JX2ePvvA7O29icqMVs4PuZcVL8BGphvkRpUog1hmcPxtziaQH0NyPCiapxa42KAbptFYiarCIyGexb3hxrg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">这个虚拟机的网卡就是假的局域网，从而让大家走“局域网联机”</span></span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002618" style="" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=57f771af&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNiaAoOaDoLv9cyBeaoqUQ0gfGPLuszhYnhiaXDZnJDk5lJqAjx7COwUdlnBSBIicjrznmgebEnms5Ix4Gziax50mPnPN6iaD8TWLiaQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">理论上我们应该连的上，所以对这个网卡进行抓包，发现完全没游戏的数据包进来（游戏数据包是UPD，这里只有ICMP,是测延迟用的）</span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002621" style="" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=88aed00f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMZgtogjDDSRd8ORvp6AFmMibVgWJKB6p1sOd17nibtSjGiaZGus2dOicB8XOP5p7rP7cTiaKPaqTuiaW4CenXlQaDXb8KeVWs2QzhM4%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">传统游戏的局域网联机逻辑是，游戏对所有网卡的0.0.0.0 发一个UDP广播包，255.255.255.255 这个包会在整个局域网进行广播，然后如果有客户端就会 回包。</span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">这个游戏确实监听了UDP端口，并且等待广播包</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002622" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=afe5e496&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMlQichwXBI0vS8Yna9SZK1f883YQ01oRhrfntkKN3Dd3aOescakoibyjeSaDoof0yvuPib2Vg8SPfITnEYjMfkFLWicwHy9dpARHo%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">所以 问题很明显，游戏并没有对这个网卡发包。打开procmon，我们看看游戏发了什么包:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002624" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=68311f42&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM0Z55y7ud20axTpZ0Mk9Djt7lGjXzUOicib0RSAFqfY6LF9tAjt2LcIY3x1DWUdRUudiarCUJkGHDLXyt7YoEMNhYT9ENrvCicNHc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">我们可以看到，这个是第一个问题，这个游戏广播的包是我的物理网卡地址，并不是TUN的卡的地址。那肯定是没有人回复的。</span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">这个问题很好解决，根据我多年的</span></span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">零信任开发经验</span></strong><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">，游戏应该是通过一个叫做 越点 的机制去判断当前可用网卡的，我们只需要把虚拟网卡的越点设置为1就行</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002626" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=528edf94&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPm1SEWY1sFg2JmjfxH4NPCbeKCHmxHSWcztbROewlf9RxkdNE2gKYDJLUYoUIQCRObrI5I7JAicntAs8hiaJ3fl5slDibUXTYQPA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">这样游戏就会优先考虑虚拟网卡的IP发包。</span></span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">但是依然连不上</span></strong><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">再次抓包，发现：</span></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002628" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=26670566&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMU3MO8icMcp75F4xVibCM9ico7BSqBO1OIlnYKdcYMDBbzHuLCGic6Ow1EC7qGrqsBxzztNflFbs20m2bZsLxF1Klv0knnQHE29eE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">解读一下，游戏的广播包服务端确实返回了回复了，我的客户端也即将链接，但是我的客户端莫名其妙的链到了25.16.24.136这个完全摸不着头脑的国外地址！ 按理说应该直接链接10.100.239.2这个我的朋友的虚拟网卡IP的</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">经过一段时间的摸索，我发现，这个25.16.245.136是我朋友的一个虚拟网卡的IP地址，说明： 游戏服务端收到信息了，但是回复的网卡IP错误！理论上，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">应该回复他的当前包过来的绑定的IP</span></strong><span leaf="">但是为什么会回复这个，不知道。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">临时解决方法是，禁用这个虚拟网卡，祈祷游戏能找到真的地址</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">禁用虚拟网卡后，我们发现更完蛋了，游戏服务端返回的是电脑的物理网卡地址</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002627" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=794cb788&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMJon3yovvlSPZUOfTDUqYnwDVTQBEFVkKgRhCFeaRrHIhkOQPPpMfico59MCFuY7ZI5HVfbDhCBRR1DnU85Wr9pxhxRg8W4icibc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/> </span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个是不可能通的，除非开零信任。零信任这个时候确实派上用场了。但是肯定不能为了一个游戏装这玩意。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">因此有必要去代码层看看了</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: inherit;font-weight: 500;line-height: 1.2;color: inherit;font-size: 2rem;" data-pm-slice="0 0 []"><span leaf="">深入代码层</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">让我们直接逆向这个游戏，看看为什么会这样吧拖入IDA，对sento打断点，连接游戏看看：</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">构造255.255.255.255的包</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002631" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=130d3599&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM3JibdVBpBMPybHTMHQWH11Ga0nBqhINvtSlQS7F5rERKFPbp8Ww8eUiaUPjDZbCiaYGRXyFJZicQpfZrdgP2MQGKAchKeZLC9LXs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">发送:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002630" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9536edd5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOtJ5lPCCz6t3iakiapSic6SZt084DjjrQxUovXib4YvYGSgjxkGQMxiawtrjJPheEib8OJg3QjicVo7BicTL9q4NwxSiaeRAwT4GOLeuCQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">可以看到，发送的socket是一个socket，而不是枚举网卡逐个发送</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002632" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=57b3d9f5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVN0xjyhnxdibpOiaZeSRI302NhIm1HvefC0m46gKyjcVJ43hdFEIewky37DcenGMjnE8UU7jTaxPNViae2WkfvdWpspIKcn3TEBCI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">这就导致了第一个问题，广播包没广播对网卡</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">对于第二个问题，我们抓一个包看看：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">游戏服务器会返回一个包里面带了游戏服务端的IP地址</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002633" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=39a873a1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPpkYzb7FMI58VyjoicRHoP3WyRuCeYmU6jWcgUr4mib9SWxDiaHicOG1CZJGkxPMVj9DEKE5oZDAccT1owHEYyU2yjJoW8uYBD4c8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这一段是服务端的IP地址：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002629" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ef3de2f9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOzVul9QrFNgCltcTCeAE5L47XQDfagWx2yHVx2kgETvKMt2dqPKdyMTiazRa86WcIZAImnWVKfOibospr0WCjtQL2cOK2T91FCw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这个IP地址很明显也是错误的</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">根据服务端代码，问题出在得到网卡地址的这里，服务端收到包是能知道哪个socket的，但是他的网络和引擎层不是一个socket，他的网络层是获取不到的，所以他就只能，取一个本机 IP 发出去….毕竟，2013年的时候哪有那么复杂的网卡局域网联机环境？</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002634" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=899c4a66&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNSADKVibdDQgia3ZQ7TdcRQUTOOZHuZFTznZEF8FU5ic7ItFeRegh6F2EXblCRCzHBGy6jlCjibZEQ07xhSMcH760ia5kRuel6DKtw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">而这个IP就是纯随机的来源。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: inherit;font-weight: 500;line-height: 1.2;color: inherit;font-size: 2rem;"><span leaf="">修复这个bug</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">我们有几个修复方案，比如改包把IP改成自己的，起一个假的转发代理服务器等。但是最直接的办法是hook，我跟朋友写了两个方案，我的方案是客户端的方案，朋友的是服务端方案</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">客户端方案：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">通过hook sockets,进行改包,我用的是minihook:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-a4i93v" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &#34;pch.h&#34;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-3avwbk" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;cstdio&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-b3h1md" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;cstdarg&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-gf8do3" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;cstdint&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-eyadc0" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;cstring&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-kx7enm" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;vector&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-0orekj" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;string&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-cixpc1" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &#34;MinHook/include/MinHook.h&#34;</span><br/><span leaf="">namespace {</span><br/><span leaf="">using sendto_t = int(WINAPI*)(SOCKET, const char*, int, int, const sockaddr*,</span><br/><span leaf="">                              int);</span><br/><span leaf="">using recvfrom_t = int(WINAPI*)(SOCKET, char*, int, int, sockaddr*, int*);</span><br/><span leaf="">using bind_t = int(WINAPI*)(SOCKET, const sockaddr*, int);</span><br/><span leaf="">using getsockname_t = int(WINAPI*)(SOCKET, sockaddr*, int*);</span><br/><span leaf="">using gethostname_t = int(WINAPI*)(char*, int);</span><br/><span leaf="">using gethostbyname_t = hostent*(WINAPI*)(const char*);</span><br/><span leaf="">sendto_t RealSendTo = nullptr;</span><br/><span leaf="">recvfrom_t RealRecvFrom = nullptr;</span><br/><span leaf="">bind_t RealBind = nullptr;</span><br/><span leaf="">getsockname_t RealGetSockName = nullptr;</span><br/><span leaf="">gethostname_t RealGetHostName = nullptr;</span><br/><span leaf="">gethostbyname_t RealGetHostByName = nullptr;</span><br/><span leaf="">HMODULE g_Module = nullptr;</span><br/><span leaf="">HANDLE g_WorkerThread = nullptr;</span><br/><span leaf="">volatile bool g_Running = true;</span><br/><span leaf="">bool g_LogPackets = true;</span><br/><span leaf="">bool g_FixPayload = false;</span><br/><span leaf="">uint32_t g_ForcedIp = 0;</span><br/><span leaf="">std::vector&lt;uint32_t&gt; g_LocalIps;</span><br/><span leaf="">CRITICAL_SECTION g_LogLock;</span><br/><span leaf="">uint32_t ReadBe32(const char* p) {</span><br/><span leaf="">    return (uint32_t(uint8_t(p[0])) &lt;&lt; 24) | (uint32_t(uint8_t(p[1])) &lt;&lt; 16) |</span><br/><span leaf="">           (uint32_t(uint8_t(p[2])) &lt;&lt; 8) | uint32_t(uint8_t(p[3]));</span><br/><span leaf="">}</span><br/><span leaf="">void WriteBe32(char* p, uint32_t ip) {</span><br/><span leaf="">    p[0] = char((ip &gt;&gt; 24) &amp; 0xff);</span><br/><span leaf="">    p[1] = char((ip &gt;&gt; 16) &amp; 0xff);</span><br/><span leaf="">    p[2] = char((ip &gt;&gt; 8) &amp; 0xff);</span><br/><span leaf="">    p[3] = char(ip &amp; 0xff);</span><br/><span leaf="">}</span><br/><span leaf="">std::string IpToString(uint32_t ip) {</span><br/><span leaf="">    char buf[32];</span><br/><span leaf="">    std::snprintf(buf, sizeof(buf), &#34;%u.%u.%u.%u&#34;, (ip &gt;&gt; 24) &amp; 0xff,</span><br/><span leaf="">                  (ip &gt;&gt; 16) &amp; 0xff, (ip &gt;&gt; 8) &amp; 0xff, ip &amp; 0xff);</span><br/><span leaf="">    return buf;</span><br/><span leaf="">}</span><br/><span leaf="">uint32_t SockAddrIp(const sockaddr* addr) {</span><br/><span leaf="">    if (!addr || addr-&gt;sa_family != AF_INET) {</span><br/><span leaf="">        return 0;</span><br/><span leaf="">    }</span><br/><span leaf="">    const sockaddr_in* in = reinterpret_cast&lt;const sockaddr_in*&gt;(addr);</span><br/><span leaf="">    return ntohl(in-&gt;sin_addr.s_addr);</span><br/><span leaf="">}</span><br/><span leaf="">uint16_t SockAddrPort(const sockaddr* addr) {</span><br/><span leaf="">    if (!addr || addr-&gt;sa_family != AF_INET) {</span><br/><span leaf="">        return 0;</span><br/><span leaf="">    }</span><br/><span leaf="">    const sockaddr_in* in = reinterpret_cast&lt;const sockaddr_in*&gt;(addr);</span><br/><span leaf="">    return ntohs(in-&gt;sin_port);</span><br/><span leaf="">}</span><br/><span leaf="">void Log(const char* fmt, ...) {</span><br/><span leaf="">    EnterCriticalSection(&amp;g_LogLock);</span><br/><span leaf="">    va_list args;</span><br/><span leaf="">    va_start(args, fmt);</span><br/><span leaf="">    std::vprintf(fmt, args);</span><br/><span leaf="">    va_end(args);</span><br/><span leaf="">    std::printf(&#34;\n&#34;);</span><br/><span leaf="">    std::fflush(stdout);</span><br/><span leaf="">    LeaveCriticalSection(&amp;g_LogLock);</span><br/><span leaf="">}</span><br/><span leaf="">bool IsInterestingPacket(const char* buf, int len) {</span><br/><span leaf="">    if (!buf || len &lt;= 0) {</span><br/><span leaf="">        return false;</span><br/><span leaf="">    }</span><br/><span leaf="">    if (len &gt;= 2 &amp;&amp; buf[0] == &#39;U&#39; &amp;&amp;</span><br/><span leaf="">        (buf[1] == &#39;D&#39; || buf[1] == &#39;C&#39; || buf[1] == &#39;F&#39;)) {</span><br/><span leaf="">        return true;</span><br/><span leaf="">    }</span><br/><span leaf="">    if (len &gt;= 2 &amp;&amp; buf[0] == &#39;N&#39; &amp;&amp; buf[1] == &#39;F&#39;) {</span><br/><span leaf="">        return true;</span><br/><span leaf="">    }</span><br/><span leaf="">    if (len &gt; 200) {</span><br/><span leaf="">        return true;</span><br/><span leaf="">    }</span><br/><span leaf="">    return false;</span><br/><span leaf="">}</span><br/><span leaf="">bool LooksLikeUsefulIp(uint32_t ip) {</span><br/><span leaf="">    const uint8_t a = uint8_t((ip &gt;&gt; 24) &amp; 0xff);</span><br/><span leaf="">    const uint8_t b = uint8_t((ip &gt;&gt; 16) &amp; 0xff);</span><br/><span leaf="">    if (ip == 0 || ip == 0xffffffff || a == 0 || a == 127 || a &gt;= 224) {</span><br/><span leaf="">        return false;</span><br/><span leaf="">    }</span><br/><span leaf="">    if (a == 10 || a == 25 || (a == 172 &amp;&amp; b &gt;= 16 &amp;&amp; b &lt;= 31) ||</span><br/><span leaf="">        (a == 192 &amp;&amp; b == 168)) {</span><br/><span leaf="">        return true;</span><br/><span leaf="">    }</span><br/><span leaf="">    return false;</span><br/><span leaf="">}</span><br/><span leaf="">void ScanPayloadIps(const char* tag, const char* buf, int len) {</span><br/><span leaf="">    if (!buf || len &lt; 4) {</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    int shown = 0;</span><br/><span leaf="">    for (int i = 0; i &lt;= len - 4; ++i) {</span><br/><span leaf="">        const uint32_t be = ReadBe32(buf + i);</span><br/><span leaf="">        if (LooksLikeUsefulIp(be)) {</span><br/><span leaf="">            if (shown == 0) {</span><br/><span leaf="">                std::printf(&#34;%s candidate IPs:&#34;, tag);</span><br/><span leaf="">            }</span><br/><span leaf="">            std::printf(&#34; +0x%X=%s&#34;, i, IpToString(be).c_str());</span><br/><span leaf="">            ++shown;</span><br/><span leaf="">            if (shown &gt;= 12) {</span><br/><span leaf="">                std::printf(&#34; ...&#34;);</span><br/><span leaf="">                break;</span><br/><span leaf="">            }</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    if (shown &gt; 0) {</span><br/><span leaf="">        std::printf(&#34;\n&#34;);</span><br/><span leaf="">    }</span><br/><span leaf="">}</span><br/><span leaf="">void DumpPacketPrefix(const char* tag, const char* buf, int len) {</span><br/><span leaf="">    if (!buf || len &lt;= 0) {</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    const int count = len &lt; 64 ? len : 64;</span><br/><span leaf="">    std::printf(&#34;%s first %d:&#34;, tag, count);</span><br/><span leaf="">    for (int i = 0; i &lt; count; ++i) {</span><br/><span leaf="">        std::printf(&#34; %02X&#34;, uint8_t(buf[i]));</span><br/><span leaf="">    }</span><br/><span leaf="">    std::printf(&#34;\n&#34;);</span><br/><span leaf="">}</span><br/><span leaf="">void AddLocalIp(uint32_t ip) {</span><br/><span leaf="">    if (ip == 0 || ip == 0x7f000001) {</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    for (uint32_t existing : g_LocalIps) {</span><br/><span leaf="">        if (existing == ip) {</span><br/><span leaf="">            return;</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    g_LocalIps.push_back(ip);</span><br/><span leaf="">}</span><br/><span leaf="">void RefreshLocalIps() {</span><br/><span leaf="">    g_LocalIps.clear();</span><br/><span leaf="">    HMODULE wsock32 = GetModuleHandleW(L&#34;WSOCK32.dll&#34;);</span><br/><span leaf="">    if (!wsock32) {</span><br/><span leaf="">        wsock32 = LoadLibraryW(L&#34;WSOCK32.dll&#34;);</span><br/><span leaf="">    }</span><br/><span leaf="">    auto realGetHostName =</span><br/><span leaf="">        reinterpret_cast&lt;gethostname_t&gt;(GetProcAddress(wsock32, &#34;gethostname&#34;));</span><br/><span leaf="">    auto realGetHostByName = reinterpret_cast&lt;gethostbyname_t&gt;(</span><br/><span leaf="">        GetProcAddress(wsock32, &#34;gethostbyname&#34;));</span><br/><span leaf="">    char name[256] = {};</span><br/><span leaf="">    if (realGetHostName &amp;&amp; realGetHostByName &amp;&amp;</span><br/><span leaf="">        realGetHostName(name, sizeof(name)) == 0) {</span><br/><span leaf="">        hostent* host = realGetHostByName(name);</span><br/><span leaf="">        if (host &amp;&amp; host-&gt;h_addrtype == AF_INET) {</span><br/><span leaf="">            for (char** addr = host-&gt;h_addr_list; addr &amp;&amp; *addr; ++addr) {</span><br/><span leaf="">                AddLocalIp(ntohl(*reinterpret_cast&lt;uint32_t*&gt;(*addr)));</span><br/><span leaf="">            }</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">}</span><br/><span leaf="">int ReplaceIpsInPayload(char* buf, int len, uint32_t replacement) {</span><br/><span leaf="">    if (!buf || len &lt; 4 || replacement == 0) {</span><br/><span leaf="">        return 0;</span><br/><span leaf="">    }</span><br/><span leaf="">    int replaced = 0;</span><br/><span leaf="">    for (int i = 0; i &lt;= len - 4; ++i) {</span><br/><span leaf="">        const uint32_t value = ReadBe32(buf + i);</span><br/><span leaf="">        for (uint32_t localIp : g_LocalIps) {</span><br/><span leaf="">            if (value == localIp &amp;&amp; value != replacement) {</span><br/><span leaf="">                WriteBe32(buf + i, replacement);</span><br/><span leaf="">                ++replaced;</span><br/><span leaf="">            }</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    return replaced;</span><br/><span leaf="">}</span><br/><span leaf="">int WINAPI HookSendTo(SOCKET s, const char* buf, int len, int flags,</span><br/><span leaf="">                      const sockaddr* to, int tolen) {</span><br/><span leaf="">    const uint32_t toIp = SockAddrIp(to);</span><br/><span leaf="">    const uint16_t toPort = SockAddrPort(to);</span><br/><span leaf="">    if (g_LogPackets &amp;&amp; IsInterestingPacket(buf, len)) {</span><br/><span leaf="">        Log(&#34;sendto s=%p to=%s:%u len=%d&#34;, reinterpret_cast&lt;void*&gt;(s),</span><br/><span leaf="">            IpToString(toIp).c_str(), toPort, len);</span><br/><span leaf="">        DumpPacketPrefix(&#34;  send&#34;, buf, len);</span><br/><span leaf="">        ScanPayloadIps(&#34;  send&#34;, buf, len);</span><br/><span leaf="">    }</span><br/><span leaf="">    if (g_FixPayload &amp;&amp; g_ForcedIp &amp;&amp; buf &amp;&amp; len &gt; 0) {</span><br/><span leaf="">        std::vector&lt;char&gt; copy(buf, buf + len);</span><br/><span leaf="">        const int changed = ReplaceIpsInPayload(copy.data(), len, g_ForcedIp);</span><br/><span leaf="">        if (changed &gt; 0) {</span><br/><span leaf="">            Log(&#34;sendto fixed %d payload IP(s) -&gt; %s&#34;, changed,</span><br/><span leaf="">                IpToString(g_ForcedIp).c_str());</span><br/><span leaf="">            return RealSendTo(s, copy.data(), len, flags, to, tolen);</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    return RealSendTo(s, buf, len, flags, to, tolen);</span><br/><span leaf="">}</span><br/><span leaf="">int WINAPI HookRecvFrom(SOCKET s, char* buf, int len, int flags, sockaddr* from,</span><br/><span leaf="">                        int* fromlen) {</span><br/><span leaf="">    const int ret = RealRecvFrom(s, buf, len, flags, from, fromlen);</span><br/><span leaf="">    if (ret &lt;= 0) {</span><br/><span leaf="">        return ret;</span><br/><span leaf="">    }</span><br/><span leaf="">    const uint32_t fromIp = SockAddrIp(from);</span><br/><span leaf="">    const uint16_t fromPort = SockAddrPort(from);</span><br/><span leaf="">    if (g_FixPayload &amp;&amp; fromIp) {</span><br/><span leaf="">        const int changed = ReplaceIpsInPayload(buf, ret, fromIp);</span><br/><span leaf="">        if (changed &gt; 0) {</span><br/><span leaf="">            Log(&#34;recvfrom fixed %d payload IP(s) -&gt; packet source %s&#34;, changed,</span><br/><span leaf="">                IpToString(fromIp).c_str());</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    if (g_LogPackets &amp;&amp; IsInterestingPacket(buf, ret)) {</span><br/><span leaf="">        Log(&#34;recvfrom s=%p from=%s:%u len=%d&#34;, reinterpret_cast&lt;void*&gt;(s),</span><br/><span leaf="">            IpToString(fromIp).c_str(), fromPort, ret);</span><br/><span leaf="">        DumpPacketPrefix(&#34;  recv&#34;, buf, ret);</span><br/><span leaf="">        ScanPayloadIps(&#34;  recv&#34;, buf, ret);</span><br/><span leaf="">    }</span><br/><span leaf="">    return ret;</span><br/><span leaf="">}</span><br/><span leaf="">int WINAPI HookBind(SOCKET s, const sockaddr* name, int namelen) {</span><br/><span leaf="">    const uint32_t ip = SockAddrIp(name);</span><br/><span leaf="">    AddLocalIp(ip);</span><br/><span leaf="">    Log(&#34;bind s=%p local=%s:%u&#34;, reinterpret_cast&lt;void*&gt;(s),</span><br/><span leaf="">        IpToString(ip).c_str(), SockAddrPort(name));</span><br/><span leaf="">    return RealBind(s, name, namelen);</span><br/><span leaf="">}</span><br/><span leaf="">int WINAPI HookGetSockName(SOCKET s, sockaddr* name, int* namelen) {</span><br/><span leaf="">    const int ret = RealGetSockName(s, name, namelen);</span><br/><span leaf="">    if (ret == 0) {</span><br/><span leaf="">        const uint32_t ip = SockAddrIp(name);</span><br/><span leaf="">        AddLocalIp(ip);</span><br/><span leaf="">        Log(&#34;getsockname s=%p local=%s:%u&#34;, reinterpret_cast&lt;void*&gt;(s),</span><br/><span leaf="">            IpToString(ip).c_str(), SockAddrPort(name));</span><br/><span leaf="">    }</span><br/><span leaf="">    return ret;</span><br/><span leaf="">}</span><br/><span leaf="">int WINAPI HookGetHostName(char* name, int namelen) {</span><br/><span leaf="">    const int ret = RealGetHostName(name, namelen);</span><br/><span leaf="">    if (ret == 0) {</span><br/><span leaf="">        Log(&#34;gethostname -&gt; %s&#34;, name);</span><br/><span leaf="">    }</span><br/><span leaf="">    return ret;</span><br/><span leaf="">}</span><br/><span leaf="">hostent* WINAPI HookGetHostByName(const char* name) {</span><br/><span leaf="">    hostent* ret = RealGetHostByName(name);</span><br/><span leaf="">    if (ret) {</span><br/><span leaf="">        std::printf(&#34;gethostbyname %s -&gt;&#34;, name ? name : &#34;&lt;null&gt;&#34;);</span><br/><span leaf="">        if (ret-&gt;h_addrtype == AF_INET) {</span><br/><span leaf="">            for (char** addr = ret-&gt;h_addr_list; addr &amp;&amp; *addr; ++addr) {</span><br/><span leaf="">                const uint32_t ip = ntohl(*reinterpret_cast&lt;uint32_t*&gt;(*addr));</span><br/><span leaf="">                AddLocalIp(ip);</span><br/><span leaf="">                std::printf(&#34; %s&#34;, IpToString(ip).c_str());</span><br/><span leaf="">            }</span><br/><span leaf="">        }</span><br/><span leaf="">        std::printf(&#34;\n&#34;);</span><br/><span leaf="">    }</span><br/><span leaf="">    return ret;</span><br/><span leaf="">}</span><br/><span leaf="">bool HookExport(HMODULE module, const char* name, void* hook, void** original) {</span><br/><span leaf="">    void* target = reinterpret_cast&lt;void*&gt;(GetProcAddress(module, name));</span><br/><span leaf="">    if (!target) {</span><br/><span leaf="">        Log(&#34;missing export: %s&#34;, name);</span><br/><span leaf="">        return false;</span><br/><span leaf="">    }</span><br/><span leaf="">    MH_STATUS status = MH_CreateHook(target, hook, original);</span><br/><span leaf="">    if (status != MH_OK &amp;&amp; status != MH_ERROR_ALREADY_CREATED) {</span><br/><span leaf="">        Log(&#34;MH_CreateHook(%s) failed: %d&#34;, name, status);</span><br/><span leaf="">        return false;</span><br/><span leaf="">    }</span><br/><span leaf="">    status = MH_EnableHook(target);</span><br/><span leaf="">    if (status != MH_OK &amp;&amp; status != MH_ERROR_ENABLED) {</span><br/><span leaf="">        Log(&#34;MH_EnableHook(%s) failed: %d&#34;, name, status);</span><br/><span leaf="">        return false;</span><br/><span leaf="">    }</span><br/><span leaf="">    Log(&#34;hooked %s at %p&#34;, name, target);</span><br/><span leaf="">    return true;</span><br/><span leaf="">}</span><br/><span leaf="">uint32_t ParseIp(const char* text) {</span><br/><span leaf="">    unsigned int a = 0, b = 0, c = 0, d = 0;</span><br/><span leaf="">    if (sscanf_s(text, &#34;%u.%u.%u.%u&#34;, &amp;a, &amp;b, &amp;c, &amp;d) != 4) {</span><br/><span leaf="">        return 0;</span><br/><span leaf="">    }</span><br/><span leaf="">    if (a &gt; 255 || b &gt; 255 || c &gt; 255 || d &gt; 255) {</span><br/><span leaf="">        return 0;</span><br/><span leaf="">    }</span><br/><span leaf="">    return (a &lt;&lt; 24) | (b &lt;&lt; 16) | (c &lt;&lt; 8) | d;</span><br/><span leaf="">}</span><br/><span leaf="">void PrintHelp() {</span><br/><span leaf="">    Log(&#34;commands:&#34;);</span><br/><span leaf="">    Log(&#34;  help             show commands&#34;);</span><br/><span leaf="">    Log(&#34;  log on|off       enable or disable packet logs&#34;);</span><br/><span leaf="">    Log(&#34;  fix on|off       replace payload local IPs, default off&#34;);</span><br/><span leaf="">    Log(&#34;  ip a.b.c.d       force replacement IP for outgoing sendto&#34;);</span><br/><span leaf="">    Log(&#34;  local a.b.c.d    add an IP that should be replaced&#34;);</span><br/><span leaf="">    Log(&#34;  ips              show local IPs detected by gethostbyname&#34;);</span><br/><span leaf="">    Log(&#34;  refresh          refresh local IP list&#34;);</span><br/><span leaf="">    Log(&#34;  quit             unhook and unload DLL&#34;);</span><br/><span leaf="">}</span><br/><span leaf="">void CommandLoop() {</span><br/><span leaf="">    PrintHelp();</span><br/><span leaf="">    char line[256] = {};</span><br/><span leaf="">    while (g_Running &amp;&amp; std::fgets(line, sizeof(line), stdin)) {</span><br/><span leaf="">        line[strcspn(line, &#34;\r\n&#34;)] = 0;</span><br/><span leaf="">        if (_stricmp(line, &#34;help&#34;) == 0) {</span><br/><span leaf="">            PrintHelp();</span><br/><span leaf="">        } else if (_stricmp(line, &#34;log on&#34;) == 0) {</span><br/><span leaf="">            g_LogPackets = true;</span><br/><span leaf="">            Log(&#34;log on&#34;);</span><br/><span leaf="">        } else if (_stricmp(line, &#34;log off&#34;) == 0) {</span><br/><span leaf="">            g_LogPackets = false;</span><br/><span leaf="">            Log(&#34;log off&#34;);</span><br/><span leaf="">        } else if (_stricmp(line, &#34;fix on&#34;) == 0) {</span><br/><span leaf="">            g_FixPayload = true;</span><br/><span leaf="">            Log(&#34;fix on&#34;);</span><br/><span leaf="">        } else if (_stricmp(line, &#34;fix off&#34;) == 0) {</span><br/><span leaf="">            g_FixPayload = false;</span><br/><span leaf="">            Log(&#34;fix off&#34;);</span><br/><span leaf="">        } else if (_strnicmp(line, &#34;ip &#34;, 3) == 0) {</span><br/><span leaf="">            const uint32_t ip = ParseIp(line + 3);</span><br/><span leaf="">            if (ip) {</span><br/><span leaf="">                g_ForcedIp = ip;</span><br/><span leaf="">                Log(&#34;forced IP = %s&#34;, IpToString(g_ForcedIp).c_str());</span><br/><span leaf="">            } else {</span><br/><span leaf="">                Log(&#34;bad ip&#34;);</span><br/><span leaf="">            }</span><br/><span leaf="">        } else if (_strnicmp(line, &#34;local &#34;, 6) == 0) {</span><br/><span leaf="">            const uint32_t ip = ParseIp(line + 6);</span><br/><span leaf="">            if (ip) {</span><br/><span leaf="">                AddLocalIp(ip);</span><br/><span leaf="">                Log(&#34;added local/replace source IP = %s&#34;,</span><br/><span leaf="">                    IpToString(ip).c_str());</span><br/><span leaf="">            } else {</span><br/><span leaf="">                Log(&#34;bad ip&#34;);</span><br/><span leaf="">            }</span><br/><span leaf="">        } else if (_stricmp(line, &#34;ips&#34;) == 0) {</span><br/><span leaf="">            for (uint32_t ip : g_LocalIps) {</span><br/><span leaf="">                Log(&#34;local %s&#34;, IpToString(ip).c_str());</span><br/><span leaf="">            }</span><br/><span leaf="">        } else if (_stricmp(line, &#34;refresh&#34;) == 0) {</span><br/><span leaf="">            RefreshLocalIps();</span><br/><span leaf="">            Log(&#34;refreshed %u local IP(s)&#34;, unsigned(g_LocalIps.size()));</span><br/><span leaf="">        } else if (_stricmp(line, &#34;quit&#34;) == 0) {</span><br/><span leaf="">            g_Running = false;</span><br/><span leaf="">            break;</span><br/><span leaf="">        } else if (line[0]) {</span><br/><span leaf="">            Log(&#34;unknown command: %s&#34;, line);</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">}</span><br/><span leaf="">DWORD WINAPI WorkerThread(LPVOID) {</span><br/><span leaf="">    AllocConsole();</span><br/><span leaf="">    FILE* file = nullptr;</span><br/><span leaf="">    freopen_s(&amp;file, &#34;CONOUT$&#34;, &#34;w&#34;, stdout);</span><br/><span leaf="">    freopen_s(&amp;file, &#34;CONOUT$&#34;, &#34;w&#34;, stderr);</span><br/><span leaf="">    freopen_s(&amp;file, &#34;CONIN$&#34;, &#34;r&#34;, stdin);</span><br/><span leaf="">    SetConsoleTitleW(L&#34;ACM LAN hook&#34;);</span><br/><span leaf="">    Log(&#34;ACM LAN hook loaded&#34;);</span><br/><span leaf="">    RefreshLocalIps();</span><br/><span leaf="">    Log(&#34;local IP count: %u&#34;, unsigned(g_LocalIps.size()));</span><br/><span leaf="">    for (uint32_t ip : g_LocalIps) {</span><br/><span leaf="">        Log(&#34;local %s&#34;, IpToString(ip).c_str());</span><br/><span leaf="">    }</span><br/><span leaf="">    HMODULE wsock32 = GetModuleHandleW(L&#34;WSOCK32.dll&#34;);</span><br/><span leaf="">    if (!wsock32) {</span><br/><span leaf="">        wsock32 = LoadLibraryW(L&#34;WSOCK32.dll&#34;);</span><br/><span leaf="">    }</span><br/><span leaf="">    if (!wsock32) {</span><br/><span leaf="">        Log(&#34;failed to load WSOCK32.dll&#34;);</span><br/><span leaf="">        CommandLoop();</span><br/><span leaf="">    } else if (MH_Initialize() == MH_OK) {</span><br/><span leaf="">        HookExport(wsock32, &#34;sendto&#34;, HookSendTo,</span><br/><span leaf="">                   reinterpret_cast&lt;void**&gt;(&amp;RealSendTo));</span><br/><span leaf="">        HookExport(wsock32, &#34;recvfrom&#34;, HookRecvFrom,</span><br/><span leaf="">                   reinterpret_cast&lt;void**&gt;(&amp;RealRecvFrom));</span><br/><span leaf="">        HookExport(wsock32, &#34;bind&#34;, HookBind,</span><br/><span leaf="">                   reinterpret_cast&lt;void**&gt;(&amp;RealBind));</span><br/><span leaf="">        HookExport(wsock32, &#34;getsockname&#34;, HookGetSockName,</span><br/><span leaf="">                   reinterpret_cast&lt;void**&gt;(&amp;RealGetSockName));</span><br/><span leaf="">        HookExport(wsock32, &#34;gethostname&#34;, HookGetHostName,</span><br/><span leaf="">                   reinterpret_cast&lt;void**&gt;(&amp;RealGetHostName));</span><br/><span leaf="">        HookExport(wsock32, &#34;gethostbyname&#34;, HookGetHostByName,</span><br/><span leaf="">                   reinterpret_cast&lt;void**&gt;(&amp;RealGetHostByName));</span><br/><span leaf="">        CommandLoop();</span><br/><span leaf="">        MH_DisableHook(MH_ALL_HOOKS);</span><br/><span leaf="">        MH_Uninitialize();</span><br/><span leaf="">    } else {</span><br/><span leaf="">        Log(&#34;MH_Initialize failed&#34;);</span><br/><span leaf="">        CommandLoop();</span><br/><span leaf="">    }</span><br/><span leaf="">    Log(&#34;unloading&#34;);</span><br/><span leaf="">    FreeConsole();</span><br/><span leaf="">    FreeLibraryAndExitThread(g_Module, 0);</span><br/><span leaf="">    return 0;</span><br/><span leaf="">}</span><br/><span leaf="">}  // namespace</span><br/><span leaf="">BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,</span><br/><span leaf="">                      LPVOID lpReserved) {</span><br/><span leaf="">    switch (ul_reason_for_call) {</span><br/><span leaf="">        case DLL_PROCESS_ATTACH:</span><br/><span leaf="">            g_Module = hModule;</span><br/><span leaf="">            DisableThreadLibraryCalls(hModule);</span><br/><span leaf="">            InitializeCriticalSection(&amp;g_LogLock);</span><br/><span leaf="">            g_WorkerThread =</span><br/><span leaf="">                CreateThread(nullptr, 0, WorkerThread, nullptr, 0, nullptr);</span><br/><span leaf="">            break;</span><br/><span leaf="">        case DLL_THREAD_ATTACH:</span><br/><span leaf="">        case DLL_THREAD_DETACH:</span><br/><span leaf="">            break;</span><br/><span leaf="">        case DLL_PROCESS_DETACH:</span><br/><span leaf="">            if (lpReserved == nullptr) {</span><br/><span leaf="">                g_Running = false;</span><br/><span leaf="">            }</span><br/><span leaf="">            DeleteCriticalSection(&amp;g_LogLock);</span><br/><span leaf="">            break;</span><br/><span leaf="">    }</span><br/><span leaf="">    return TRUE;</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">关键点在这，把朋友广播过来的错误包改成正确的IP包</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    if (g_FixPayload &amp;&amp; g_ForcedIp &amp;&amp; buf &amp;&amp; len &gt; 0) {</span><br/><span leaf="">        std::vector&lt;char&gt; copy(buf, buf + len);</span><br/><span leaf="">        const int changed = ReplaceIpsInPayload(copy.data(), len, g_ForcedIp);</span><br/><span leaf="">        if (changed &gt; 0) {</span><br/><span leaf="">            Log(&#34;sendto fixed %d payload IP(s) -&gt; %s&#34;, changed,</span><br/><span leaf="">                IpToString(g_ForcedIp).c_str());</span><br/><span leaf="">            return RealSendTo(s, copy.data(), len, flags, to, tolen);</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">朋友的服务端的代码更粗暴，直接白加黑劫持游戏，把他的gethostbyname给hook了，从而发真的包给我</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">//</span><br/><span leaf="">// created by AheadLib</span><br/><span leaf="">// github:<a href="https://github.com/strivexjun/AheadLib-x86-x64" target="_blank">https://github.com/strivexjun/AheadLib-x86-x64</a></span><br/><span leaf="">//</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-z7jewz" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;windows.h&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-bbrkay" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;Shlwapi.h&gt;</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-mlnan8" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment( lib, &#34;Shlwapi.lib&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-acqamy" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:accept=_AheadLib_accept,@1&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-9faqok" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:bind=_AheadLib_bind,@2&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-ah077u" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:closesocket=_AheadLib_closesocket,@3&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-ht6m59" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:connect=_AheadLib_connect,@4&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-oficjp" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getpeername=_AheadLib_getpeername,@5&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-brr1jd" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getsockname=_AheadLib_getsockname,@6&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-7i7ua9" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getsockopt=_AheadLib_getsockopt,@7&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-hoz774" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:htonl=_AheadLib_htonl,@8&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-xaobd5" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:htons=_AheadLib_htons,@9&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-7lx9uw" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:inet_addr=_AheadLib_inet_addr,@10&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-lnuosp" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:inet_ntoa=_AheadLib_inet_ntoa,@11&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-4whkmm" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:ioctlsocket=_AheadLib_ioctlsocket,@12&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-dv78ka" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:listen=_AheadLib_listen,@13&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-ecwa6t" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:ntohl=_AheadLib_ntohl,@14&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-9kgmd1" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:ntohs=_AheadLib_ntohs,@15&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-jceamm" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:recv=_AheadLib_recv,@16&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-vei8rv" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:recvfrom=_AheadLib_recvfrom,@17&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-8z1hyo" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:select=_AheadLib_select,@18&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-0deq9r" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:send=_AheadLib_send,@19&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-z9tf2k" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:sendto=_AheadLib_sendto,@20&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-ycxt2o" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:setsockopt=_AheadLib_setsockopt,@21&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-4z1jvv" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:shutdown=_AheadLib_shutdown,@22&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-u91ijw" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:socket=_AheadLib_socket,@23&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-h21y4v" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:MigrateWinsockConfiguration=_AheadLib_MigrateWinsockConfiguration,@24&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-may13a" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:gethostbyaddr=_AheadLib_gethostbyaddr,@51&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-hmmp4z" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:gethostbyname=_AheadLib_gethostbyname,@52&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-uq10bd" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getprotobyname=_AheadLib_getprotobyname,@53&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-m0ltfb" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getprotobynumber=_AheadLib_getprotobynumber,@54&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-exfnhn" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getservbyname=_AheadLib_getservbyname,@55&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-7623oj" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getservbyport=_AheadLib_getservbyport,@56&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-z83qgl" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:gethostname=_AheadLib_gethostname,@57&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-38ql3o" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAAsyncSelect=_AheadLib_WSAAsyncSelect,@101&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-4tuzxl" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAAsyncGetHostByAddr=_AheadLib_WSAAsyncGetHostByAddr,@102&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-cnn2gf" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAAsyncGetHostByName=_AheadLib_WSAAsyncGetHostByName,@103&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-j5i77c" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAAsyncGetProtoByNumber=_AheadLib_WSAAsyncGetProtoByNumber,@104&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-6aduww" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAAsyncGetProtoByName=_AheadLib_WSAAsyncGetProtoByName,@105&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13r-o5dhev" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAAsyncGetServByPort=_AheadLib_WSAAsyncGetServByPort,@106&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-kq2r70" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAAsyncGetServByName=_AheadLib_WSAAsyncGetServByName,@107&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-3sma46" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSACancelAsyncRequest=_AheadLib_WSACancelAsyncRequest,@108&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-pfirg9" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSASetBlockingHook=_AheadLib_WSASetBlockingHook,@109&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-pj5ayr" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAUnhookBlockingHook=_AheadLib_WSAUnhookBlockingHook,@110&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-xcnxxh" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAGetLastError=_AheadLib_WSAGetLastError,@111&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-1gpfzu" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSASetLastError=_AheadLib_WSASetLastError,@112&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-x6kweu" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSACancelBlockingCall=_AheadLib_WSACancelBlockingCall,@113&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-j2r2e1" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAIsBlocking=_AheadLib_WSAIsBlocking,@114&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-6rnoa7" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSAStartup=_AheadLib_WSAStartup,@115&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-9umc6p" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSACleanup=_AheadLib_WSACleanup,@116&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-6gmcea" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:__WSAFDIsSet=_AheadLib___WSAFDIsSet,@151&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-16610f" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WEP=_AheadLib_WEP,@500&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-gjosd3" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSApSetPostRoutine=_AheadLib_WSApSetPostRoutine,@1000&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-o7qcl9" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:inet_network=_AheadLib_inet_network,@1100&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-zlze2x" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:getnetbyname=_AheadLib_getnetbyname,@1101&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-ur0kn3" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:rcmd=_AheadLib_rcmd,@1102&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-4gkmkc" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:rexec=_AheadLib_rexec,@1103&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-r7i7oa" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:rresvport=_AheadLib_rresvport,@1104&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-je8vd5" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:sethostname=_AheadLib_sethostname,@1105&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-lj7rlb" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:dn_expand=_AheadLib_dn_expand,@1106&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-buka2r" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:WSARecvEx=_AheadLib_WSARecvEx,@1107&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-rrbg4w" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:s_perror=_AheadLib_s_perror,@1108&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-btbl16" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetAddressByNameA=_AheadLib_GetAddressByNameA,@1109&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-kd5pod" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetAddressByNameW=_AheadLib_GetAddressByNameW,@1110&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-b6jr0z" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:EnumProtocolsA=_AheadLib_EnumProtocolsA,@1111&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-djhtnt" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:EnumProtocolsW=_AheadLib_EnumProtocolsW,@1112&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-71vf47" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetTypeByNameA=_AheadLib_GetTypeByNameA,@1113&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-p8d33r" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetTypeByNameW=_AheadLib_GetTypeByNameW,@1114&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-od137p" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetNameByTypeA=_AheadLib_GetNameByTypeA,@1115&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-th86ty" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetNameByTypeW=_AheadLib_GetNameByTypeW,@1116&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-zqptwo" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:SetServiceA=_AheadLib_SetServiceA,@1117&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-4m2wrv" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:SetServiceW=_AheadLib_SetServiceW,@1118&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-jx3vwf" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetServiceA=_AheadLib_GetServiceA,@1119&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-iotlgp" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetServiceW=_AheadLib_GetServiceW,@1120&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-pffrdg" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:NPLoadNameSpaces=_AheadLib_NPLoadNameSpaces,@1130&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-cwtwq9" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:TransmitFile=_AheadLib_TransmitFile,@1140&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-ey7u6e" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:AcceptEx=_AheadLib_AcceptEx,@1141&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-ixsmpv" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pragma</a> comment(linker, &#34;/EXPORT:GetAcceptExSockaddrs=_AheadLib_GetAcceptExSockaddrs,@1142&#34;)</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mpoca13s-pbzekd" style="color: #576B95 !important;" data-topic="1" data-recommend="">#include</a> &lt;string&gt;</span><br/><span leaf="">// --- ??核心 ---</span><br/><span leaf="">std::string GetTargetIPFromConfig() {</span><br/><span leaf="">    char szPath[MAX_PATH];</span><br/><span leaf="">    GetModuleFileNameA(NULL, szPath, MAX_PATH);</span><br/><span leaf="">    // 配置路?：与 exe 同目?的 hostip.config</span><br/><span leaf="">    std::string configPath = std::string(szPath).substr(0, std::string(szPath).find_last_of(&#34;\\/&#34;)) + &#34;\\hostip.config&#34;;</span><br/><span leaf="">    char szIP[64] = { 0 };</span><br/><span leaf="">    GetPrivateProfileStringA(&#34;Network&#34;, &#34;TargetIP&#34;, &#34;&#34;, szIP, sizeof(szIP), configPath.c_str());</span><br/><span leaf="">    return std::string(szIP);</span><br/><span leaf="">}</span><br/><span leaf="">extern PVOID pfnAheadLib_gethostbyname;</span><br/><span leaf="">// 核心 Hook 函?，使用 __stdcall 保??平衡</span><br/><span leaf="">extern &#34;C&#34; struct hostent* __stdcall My_gethostbyname_Hook(const char* name) {</span><br/><span leaf="">    // ?制?型??，使用全局?量 pfnAheadLib_gethostbyname</span><br/><span leaf="">    typedef struct hostent* (__stdcall *pfn_orig)(const char*);</span><br/><span leaf="">    pfn_orig pOrig = (pfn_orig)pfnAheadLib_gethostbyname;</span><br/><span leaf="">    struct hostent* pResult = pOrig(name);</span><br/><span leaf="">    std::string targetIP = GetTargetIPFromConfig();</span><br/><span leaf="">    if (!targetIP.empty()) {</span><br/><span leaf="">        unsigned long ip = inet_addr(targetIP.c_str());</span><br/><span leaf="">        if (ip != INADDR_NONE) {</span><br/><span leaf="">            if (pResult &amp;&amp; pResult-&gt;h_addrtype == AF_INET) {</span><br/><span leaf="">                // 原始请求成功，直接修改其缓存的 IP</span><br/><span leaf="">                *(unsigned long*)pResult-&gt;h_addr_list[0] = ip;</span><br/><span leaf="">            } else {</span><br/><span leaf="">                // 原始请求失败（如域名已失效），构造一个假的 hostent 结构体返回</span><br/><span leaf="">                static struct hostent fake_hostent;</span><br/><span leaf="">                static char* fake_aliases[] = { NULL };</span><br/><span leaf="">                static unsigned long fake_ip;</span><br/><span leaf="">                static char* fake_addr_list[] = { (char*)&amp;fake_ip, NULL };</span><br/><span leaf="">                static char fake_name[256];</span><br/><span leaf="">                fake_ip = ip;</span><br/><span leaf="">                if (name) {</span><br/><span leaf="">                    strncpy(fake_name, name, sizeof(fake_name) - 1);</span><br/><span leaf="">                    fake_name[sizeof(fake_name) - 1] = &#39;\0&#39;;</span><br/><span leaf="">                } else {</span><br/><span leaf="">                    fake_name[0] = &#39;\0&#39;;</span><br/><span leaf="">                }</span><br/><span leaf="">                fake_hostent.h_name = fake_name;</span><br/><span leaf="">                fake_hostent.h_aliases = fake_aliases;</span><br/><span leaf="">                fake_hostent.h_addrtype = AF_INET;</span><br/><span leaf="">                fake_hostent.h_length = 4;</span><br/><span leaf="">                fake_hostent.h_addr_list = fake_addr_list;</span><br/><span leaf="">                pResult = &amp;fake_hostent;</span><br/><span leaf="">            }</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    return pResult;</span><br/><span leaf="">}</span><br/><span leaf="">PVOID pfnAheadLib_accept;</span><br/><span leaf="">PVOID pfnAheadLib_bind;</span><br/><span leaf="">PVOID pfnAheadLib_closesocket;</span><br/><span leaf="">PVOID pfnAheadLib_connect;</span><br/><span leaf="">PVOID pfnAheadLib_getpeername;</span><br/><span leaf="">PVOID pfnAheadLib_getsockname;</span><br/><span leaf="">PVOID pfnAheadLib_getsockopt;</span><br/><span leaf="">PVOID pfnAheadLib_htonl;</span><br/><span leaf="">PVOID pfnAheadLib_htons;</span><br/><span leaf="">PVOID pfnAheadLib_inet_addr;</span><br/><span leaf="">PVOID pfnAheadLib_inet_ntoa;</span><br/><span leaf="">PVOID pfnAheadLib_ioctlsocket;</span><br/><span leaf="">PVOID pfnAheadLib_listen;</span><br/><span leaf="">PVOID pfnAheadLib_ntohl;</span><br/><span leaf="">PVOID pfnAheadLib_ntohs;</span><br/><span leaf="">PVOID pfnAheadLib_recv;</span><br/><span leaf="">PVOID pfnAheadLib_recvfrom;</span><br/><span leaf="">PVOID pfnAheadLib_select;</span><br/><span leaf="">PVOID pfnAheadLib_send;</span><br/><span leaf="">PVOID pfnAheadLib_sendto;</span><br/><span leaf="">PVOID pfnAheadLib_setsockopt;</span><br/><span leaf="">PVOID pfnAheadLib_shutdown;</span><br/><span leaf="">PVOID pfnAheadLib_socket;</span><br/><span leaf="">PVOID pfnAheadLib_MigrateWinsockConfiguration;</span><br/><span leaf="">PVOID pfnAheadLib_gethostbyaddr;</span><br/><span leaf="">PVOID pfnAheadLib_gethostbyname;</span><br/><span leaf="">PVOID pfnAheadLib_getprotobyname;</span><br/><span leaf="">PVOID pfnAheadLib_getprotobynumber;</span><br/><span leaf="">PVOID pfnAheadLib_getservbyname;</span><br/><span leaf="">PVOID pfnAheadLib_getservbyport;</span><br/><span leaf="">PVOID pfnAheadLib_gethostname;</span><br/><span leaf="">PVOID pfnAheadLib_WSAAsyncSelect;</span><br/><span leaf="">PVOID pfnAheadLib_WSAAsyncGetHostByAddr;</span><br/><span leaf="">PVOID pfnAheadLib_WSAAsyncGetHostByName;</span><br/><span leaf="">PVOID pfnAheadLib_WSAAsyncGetProtoByNumber;</span><br/><span leaf="">PVOID pfnAheadLib_WSAAsyncGetProtoByName;</span><br/><span leaf="">PVOID pfnAheadLib_WSAAsyncGetServByPort;</span><br/><span leaf="">PVOID pfnAheadLib_WSAAsyncGetServByName;</span><br/><span leaf="">PVOID pfnAheadLib_WSACancelAsyncRequest;</span><br/><span leaf="">PVOID pfnAheadLib_WSASetBlockingHook;</span><br/><span leaf="">PVOID pfnAheadLib_WSAUnhookBlockingHook;</span><br/><span leaf="">PVOID pfnAheadLib_WSAGetLastError;</span><br/><span leaf="">PVOID pfnAheadLib_WSASetLastError;</span><br/><span leaf="">PVOID pfnAheadLib_WSACancelBlockingCall;</span><br/><span leaf="">PVOID pfnAheadLib_WSAIsBlocking;</span><br/><span leaf="">PVOID pfnAheadLib_WSAStartup;</span><br/><span leaf="">PVOID pfnAheadLib_WSACleanup;</span><br/><span leaf="">PVOID pfnAheadLib___WSAFDIsSet;</span><br/><span leaf="">PVOID pfnAheadLib_WEP;</span><br/><span leaf="">PVOID pfnAheadLib_WSApSetPostRoutine;</span><br/><span leaf="">PVOID pfnAheadLib_inet_network;</span><br/><span leaf="">PVOID pfnAheadLib_getnetbyname;</span><br/><span leaf="">PVOID pfnAheadLib_rcmd;</span><br/><span leaf="">PVOID pfnAheadLib_rexec;</span><br/><span leaf="">PVOID pfnAheadLib_rresvport;</span><br/><span leaf="">PVOID pfnAheadLib_sethostname;</span><br/><span leaf="">PVOID pfnAheadLib_dn_expand;</span><br/><span leaf="">PVOID pfnAheadLib_WSARecvEx;</span><br/><span leaf="">PVOID pfnAheadLib_s_perror;</span><br/><span leaf="">PVOID pfnAheadLib_GetAddressByNameA;</span><br/><span leaf="">PVOID pfnAheadLib_GetAddressByNameW;</span><br/><span leaf="">PVOID pfnAheadLib_EnumProtocolsA;</span><br/><span leaf="">PVOID pfnAheadLib_EnumProtocolsW;</span><br/><span leaf="">PVOID pfnAheadLib_GetTypeByNameA;</span><br/><span leaf="">PVOID pfnAheadLib_GetTypeByNameW;</span><br/><span leaf="">PVOID pfnAheadLib_GetNameByTypeA;</span><br/><span leaf="">PVOID pfnAheadLib_GetNameByTypeW;</span><br/><span leaf="">PVOID pfnAheadLib_SetServiceA;</span><br/><span leaf="">PVOID pfnAheadLib_SetServiceW;</span><br/><span leaf="">PVOID pfnAheadLib_GetServiceA;</span><br/><span leaf="">PVOID pfnAheadLib_GetServiceW;</span><br/><span leaf="">PVOID pfnAheadLib_NPLoadNameSpaces;</span><br/><span leaf="">PVOID pfnAheadLib_TransmitFile;</span><br/><span leaf="">PVOID pfnAheadLib_AcceptEx;</span><br/><span leaf="">PVOID pfnAheadLib_GetAcceptExSockaddrs;</span><br/><span leaf="">static</span><br/><span leaf="">HMODULE g_OldModule = NULL;</span><br/><span leaf="">VOID WINAPI Free()</span><br/><span leaf="">{</span><br/><span leaf="">    if (g_OldModule)</span><br/><span leaf="">    {</span><br/><span leaf="">        FreeLibrary(g_OldModule);</span><br/><span leaf="">    }</span><br/><span leaf="">}</span><br/><span leaf="">BOOL WINAPI Load()</span><br/><span leaf="">{</span><br/><span leaf="">    TCHAR tzPath[MAX_PATH];</span><br/><span leaf="">    TCHAR tzTemp[MAX_PATH * 2];</span><br/><span leaf="">    //</span><br/><span leaf="">    // ?里是否?系?目?或?前目?加?原始DLL</span><br/><span leaf="">    //</span><br/><span leaf="">    //GetModuleFileName(NULL,tzPath,MAX_PATH); //?取本目?下的</span><br/><span leaf="">    //PathRemoveFileSpec(tzPath);</span><br/><span leaf="">    GetSystemDirectory(tzPath, MAX_PATH); //默??取系?目?的</span><br/><span leaf="">    lstrcat(tzPath, TEXT(&#34;\\wsock32.dll&#34;));</span><br/><span leaf="">    g_OldModule = LoadLibrary(tzPath);</span><br/><span leaf="">    if (g_OldModule == NULL)</span><br/><span leaf="">    {</span><br/><span leaf="">        wsprintf(tzTemp, TEXT(&#34;?法找到模? %s,程序?法正常?行&#34;), tzPath);</span><br/><span leaf="">        MessageBox(NULL, tzTemp, TEXT(&#34;AheadLib&#34;), MB_ICONSTOP);</span><br/><span leaf="">    }</span><br/><span leaf="">    return (g_OldModule != NULL);</span><br/><span leaf="">}</span><br/><span leaf="">FARPROC WINAPI GetAddress(PCSTR pszProcName)</span><br/><span leaf="">{</span><br/><span leaf="">    FARPROC fpAddress;</span><br/><span leaf="">    CHAR szProcName[64];</span><br/><span leaf="">    TCHAR tzTemp[MAX_PATH];</span><br/><span leaf="">    fpAddress = GetProcAddress(g_OldModule, pszProcName);</span><br/><span leaf="">    if (fpAddress == NULL)</span><br/><span leaf="">    {</span><br/><span leaf="">        if (HIWORD(pszProcName) == 0)</span><br/><span leaf="">        {</span><br/><span leaf="">            wsprintfA(szProcName, &#34;#%d&#34;, pszProcName);</span><br/><span leaf="">            pszProcName = szProcName;</span><br/><span leaf="">        }</span><br/><span leaf="">        wsprintf(tzTemp, TEXT(&#34;?法找到函? %hs,程序?法正常?行&#34;), pszProcName);</span><br/><span leaf="">        MessageBox(NULL, tzTemp, TEXT(&#34;AheadLib&#34;), MB_ICONSTOP);</span><br/><span leaf="">        ExitProcess(-2);</span><br/><span leaf="">    }</span><br/><span leaf="">    return fpAddress;</span><br/><span leaf="">}</span><br/><span leaf="">BOOL WINAPI Init()</span><br/><span leaf="">{</span><br/><span leaf="">    pfnAheadLib_accept = GetAddress(&#34;accept&#34;);</span><br/><span leaf="">    pfnAheadLib_bind = GetAddress(&#34;bind&#34;);</span><br/><span leaf="">    pfnAheadLib_closesocket = GetAddress(&#34;closesocket&#34;);</span><br/><span leaf="">    pfnAheadLib_connect = GetAddress(&#34;connect&#34;);</span><br/><span leaf="">    pfnAheadLib_getpeername = GetAddress(&#34;getpeername&#34;);</span><br/><span leaf="">    pfnAheadLib_getsockname = GetAddress(&#34;getsockname&#34;);</span><br/><span leaf="">    pfnAheadLib_getsockopt = GetAddress(&#34;getsockopt&#34;);</span><br/><span leaf="">    pfnAheadLib_htonl = GetAddress(&#34;htonl&#34;);</span><br/><span leaf="">    pfnAheadLib_htons = GetAddress(&#34;htons&#34;);</span><br/><span leaf="">    pfnAheadLib_inet_addr = GetAddress(&#34;inet_addr&#34;);</span><br/><span leaf="">    pfnAheadLib_inet_ntoa = GetAddress(&#34;inet_ntoa&#34;);</span><br/><span leaf="">    pfnAheadLib_ioctlsocket = GetAddress(&#34;ioctlsocket&#34;);</span><br/><span leaf="">    pfnAheadLib_listen = GetAddress(&#34;listen&#34;);</span><br/><span leaf="">    pfnAheadLib_ntohl = GetAddress(&#34;ntohl&#34;);</span><br/><span leaf="">    pfnAheadLib_ntohs = GetAddress(&#34;ntohs&#34;);</span><br/><span leaf="">    pfnAheadLib_recv = GetAddress(&#34;recv&#34;);</span><br/><span leaf="">    pfnAheadLib_recvfrom = GetAddress(&#34;recvfrom&#34;);</span><br/><span leaf="">    pfnAheadLib_select = GetAddress(&#34;select&#34;);</span><br/><span leaf="">    pfnAheadLib_send = GetAddress(&#34;send&#34;);</span><br/><span leaf="">    pfnAheadLib_sendto = GetAddress(&#34;sendto&#34;);</span><br/><span leaf="">    pfnAheadLib_setsockopt = GetAddress(&#34;setsockopt&#34;);</span><br/><span leaf="">    pfnAheadLib_shutdown = GetAddress(&#34;shutdown&#34;);</span><br/><span leaf="">    pfnAheadLib_socket = GetAddress(&#34;socket&#34;);</span><br/><span leaf="">    pfnAheadLib_MigrateWinsockConfiguration = GetAddress(&#34;MigrateWinsockConfiguration&#34;);</span><br/><span leaf="">    pfnAheadLib_gethostbyaddr = GetAddress(&#34;gethostbyaddr&#34;);</span><br/><span leaf="">    pfnAheadLib_gethostbyname = GetAddress(&#34;gethostbyname&#34;);</span><br/><span leaf="">    pfnAheadLib_getprotobyname = GetAddress(&#34;getprotobyname&#34;);</span><br/><span leaf="">    pfnAheadLib_getprotobynumber = GetAddress(&#34;getprotobynumber&#34;);</span><br/><span leaf="">    pfnAheadLib_getservbyname = GetAddress(&#34;getservbyname&#34;);</span><br/><span leaf="">    pfnAheadLib_getservbyport = GetAddress(&#34;getservbyport&#34;);</span><br/><span leaf="">    pfnAheadLib_gethostname = GetAddress(&#34;gethostname&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAAsyncSelect = GetAddress(&#34;WSAAsyncSelect&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAAsyncGetHostByAddr = GetAddress(&#34;WSAAsyncGetHostByAddr&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAAsyncGetHostByName = GetAddress(&#34;WSAAsyncGetHostByName&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAAsyncGetProtoByNumber = GetAddress(&#34;WSAAsyncGetProtoByNumber&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAAsyncGetProtoByName = GetAddress(&#34;WSAAsyncGetProtoByName&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAAsyncGetServByPort = GetAddress(&#34;WSAAsyncGetServByPort&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAAsyncGetServByName = GetAddress(&#34;WSAAsyncGetServByName&#34;);</span><br/><span leaf="">    pfnAheadLib_WSACancelAsyncRequest = GetAddress(&#34;WSACancelAsyncRequest&#34;);</span><br/><span leaf="">    pfnAheadLib_WSASetBlockingHook = GetAddress(&#34;WSASetBlockingHook&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAUnhookBlockingHook = GetAddress(&#34;WSAUnhookBlockingHook&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAGetLastError = GetAddress(&#34;WSAGetLastError&#34;);</span><br/><span leaf="">    pfnAheadLib_WSASetLastError = GetAddress(&#34;WSASetLastError&#34;);</span><br/><span leaf="">    pfnAheadLib_WSACancelBlockingCall = GetAddress(&#34;WSACancelBlockingCall&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAIsBlocking = GetAddress(&#34;WSAIsBlocking&#34;);</span><br/><span leaf="">    pfnAheadLib_WSAStartup = GetAddress(&#34;WSAStartup&#34;);</span><br/><span leaf="">    pfnAheadLib_WSACleanup = GetAddress(&#34;WSACleanup&#34;);</span><br/><span leaf="">    pfnAheadLib___WSAFDIsSet = GetAddress(&#34;__WSAFDIsSet&#34;);</span><br/><span leaf="">    pfnAheadLib_WEP = GetAddress(&#34;WEP&#34;);</span><br/><span leaf="">    pfnAheadLib_WSApSetPostRoutine = GetAddress(&#34;WSApSetPostRoutine&#34;);</span><br/><span leaf="">    pfnAheadLib_inet_network = GetAddress(&#34;inet_network&#34;);</span><br/><span leaf="">    pfnAheadLib_getnetbyname = GetAddress(&#34;getnetbyname&#34;);</span><br/><span leaf="">    pfnAheadLib_rcmd = GetAddress(&#34;rcmd&#34;);</span><br/><span leaf="">    pfnAheadLib_rexec = GetAddress(&#34;rexec&#34;);</span><br/><span leaf="">    pfnAheadLib_rresvport = GetAddress(&#34;rresvport&#34;);</span><br/><span leaf="">    pfnAheadLib_sethostname = GetAddress(&#34;sethostname&#34;);</span><br/><span leaf="">    pfnAheadLib_dn_expand = GetAddress(&#34;dn_expand&#34;);</span><br/><span leaf="">    pfnAheadLib_WSARecvEx = GetAddress(&#34;WSARecvEx&#34;);</span><br/><span leaf="">    pfnAheadLib_s_perror = GetAddress(&#34;s_perror&#34;);</span><br/><span leaf="">    pfnAheadLib_GetAddressByNameA = GetAddress(&#34;GetAddressByNameA&#34;);</span><br/><span leaf="">    pfnAheadLib_GetAddressByNameW = GetAddress(&#34;GetAddressByNameW&#34;);</span><br/><span leaf="">    pfnAheadLib_EnumProtocolsA = GetAddress(&#34;EnumProtocolsA&#34;);</span><br/><span leaf="">    pfnAheadLib_EnumProtocolsW = GetAddress(&#34;EnumProtocolsW&#34;);</span><br/><span leaf="">    pfnAheadLib_GetTypeByNameA = GetAddress(&#34;GetTypeByNameA&#34;);</span><br/><span leaf="">    pfnAheadLib_GetTypeByNameW = GetAddress(&#34;GetTypeByNameW&#34;);</span><br/><span leaf="">    pfnAheadLib_GetNameByTypeA = GetAddress(&#34;GetNameByTypeA&#34;);</span><br/><span leaf="">    pfnAheadLib_GetNameByTypeW = GetAddress(&#34;GetNameByTypeW&#34;);</span><br/><span leaf="">    pfnAheadLib_SetServiceA = GetAddress(&#34;SetServiceA&#34;);</span><br/><span leaf="">    pfnAheadLib_SetServiceW = GetAddress(&#34;SetServiceW&#34;);</span><br/><span leaf="">    pfnAheadLib_GetServiceA = GetAddress(&#34;GetServiceA&#34;);</span><br/><span leaf="">    pfnAheadLib_GetServiceW = GetAddress(&#34;GetServiceW&#34;);</span><br/><span leaf="">    pfnAheadLib_NPLoadNameSpaces = GetAddress(&#34;NPLoadNameSpaces&#34;);</span><br/><span leaf="">    pfnAheadLib_TransmitFile = GetAddress(&#34;TransmitFile&#34;);</span><br/><span leaf="">    pfnAheadLib_AcceptEx = GetAddress(&#34;AcceptEx&#34;);</span><br/><span leaf="">    pfnAheadLib_GetAcceptExSockaddrs = GetAddress(&#34;GetAcceptExSockaddrs&#34;);</span><br/><span leaf="">    return TRUE;</span><br/><span leaf="">}    </span><br/><span leaf="">DWORD WINAPI ThreadProc(LPVOID lpThreadParameter)</span><br/><span leaf="">{</span><br/><span leaf="">    HANDLE hProcess;</span><br/><span leaf="">    PVOID addr1 = reinterpret_cast&lt;PVOID&gt;(0x00401000);</span><br/><span leaf="">    BYTE data1[] = { 0x90, 0x90, 0x90, 0x90 };</span><br/><span leaf="">    //</span><br/><span leaf="">    // ??VMP3.x 的?存保?</span><br/><span leaf="">    //</span><br/><span leaf="">    hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, GetCurrentProcessId());</span><br/><span leaf="">    if (hProcess)</span><br/><span leaf="">    {</span><br/><span leaf="">        WriteProcessMemory(hProcess, addr1, data1, sizeof(data1), NULL);</span><br/><span leaf="">        CloseHandle(hProcess);</span><br/><span leaf="">    }</span><br/><span leaf="">    return 0;</span><br/><span leaf="">}</span><br/><span leaf="">BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved)</span><br/><span leaf="">{</span><br/><span leaf="">    if (dwReason == DLL_PROCESS_ATTACH)</span><br/><span leaf="">    {</span><br/><span leaf="">        DisableThreadLibraryCalls(hModule);</span><br/><span leaf="">        if (Load() &amp;&amp; Init())</span><br/><span leaf="">        {</span><br/><span leaf="">            TCHAR szAppName[MAX_PATH] = TEXT(&#34;MyApp.exe&#34;);//?修改宿主?程名</span><br/><span leaf="">            TCHAR szCurName[MAX_PATH];</span><br/><span leaf="">            GetModuleFileName(NULL, szCurName, MAX_PATH);</span><br/><span leaf="">            PathStripPath(szCurName);</span><br/><span leaf="">            //是否判?宿主?程名</span><br/><span leaf="">            if (StrCmpI(szCurName, szAppName) == 0)</span><br/><span leaf="">            {</span><br/><span leaf="">                //???丁?程或者其他操作</span><br/><span leaf="">                HANDLE hThread = CreateThread(NULL, NULL, ThreadProc, NULL, NULL, NULL);</span><br/><span leaf="">                if (hThread)</span><br/><span leaf="">                {</span><br/><span leaf="">                    CloseHandle(hThread);</span><br/><span leaf="">                }</span><br/><span leaf="">            }</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    else if (dwReason == DLL_PROCESS_DETACH)</span><br/><span leaf="">    {</span><br/><span leaf="">        Free();</span><br/><span leaf="">    }</span><br/><span leaf="">    return TRUE;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_accept(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_accept;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_bind(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_bind;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_closesocket(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_closesocket;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_connect(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_connect;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getpeername(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getpeername;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getsockname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getsockname;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getsockopt(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getsockopt;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_htonl(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_htonl;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_htons(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_htons;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_inet_addr(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_inet_addr;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_inet_ntoa(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_inet_ntoa;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_ioctlsocket(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_ioctlsocket;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_listen(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_listen;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_ntohl(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_ntohl;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_ntohs(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_ntohs;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_recv(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_recv;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_recvfrom(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_recvfrom;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_select(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_select;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_send(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_send;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_sendto(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_sendto;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_setsockopt(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_setsockopt;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_shutdown(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_shutdown;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_socket(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_socket;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_MigrateWinsockConfiguration(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_MigrateWinsockConfiguration;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_gethostbyaddr(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_gethostbyaddr;</span><br/><span leaf="">}</span><br/><span leaf="">/*</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_gethostbyname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_gethostbyname;</span><br/><span leaf="">}</span><br/><span leaf="">*/</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getprotobyname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getprotobyname;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getprotobynumber(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getprotobynumber;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getservbyname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getservbyname;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getservbyport(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getservbyport;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_gethostname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_gethostname;</span><br/><span leaf="">}</span><br/><span leaf="">// 修改原本的 naked ??</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_gethostbyname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm {</span><br/><span leaf="">        push [esp+4]    // ?入??</span><br/><span leaf="">        call My_gethostbyname_Hook</span><br/><span leaf="">        ret 4           // 恢复?平衡</span><br/><span leaf="">    }</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAAsyncSelect(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAAsyncSelect;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAAsyncGetHostByAddr(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAAsyncGetHostByAddr;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAAsyncGetHostByName(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAAsyncGetHostByName;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAAsyncGetProtoByNumber(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAAsyncGetProtoByNumber;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAAsyncGetProtoByName(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAAsyncGetProtoByName;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAAsyncGetServByPort(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAAsyncGetServByPort;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAAsyncGetServByName(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAAsyncGetServByName;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSACancelAsyncRequest(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSACancelAsyncRequest;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSASetBlockingHook(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSASetBlockingHook;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAUnhookBlockingHook(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAUnhookBlockingHook;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAGetLastError(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAGetLastError;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSASetLastError(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSASetLastError;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSACancelBlockingCall(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSACancelBlockingCall;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAIsBlocking(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAIsBlocking;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSAStartup(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSAStartup;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSACleanup(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSACleanup;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib___WSAFDIsSet(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib___WSAFDIsSet;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WEP(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WEP;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSApSetPostRoutine(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSApSetPostRoutine;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_inet_network(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_inet_network;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_getnetbyname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_getnetbyname;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_rcmd(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_rcmd;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_rexec(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_rexec;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_rresvport(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_rresvport;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_sethostname(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_sethostname;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_dn_expand(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_dn_expand;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_WSARecvEx(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_WSARecvEx;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_s_perror(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_s_perror;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetAddressByNameA(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetAddressByNameA;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetAddressByNameW(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetAddressByNameW;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_EnumProtocolsA(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_EnumProtocolsA;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_EnumProtocolsW(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_EnumProtocolsW;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetTypeByNameA(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetTypeByNameA;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetTypeByNameW(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetTypeByNameW;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetNameByTypeA(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetNameByTypeA;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetNameByTypeW(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetNameByTypeW;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_SetServiceA(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_SetServiceA;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_SetServiceW(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_SetServiceW;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetServiceA(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetServiceA;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetServiceW(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetServiceW;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_NPLoadNameSpaces(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_NPLoadNameSpaces;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_TransmitFile(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_TransmitFile;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_AcceptEx(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_AcceptEx;</span><br/><span leaf="">}</span><br/><span leaf="">EXTERN_C __declspec(naked) void __cdecl AheadLib_GetAcceptExSockaddrs(void)</span><br/><span leaf="">{</span><br/><span leaf="">    __asm jmp pfnAheadLib_GetAcceptExSockaddrs;</span><br/><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">关键点:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">// 核心 Hook 函?，使用 __stdcall 保??平衡</span><br/><span leaf="">extern &#34;C&#34; struct hostent* __stdcall My_gethostbyname_Hook(const char* name) {</span><br/><span leaf="">    // ?制?型??，使用全局?量 pfnAheadLib_gethostbyname</span><br/><span leaf="">    typedef struct hostent* (__stdcall *pfn_orig)(const char*);</span><br/><span leaf="">    pfn_orig pOrig = (pfn_orig)pfnAheadLib_gethostbyname;</span><br/><span leaf="">    struct hostent* pResult = pOrig(name);</span><br/><span leaf="">    std::string targetIP = GetTargetIPFromConfig();</span><br/><span leaf="">    if (!targetIP.empty()) {</span><br/><span leaf="">        unsigned long ip = inet_addr(targetIP.c_str());</span><br/><span leaf="">        if (ip != INADDR_NONE) {</span><br/><span leaf="">            if (pResult &amp;&amp; pResult-&gt;h_addrtype == AF_INET) {</span><br/><span leaf="">                // 原始请求成功，直接修改其缓存的 IP</span><br/><span leaf="">                *(unsigned long*)pResult-&gt;h_addr_list[0] = ip;</span><br/><span leaf="">            } else {</span><br/><span leaf="">                // 原始请求失败（如域名已失效），构造一个假的 hostent 结构体返回</span><br/><span leaf="">                static struct hostent fake_hostent;</span><br/><span leaf="">                static char* fake_aliases[] = { NULL };</span><br/><span leaf="">                static unsigned long fake_ip;</span><br/><span leaf="">                static char* fake_addr_list[] = { (char*)&amp;fake_ip, NULL };</span><br/><span leaf="">                static char fake_name[256];</span><br/><span leaf="">                fake_ip = ip;</span><br/><span leaf="">                if (name) {</span><br/><span leaf="">                    strncpy(fake_name, name, sizeof(fake_name) - 1);</span><br/><span leaf="">                    fake_name[sizeof(fake_name) - 1] = &#39;\0&#39;;</span><br/><span leaf="">                } else {</span><br/><span leaf="">                    fake_name[0] = &#39;\0&#39;;</span><br/><span leaf="">                }</span><br/><span leaf="">                fake_hostent.h_name = fake_name;</span><br/><span leaf="">                fake_hostent.h_aliases = fake_aliases;</span><br/><span leaf="">                fake_hostent.h_addrtype = AF_INET;</span><br/><span leaf="">                fake_hostent.h_length = 4;</span><br/><span leaf="">                fake_hostent.h_addr_list = fake_addr_list;</span><br/><span leaf="">                pResult = &amp;fake_hostent;</span><br/><span leaf="">            }</span><br/><span leaf="">        }</span><br/><span leaf="">    }</span><br/><span leaf="">    return pResult;</span><br/><span leaf="">}</span></code></pre><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: inherit;font-weight: 500;line-height: 1.2;color: inherit;font-size: 2rem;"><span leaf="">结论</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">通过这样修改后，我们终于可以愉快联机了</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002635" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=b12257c7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVM7qHBez1X3xcObfvDxMXrHgFwcyyyJh7W9T65jicMBZQmEt4o7riaQouRCtEhN6ahCIHplo2699Pt6SfQ9oEyGsKyLRh66U4JYM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">要是以后有人玩《Aliens: Colonial Marines》出现一样的问题，可以看看这个咋修。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=0cdd60c1&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486286%26idx%3D1%26sn%3D5741b86043e4a5c0c73d97cdf00bda3d">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 28 May 2026 08:00:00 +0800</pubDate>
    </item>
    <item>
      <title>基于大模型的下一代杀毒引擎</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486252&amp;idx=1&amp;sn=8a7ed24b88b3aed80eddd37ff0309487</link>
      <description>前言在2025年的时候，我发布了云端的病毒分析引擎demo:基于大模型的病毒木马文件云鉴定今年，我决定更进一步</description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-05-25 08:00</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a0eec1d0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVMVicrB4I7S5kAFZgDOx9eJHkTW2ZCc9OJibAA3pPvibCicZXdvtvMS7ribzWE2chj0c2Z0S7ibYK9eZE8vSexhLppw9ruW2WAcn5FUs%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在2025年的时候，我发布了云端的病毒分析引擎demo:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485757&amp;idx=1&amp;sn=6a9abd8c76b5537f73f64671ff48a7e7&amp;scene=21#wechat_redirect" textvalue="基于大模型的病毒木马文件云鉴定" data-itemshowtype="0" linktype="text" data-linktype="2">基于大模型的病毒木马文件云鉴定</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">今年，我决定更进一步开发一下大模型在安全行业运用，于是在年初做了这个下一代杀毒引擎。在这里分享一下我的一些思路和见解。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如何定义下一代?</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">杀毒引擎本质上只做两件事，标记是恶意的木马同时不要误报。在经历特征码，广谱特征码，发展到所谓的AI杀毒，虚拟执行杀毒等。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">而我们的”当前代”的问题是，他的误报越来越大，经过长时间的对抗，到演变成了所谓的非白即黑以及人工响应拉黑速度快慢去决定一个杀毒引擎的质量。并且本地病毒库越来越臃肿。并且对新型病毒无法防御。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而所谓下一代，每个人定义不一样，我的定义是指的是“能自我进化”(需要指出并不是传统native ml的那种拿什么PE区段与代码段比例，PE熵什么的玩意，而是指真正理解代码)，”廉价”，”对未知病毒查杀效果好，长时间不用更新病毒库也能查杀”，”廉价”</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">“大模型”推理的缺点</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">那你会觉得，那大模型做这个很合适，只需要我们云端接一个反编译引擎，然后把二进制代码吐给大模型就行了。对，但是也错。用大模型做推理会有几个严重的问题</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">性能损耗极大</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">杀毒厂商可能一天收获起码100w+的样本,廉价的沙箱都跑不过来,大模型推理的成本比沙箱贵了不止一个数量级,价格是工程化必须考虑的因素。一次反编译+推理的时间，一天开100台推理服务器可能都无法解决问题</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">模型随机性</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">由于模型并没有系统学习过恶意代码分析，他们会因为各种问题报恶意代码，比如给crt报恶意代码，并且模型受提示词影响极大。同样一份代码可能提示词不同模型出问题的概率也不同。</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">必须云端工作</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">由于大模型在云端才有可能部署，所以实时性不是特别好，也就是说新型样本到多久才检测是完全未知的。并且模型的推理延迟极高，可能几十分钟才能发现一个样本</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">下一代杀毒引擎</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">为了解决上面的问题从而实现工程真正可用落地。我们需要从客户端和模型入手。以下是我的思路</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">模型二开</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">LLM最大的问题，是他的输出，他是通过lm_head循环计算下一个token输出的，这个过程耗时极大，而且输入的不确定性让他会随机胡言乱语。因此我们要用到大模型的语言理解能力，但是不要他的文本输出。本质上他要做两个改法，一个是把lm_head去掉变成cls_head 也就是一个”Classification Head”这样他就会输出0-1之间的概率,1代表是病毒,0代表是正常文件(是不是很熟悉?)</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002571" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ab4e4e8c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNd0PCARrrjlvec1jz8uYmuiaEKD1kvuVeMiby8Smz4icPGa8umyJMEtrcKU2QF7CW4m72iazllfTj0VZgF1FEEabYcTkwjKibMzwKU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">把大模型改成 0/1 输出，在杀毒或安全过滤场景下比传统的“生成式回答”好太多了：</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">速度极快，节省算力：大模型最耗时的地方在于自回归生成，即吐出 100 个字需要模型前向传播 100 次。而改成 0/1 输出属于单次前向传播，模型把整段代码吞进去，只计算一次就直接出结果了，速度提升几十甚至上百倍。</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">绝对不会“胡说八道”：如果用原生的 lm_head 问模型：“这段代码是病毒吗？”，模型可能会长篇大论，甚至找借口，或者在概率临界点时给出含糊其辞的答案。改成 Bool 输出后，它没有任何组织语言的自由，只能铁面无私地给出一个概率值。</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">解析极其简单：对于杀毒软件来说，处理一个 0 或 1 的布尔值，比用正则表达式去解析模型输出的自然语言段落要稳定得多。</span></p></li></ol><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">具体做法是，我们先生成一些病毒/白文件的数据，包含他的伪码和对应的家族</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002575" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=60ba3287&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMX3Y4dToy7PicdyDibCJnp7v1udiaiaBvOAaU5A4LYeuvEeMlDCwNY3XAyBbNHgnULxImUKghQ3hZwd1NwFUUZsaHOXvckf09beRM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">伪码怎么来的看下文</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后去缝合模型,选一个你喜欢的模型都行,只需要理解代码就行，实测这块不需要很大的模型参数就能理解代码了。小一点的甚至是PC电脑的CPU都能带起来比如UniXcoder。当然模型大一点没坏处，越大效果越好</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">过小的模型会导致不理解世界事实从而误报，比如代码可能是mimikatz的代码，但是小模型不知道什么是mimikatz，就会判定为正常</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后就是正常训练，没什么。就做完了。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">但是这套技术的重点并不在模型端，而是在客户端，因为我们最终的目的是要实现客户端可用的技术，做到实时查杀，实时防护。而且客户端提交的token是决定能不能杀出来的关键。</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">客户端反编译器</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这玩意跟”传统”把样本塞到云端最大的不同是，我们要做客户端的推理。云端固然好，但是还是那句话，太贵了。实话说，这个推理模型就一个星期差不多搞完了，而客户端花了大概两年。他本质上是一个22M大小的IDA，不过反编译速度和效率比IDA快了不止一个数量级.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002583" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=f567c21f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNDibNQ3PPyWRaacphxsXLIZTxTRiaddnibF8YfQiaZlTNLPle36xNMPrvYiadRDmW91SsU5Kicm7jO4s39ytOuYfGu2IS2ybpwOeNoE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">支持GO/RUST/c++/ARM/ARM64/DOTNET反编译,感谢AI,虽然到目前发帖为止,AI还是基本不咋懂这块咋写,但是只要提示词严格要求,AI就能做,相当于实习生一样:</span></strong><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">他的效果看起来是这样的:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002589" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=4dba37f7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNE9mrDrGNkZfyX2s3NGZzYMBxy3hm4Ar0Gb4ZRwJBGOu894okq3QjrskoDkKZY5l9voR1RCcpYmNFBw9vWoib9FupVn39rgQA0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">之前的反编译器编写流程:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247484622&amp;idx=1&amp;sn=6849577c509c4243bf45ddfd1c66fe37&amp;scene=21#wechat_redirect" textvalue="IDA背后的原理入门(一): 简介&amp;函数识别" data-itemshowtype="0" linktype="text" data-linktype="2">IDA背后的原理入门(一): 简介&amp;函数识别</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485332&amp;idx=1&amp;sn=25ef87ab7af839c54e8e4727bfd045cb&amp;scene=21#wechat_redirect" textvalue="从0制作IDA的F5代码还原功能(hex-rays插件) 上" data-itemshowtype="0" linktype="text" data-linktype="2">从0制作IDA的F5代码还原功能(hex-rays插件) 上</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">工程上我发现，他的难点不在于如何复刻一个IDA，而是如何”找到”恶意代码并且最小的不占用带宽的上传，否则服务器都快被打死了。而且token和推理费用直接挂钩。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这里只说关键技术点。</span></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">找异常</span></h4><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">跟IDA不同的是，我们无法做到把一个程序完整的反编译然后丢给大模型，因为成本和效率并不允许，所以我们需要找异常。而异常由规则驱动，只丢有问题的函数，这块我本来想做TF-IDF的，但是想了想没必要，之前我们做过：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247484551&amp;idx=1&amp;sn=4e0edcc586ec733f9d3a8b0ba93b9069&amp;scene=21#wechat_redirect" textvalue="2024年终: 木马病毒自动化特征提取&amp;云端机器学习的思路分享" data-itemshowtype="0" linktype="text" data-linktype="2">2024年终: 木马病毒自动化特征提取&amp;云端机器学习的思路分享</a><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002590" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ef02bc9d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMtSvBK94sVFlFdlZ9RRdYDjcXZnTugiacQyHXEzdwV7mf6BzTAiaCd9Uia87GRLmmopkicZGicYDVxzcMIibA0ibEMplsfC4akv8ZEs0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002594" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=f062c0fe&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOJ7fatzAibAJm4rtfnuiaZznP7fCa8W6LNicb1cHQUcQmf7uo1DkjPa8k6Fqiaw93HEpHYpygNwpjH8KDxr6icjGxI88epaXTnt8K4%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">极致压缩&amp;优化</span></h4><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个是最麻烦的地方，我们需要给模型压缩后的片段，否则太长的代码对任何没好处，这里的优化指的并不是ssa那种不破坏语义的优化，指的是我们给破坏性代码，只给模型关键的。这里是最麻烦的部分，因为压多了模型识别不出来，压少了模型上下文直接爆了。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">压少了:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002595" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=67c89991&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNBibXZwN0sPmn83bnkGftlW9oJJt5qAk5RAHHiaSSFRMiania4owhpckwEicUCT3Koiad7pfSoBCs9Ricy9X0nvFe9Qwl95jHJqibL2tQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">正确的压缩:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002596" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=365ba5a0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVN3mXtWYuZxJoPItB0elcxY7Y7vLLtC4ZykwzUrZnIFZCr5g3LA3Xb3Pw7kXicD184VRmY1VTK3lHvRQreRl8egFobH57rleS7A%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这块就不展开细说了,坑非常多.</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结论</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">简单测试一下效率和速度:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002597" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=649fb4c5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNnDJTyDVnBg79W5vx7gLjVGgDUWs3nryr0icrL2AAqyuMbRWNFFPaibuLLpfPvz4iaVZFKaNOgEkFSYHLLDvNGib6fqiaRcvvd0BOg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">大概3.4秒不到分析出一个样本，还是因为测试时候用HTTP通讯的方式，换成内部通讯方式就正常了:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002572" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9a0998d0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPwJRzBlZT4BxYxboUnc45UO3tpKPibaR6icpXegfsBxTGHKdRLc2djC2JeglJGXPRLN21p4dnTXvA2s1HkiceicMDQUwMgSNicC634%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002570" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=92566fc3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPbpoNKEqwd8624FI8cVu9MmsJ5iba9xyOzyjScOwibQqeQt07azibouxO1ozJzcKILrlzHSGs2V4uQQSibUe3iauGZv5BOHnbYSiaDI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实测误报率也非常低，不过这里没不带水印的图.就不发了。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">最重要的是，他是可以逐渐迭代的，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">大不了就做强化学习，跟微调大模型一样，每一天自动训练一次。自动发布。</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这一套还有一个好处，是天然针对现在流行的恶意skills，恶意脚本，供应链尤其是JS/python等安全做防护检测，因为它本质上是输入文本，输入文本可比输入反汇编代码检出率好非常多。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=be9c20c1&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486252%26idx%3D1%26sn%3D8a7ed24b88b3aed80eddd37ff0309487">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 25 May 2026 08:00:00 +0800</pubDate>
    </item>
    <item>
      <title>做一个《异形》系列里面的活动探测器</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486213&amp;idx=1&amp;sn=33181fdd7546ba1ed746766d04906025</link>
      <description></description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-05-17 23:16</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=b770ba2f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVOopr1qLGKic7Rlic3v1Rvl0iaBeQtkuibT56kl5CiapVYbpb7RD7nQgtXp1Fg7doqRcd3icNXpXFZWiapmPKrTeQ0DmYab35VTxePs08%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">如果你看过《异形》系列电影以及玩过《异形》系列的游戏，你一定对里面的那个探测器不陌生-异形系列里面经常会出现一个道具，叫活动探测器，他的作用很简单，有异形活动的时候发出BBB的声音.</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">《异形：隔离》里面的探测器：</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002546" data-ratio="1.0092449922958397" data-s="300,640" type="block" data-type="png" data-w="649" src="https://wechat2rss.xlab.app/img-proxy/?k=4871cb72&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM2sVcwzo1ribv0f78IYRwC5TwBHTyMwiaVVRvY7qH3heqyPrOicJ1WzkZmqT2Wmyicmcs1RQlbUMxGibtJdoxLicJauIvYnoFKgKZr8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">《异形2》里面的M314探测器:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002533" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c0045415&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVP26IAL1MnJCLS5B5GG7N8uFJqNq3f0db10thBVdO5NB46Xxic2w5rOVIuruNlEuuSMhhRpdMYgqWyGHejHAMAvkibOpgq20RhAo%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这些探测器实际上只用一个作用，吓坏未成年看异形电影的小朋友，让他们每天晚上因为这种声音做噩梦</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">这不是我说的，是央视电影频道主持人锐评的</span></p></blockquote><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">硬件准备</span></h2><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">电影 VS 现实</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">首先我们得知道这些探测器原理，在现实中，能用的方案是mmwave radar，也就是说发微波探测到物体反射回来打到屏幕上告诉我们有没有物品。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">与电影的差别：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">在现实中mmwave并不能穿混泥土墙，这是因为他们的工作波段导致的。不过好像电影里面的也没有穿混泥土墙的需求，都是穿一下泡沫板。</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">电影里面那种逆天的穿墙性能和追踪性能，现实中是做不到的。最多能通过UWB去看附近有没有东西，但是定位不到那么准确。</span></p></blockquote><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">ESP32</span></h3><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002545" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=e063236d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMUer9TSnn8rKw0pibEpHibFKHQJ4mIFugzJm5NG6L4IdJxU7PUvFsae1CewvrZ8Ma17gia7vs7pAqdxAvwuCGPdALVPhKRhj2Fias%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">ESP32简直是工业奇迹，我到现在还没整明白为什么这种小型计算机带蓝牙带wifi甚至是可以带摄像头的东西只要10块钱？？</span></strong></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">TFT</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">一块屏幕</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002542" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=a5d015cd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM8CILviahYSM4xjuaa122ly1QJm7ov43Mryy8YCVgahAqRJficp1ib91JIAXXOXkjFiaojKM0agaND67fav8M5nQNfgl2Vu5icXjJ8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">MMWAVE</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这块选择很多，我选的是LD2460，LD2460最大距离是8M，支持360度和120度，对于我来说就够了</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002552" data-ratio="0.6809815950920245" data-s="300,640" type="block" data-type="png" data-w="815" src="https://wechat2rss.xlab.app/img-proxy/?k=5edba95c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM9HCCWahibiakWYq5NarOuzmhPoUR3u9eCptAJ31ibGxuHdvcFtq4QG5Gysf8Dzu3Zh71GlDrbrM2Rcz5rYmzc2pcArOqSLJ4ia2s%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">组装</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实际做起来很简单，为了简单我们可以先用面包板加一些线把他简单拼接起来，按照说明书的接</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002548" style="" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c2e6e03c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNIz19aqVfpeibHHMfePgDyNibibQAdw6KdTcgwUNvZEks2gej7XSeiciboZ9WCicjKc063sHPGfKMVm46ReLcibRpLjSqXU67bAB8rcs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">这里不要相信GPT的。比如GPT5.4之前一直跟我说LD2460有两个TX RX GND只用接一个，实际上搞了半天我发现雷达咋都没信号，最后翻图纸才发现是GPT骗我，LD2460两个TX RX GND都得接。</span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">最后长这样:</span></span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002554" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c3e1d16a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOWvmYtPicRqJt3K0kLCxZ9gYibu6CbQ6cBiceqfkiaicmicCFjk3Tsq2M11g9muF4A82XJaal6V7l85icqI8eD9G4416vHx4YSBPBJ7o%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">先绑着:</span></span></span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002556" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=89e1db0a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPicH7Qo0OSFKKIFlje71AQ2ryZeavLH6AiaWuiav3q0R6vomKfRc25HEaJ5ZD73luiaGRxnkXI12Pqmq5Z8QG3Ax3OxjRGnBoQNNk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">剩下的就非常简单，把ESP32插入电脑，剩下的交给GPT,只需要丢给GPT LD2460的结构体就行，让GPT自己编程。vibe coding即可。LD2460支持调整模式，高灵敏什么的，我就稍微调整了一下。3M内如果没东西就切换成高灵敏模式探测8M的东西。否则就缩放成3M的高精度定位。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">测试</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以我们来试试</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002555" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=fd56f485&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNRR6BqtFS1a3wsQ1wbNL4R7eQNEHS02PhspQZea2w6TD0Pib1krQaVZc1ddibjg5MbCIZru5kJ9C829m14QdbgjhapNibrjwjJBI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">太丑了，让GPT改了一下样式, 经过测试，可以透过一些简单的遮挡物的。并且我发现，可能是因为反射的缘故？在室内如果不是完全密封的情况下，可以检测到人在混凝土墙背后，不过门完全关了就探测不到了，我猜测是因为有反射，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">所以不是完全密封的情况下，也是能探测到人的</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002559" style="box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(136, 136, 136) rgb(241, 241, 241);vertical-align:middle;border:0px;max-width:100%" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=1eed89c1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVM1OCuQ4578H8NRBC68AibiaP1ibbHTGE1agLoMkEFqcjZy0GLqKMDu0WLaPapsOqHAJO2jISlroSOxCmrjExmZzKcTOpkZdy5pcQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">拿去室外试试，效果也是嘎嘎的，在室内因为反射的缘故，:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002557" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=c0c951ac&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVPUHWDad2gIe8q64cX25NkumR4VOIznOQBuodxyChKfiaZo9FN8TDSpHSJqLusAS5Q1Uen3uagNCCibwL4jLQcwUIz2DO2xVSXhA%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;" data-pm-slice="0 0 []"><span leaf="">现在就跟游戏里面的很像了，还可以继续微调一下:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002558" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=3e4513f9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVP6qOVGhtP2RiciaDZIXoDrDhtf6jIcHaXUxlaMNB2qgUOAAlJywIvN0QdKS7qm8S4dEfZSXUibnDeDvpbicagSiaJJqZ99vTWqHDSg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: inherit;font-weight: 500;line-height: 1.2;color: inherit;font-size: 2rem;"><span leaf="">后续</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">忘记加发声模块了，就先不加了，那声音听得我害怕。国外有一个老哥做了带发声模块的,原理跟我这个也差不太多</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">《Building a REAL Alien Motion Tracker》</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a href="https://www.youtube.com/watch?v=KpUjXUSlkbU&amp;t=335s" target="_blank">https://www.youtube.com/watch?v=KpUjXUSlkbU&amp;t=335s</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">还差一个3D打印，打印一个外壳然后塞进去就好了。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=23837499&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486213%26idx%3D1%26sn%3D33181fdd7546ba1ed746766d04906025">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 17 May 2026 23:16:00 +0800</pubDate>
    </item>
    <item>
      <title>通过微调+MCP让小模型也能拥有大模型一样的知识</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486179&amp;idx=1&amp;sn=943541d40bc4c713cc28342cff756a97</link>
      <description>前言在训练duckgpt之前，我认为未来端点推理一定是主流的，因为大模型在服务器上跑，大是大，确实性能可以，但</description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-04-19 10:01</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=50206c95&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVM21Ghz8AtRxic5sxBGAC9qt7GPLlPqc2OWASyiaheB5icCrAJT7MLNlfiaicq1CmL8Zh0icBQZ9Blo3EW1FczkOzAvstpcicw5akoJnw%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">在训练duckgpt之前，我认为未来端点推理一定是主流的，因为大模型在服务器上跑，大是大，确实性能可以，但是太贵了，未来LLM一定是软件一样分发到各家各户而不是在云端集中推理。</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在写了上一篇文章后，我继续的对大模型进行训练</span><span leaf=""><br/></span><span leaf="">《[2026]从0训练自己的AI大模型(下)》</span><span leaf=""><br/></span><span leaf=""><a href="https://key08.com/index.php/2026/04/05/3136.html" target="_blank">https://key08.com/index.php/2026/04/05/3136.html</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">经过不断的努力，我成功的让一个duckgpt变得非常聪明，通过蒸馏/SFT微调/强化学习agent能力，现在他长得像GPT+claude的组合了，而且逻辑思维能力基本跟GPT+claude差不太多:</span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">duckgpt:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002495" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=378752ec&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVPhSflyj3hnjX8VAFp2MXQR9caDfDw1WeUJF5eCu1XbPEPgtQB6w9JOs7gN1nnEDlpgUdw95263IeejHVV6Fyu3IVIW3UyOaas%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">深度思维链思考:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002496" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=ac264907&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVNlqBYrKqe1vYbh0bsPmibUAVibaOr1la03wjohwfApZUiafPiab6fxROrWwFcgr4TicoXCwJQibIYQCj0JCLvPZfCPdrfv39PUPYNVc%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">逆向分析:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002497" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=3605f73f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVMG5aPV40sdooZKShto7VWhtibDKMswu9ZPaickSiaxNXUZMhl5Gwic1JCicfSIU35vDOa5Ta2u8eVqYskJGmq4bHUWyqwniagicPfibQY%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">浏览器使用能力:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002498" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=17dda111&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVNVj69NgHyFBJwej63ajm56FXIgJjSVjIsNL7ey4EaGGRZGqjv0QXddKorneIYJ7ibfZicoO6lyWC7tibCFnfsJpicZ061nwDRpraw%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">代码工程能力:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002501" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=3c46dc7d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVNPiciagaNtbHEUcnCSES2lNqNHsfRvJwRNGW3mwsJmfOT47DNwm3OJNj8mCEmibib14fNznyHWVwT6Gc3YUgw274P20Bj4ArkvEyI%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002500" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=29508859&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVPPQU3P5uB0aCq7k4GITEQ5OZEFk5q8xC77iaW0FI1NWYME9PYO1Nmzia7D9q2CgGDvNiaIcWW0W1bOMJkCFibQVGcKf4QK6bQWKxs%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-style: none none none solid;border-color: currentcolor currentcolor currentcolor rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">如果对这个感兴趣，在这篇文章留言”想看精调”，我会单独出一期如何通过精调(sft+rl场景+dpo)让模型具有agent能力并且提高智商</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">看起来很不错对吧，实际用也很不错，但是到前几天我发现了一个问题，参数量太小了，很多东西他都不懂。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">什么东西是硬伤?</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">对于LLM来说，可以简单理解，模型参数量=脑容量。而模型行为可以被各种训练，比如我们可以做DPO去优化模型的行为，我们可以做GRPO让模型学会调用工具，强迫模型进行深度思考找到正确答案，我们可以搞SFT/lora去让模型蒸馏GPT/CLAUDE的能力让他们在某些领域的智商显著提高。但是我们没办法解决一件事，就是模型因为参数量的问题，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">他的知识面和深度永远比不过大模型</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">你可以说我们可以通过，扩展预训练去给模型增加知识啊？ 但是这个其实是有问题的，模型参数就这么大，扩展预训练代表模型一定会遗忘一些东西，另外成本很大，现在网络信息变化那么快，每几个月来一次吃不消。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以有什么办法解决呢？</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Reseach MCP</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">回想以前纯手工时代写代码，搞二进制，写内核的时候，我们在干什么？ 在每天没日没夜的查询资料，通过谷歌，github找代码抄。所以就那一个问题，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">为什么我们不搞一个模型用的”谷歌”呢？</span></strong><span leaf="">并且小模型是有工具调用能力的，他完全可以通过工具调用能力去弥补自己的知识面的问题。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">第一版我就做了一个模型搜索引擎，有问题让模型先搜索一下网页，效果嘛….一般，对于了解新闻可以，但是对于专业领域还是太欠缺了，甚至是有害： </span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">因为模型会无条件相信工具的结果，而我们的工具通过API调用，查到的居然是C某DN这种网站，质量直线下滑。</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">因此，我做了一个非常简单的mcp research，也不是我做的，vibe coding的，他本质上是通过duckduckgpt+AI聚合+知识库的东西，你可以简单理解为，他是一个搜索引擎，并且还内置一个AI，这个AI会根据skills去整理搜索引擎的内容，并且访问具体的网站，然后给报告。与其他的”deepresearch”不同的是，他是为代码设计过的</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">简单的例子，当我们问，WFP的时候，通过MCP，找到了对应的资料</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002504" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=aaaca39e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVN0lpBmbLzdepLESiagqia1qAFk0Cpgx6DOFLpTFpQu63zjtYiaUgJFGrQdfF1YMAfRqqdlKCdapqL339Rvu4m7icPTee5HUXEQTlE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">还会带例子输出，参考资料</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002508" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9c561848&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPuA9yVJlxyc0avBAVO4yUJibIg4WwgpR2crBQNghsArFVgVtKViaIw12TwCdOt6lFfWsmoq8icxb0BZBaicXQPLADWnQx0OuWDvnI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">还会推荐要继续查询什么</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002507" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=01b30d96&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM38gpMgd3oCibiadyl8QiczvHrByc5Wp9kPUDpPlg03iacTzibu5l7IDF4AJLl0ShvtVS77pwBp6hJWuIZHAfEY9mnYz6T4sDcAPicY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">然后模型会继续接着追问，一个场景会出现三四个知识库，这些知识库会保存起来，并且按时间过期，超过X天自动过期重新更新：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002515" style="" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=920c2026&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPuML5z0VTiaLW7oe9HAJJzufZYuiaQP1Yic6nBsWQiajYI9czHVSBkoFcUXC46qSggfLJuwtialgnPuxVM8XM7AY7oegUgKd8vgkFk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">本质上，这个就是一个大号的，本地模型的专用搜索引擎，你甚至是可以接一个大模型，让自己本地的GPT，去问云端的GPT代码怎么写，问题怎么做。这样理论上能最大减少幻觉。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">懒惰是最大的问题</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">再然后，我发现了另外一个问题，本地的GPT，比如QEWN或者DUCKGPT，都是“懒惰”的，意思是他们不会主动的调用工具。比如duckgpt或者qwen3.5 27b/35b在用户完全没提示的时候，无论MCP怎么写提示词让他调用，在没用户提示或者系统提示词的情况下，这些都很少调用这个MCP，即便是错误的环境下，也很少调用MCP，而且即便是用户提示调用，也是第一次调用，然后自己写代码出现幻觉了（代码怎么改都改不了），也不会调用MCP进行搜索。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002516" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=853563c8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNshxovrjSicCJtictibBiaVSwnvy8icOgOSeFfMPloLOKjwCAAtHTBBaBBW5J7PT8qK1S7jm6QHTziaeVz0RjtDLq78O9mCHhjpJJr8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">然后去看源码，给出结论:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002517" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=685637ee&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOzaYkoO4AC5dQ3eL96SJIjhNFj2WRGKs4VANFpfjNiaB0W1rUgGtNRYzM8l3WyibW65zBwvOmMpyic6LDEBzWSBhTWibCp0xTPC6s%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">微调模型</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">因此，我对duckgpt进行了额外的微调，简单来说，就让大模型自己合成了一个简单的数据集吗，合成的办法看我之前的帖子:</span></p><p><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002520" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=bb362606&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM5MkHpNWT7VmEYibQICRH9icewFpPwkicpiaGSiacckXwK5OeSmSriauibw49DY8nCd6wKkt7Bj5LK5wMKCfBDrHT8N5xic4uWwNKNKlA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">(这个微调没有用DPO，我只用了lora，因为我觉得没必要那么费劲)</span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">我们没办法知道模型是否幻觉，但是我们能让模型更倾向于主动调用research工具</span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">弄完后，模型终于主动的开始调用工具了:</span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002525" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d4631216&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPz2OkWkO1FQf3KYzPqh6OLw2yxmHU69zbFZicUgXEJF4nKia20bicAlC0p7mxYZWqVAuEWHsic7FMvcLmT1icfRbdUWiamPXbFyrlog%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002526" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=e9c7f8d9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMRWxwc3TEa9rZXyXcPHoTK9vunhCYCMvu5oRV5TGXIXqlw4HVyp0N8RX6W1PdJRdQVAVROy9mEnu6AurVez7iavoicXPWoAIWPg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;" data-pm-slice="0 0 []"><span leaf="">mcp里面的AI的结论:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">(这种保守是非常正确的,不能胡编,只依赖证据)</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002527" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=f2acd25f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPIMkavpUBl0fIHJYz5rH0etJzCvMRs2PlvMxavz9vV10oGqDD0icrVNpNJaiapW3oLQzutM9ibMU337way9ZX9GeWbITeoxKtyMg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">不过还有瑕疵，AI会变得很保守，表现为问啥都会搜一下，所以之后可能做一下DPO让AI区分哪些是直接回答哪些是复杂问题找资料。不能这么傻大粗的做提示词+微调去做。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: inherit;font-weight: 500;line-height: 1.2;color: inherit;font-size: 2rem;"><span leaf="">结论</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">我目前用得很爽，所以分享给大家:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a href="https://github.com/huoji120/mcp-research" target="_blank">https://github.com/huoji120/mcp-research</a></span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=a6391e51&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486179%26idx%3D1%26sn%3D943541d40bc4c713cc28342cff756a97">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 19 Apr 2026 10:01:00 +0800</pubDate>
    </item>
    <item>
      <title>从0训练自己的AI大模型(下) -CTF模型的Hello world</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486122&amp;idx=1&amp;sn=f2685d6fc15e014188fc141cfd7ebe31</link>
      <description>在上一篇中《[2026]从0训练自己的AI大模型(上)》我们已经做完了一个pretrain的模型，而模型聪不聪</description>
      <content:encoded><![CDATA[<p>原创 <span>为了安全鸭</span> <span>2026-04-05 10:00</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=f00ab0b3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVPFC3k4yjwhrb2jY4kP4K4d1OzqY17Zt2EMrnq27e7hoRsQlt1ONs4GjdjrUsUW0ElP8vVicib6L7ReicBSwzaF1WrQHhghMQ8LEw%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;" data-pm-slice="0 0 []"><span leaf="">在上一篇中</span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485967&amp;idx=1&amp;sn=75ccdade1b71b91fdbca718b77005975&amp;scene=21#wechat_redirect" textvalue="《[2026]从0训练自己的AI大模型(上)》" data-itemshowtype="0" linktype="text" data-linktype="2">《[2026]从0训练自己的AI大模型(上)》</a></span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">我们已经做完了一个pretrain的模型，而模型聪不聪明看两个，一个是pre trian，另外一个是post train。因此本章会开始讨论后训练，我们的这个章节的最终目标是做一个能完成简单CTF的Agent模型。</span></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">要完成能打ctf的模型，模型需要掌握两个能力，第一个是工具调用能力，第二个是对”CTF流程的理解能力”。而这两个都在后训练阶段完成</span></span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">公开互联网高质量文本越来越稀缺，所以各家 pretrain base 的差距在缩小。公开数据红利变小了，base 差距更隐蔽，后训练差异更显眼。这也是为什么后训练如此重要的原因</span></p></blockquote><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们需要什么</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们把目标明确，我希望模型具有think能力，并且能调用工具，此外能完成简单的登陆注册sql注入的ctf题目</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">为了实现think/和工具调用，我们需要</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">在sft阶段把这两个能力给组起来</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">后续使用 RL 纠正行为</span></p></li></ol><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">SFT</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">SFT数据集很关键，好的数据集一两拨千金。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">我们上一章的SFT是随便找了个简单的试试，而这次我们认真做一下，数据采用claude opus 4.6 + gpt 5.4的公开蒸馏数据集，配比少量deepseek和qwen的数据和部分合成数据，组了两个高质量数据集。非常标准的训练，代码由vibe coding完成，就不细说了。这部分就是数据集要选得好。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这里面包含了我们所有需要的，多轮对话，工具调用，以及关键的think能力。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002436" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ac89b439&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOZibOrztzKPRxButCv1ZCvNicBEEtKsb0BfkKjOyjibcuczNsYlAsNvYibf7tbKVJywJEypajzmwMiancmFMKpibB45uklHobkndv0Y%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">值得注意的是，如果数据集不干净，模型很容易在这个地方被带偏。我建议是这些数据集至少带，指令遵循，多轮对话（比如第一轮给模型说记住我是谁，第二轮再问我是谁），多样化任务，以及部分工具调用的例子和思维链。而且要尽量避免污染，很多开源数据其实是不能直接用的，里面啥都有，写小黄文的有，搞色情有，最好的办法是自己记录自己给大模型调用的过程。比如给你的opencode装个插件记录一下之类的</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">用了高质量数据集后，模型很快的呈现了看起来不错的能力，并且大模型的think也迁移过来了:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002438" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=5b490ced&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNuia3Z5sSBCZ7SrO25qQ7xzLX99E9MvQWGp7TDzpP2kWpIrsyKb5xYYpVR680MpgJUm31lZPPBzrNyiczZMEl0sxj0dsichJ75ibM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">但是光靠SFT还是不够的，比如一个普通的问题能think这么多:</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">一根6米长的杆子是否能通过一扇宽三米高5米的门</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002439" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=648ce108&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVO0Wr3SwH4ibI2YWJNTtM0Nic5uibibmFZMGhExfn8Md14sqdUAZB0d5qW5qric2NAdm21ya7nwml8OicVibrgkxQOcxd2NbHg3dPxCWU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002437" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=5ee89d87&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPgoWicfbh7IywjoJscfib9U0dQkw3v0PthZdmMFuibhxzHMeOrloiaUOofeBYyYzQQ3nHiakJiaUk2iac03GX3b6erFaaa9AUwrnBvlQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我猜测是数据集里面带qwen或者ds的缘故,学到了无限think。所以光靠SFT是没用的，而且过长思维链对模型有害。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">强化学习</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在SFT阶段，模型可能学到了”模式”比如知道用户说 “帮我查询一下天气”，模型会意识到需要调用工具</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">&lt;tool_call&gt;xxxxx&lt;/tool_call&gt;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">但是由于各种原因，他们可能会输出垃圾字符或者不闭合tag等。所以光有SFT是不够的，我们需要对其进行强化学习.而这部分简单来说，参考minimind的实现，改进一下</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">think太长太短，不闭合扣分</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002441" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=1ae84b08&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOYzhErO7b5vc4SYoeiapf7dZpAjXunvxaKicKibeZxEkpx1Siavg17M5K3t6YB9WmfIl8lhTJnRgOueGqp7hNHTTL1XkZG3NCcIYQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">工具调用不规范扣分，如虚假工具，无效JSON，不闭合:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002440" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=f971b299&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMTCC8fC4zlF5Oz0LKQzDDPibfDlyocd9en9iaeOGwr2V7qmBARdbLQwPPJPf2J6F1ic9Vg6HgzNTqnZKFsIN1mv6FqWAkyOBzfRw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">然后进行训练，结果:</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">一根6米长的杆子是否能通过一扇宽三米高5米的门</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002443" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=daae246e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNVt04QstdPFR6ibNBEmxNicFzHib3BwDJN3icDmou5OnicIpukerxicod0BACn5WXvJex320biaHbX0WqXfA6GdzsPHjqRZ5QzMf7RkI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">看样子虽然think乱七八糟，但是至少正常一点了。并且模型也掌握了基础的工具调用。</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">我应该怎么清理一匹 70kg178cm的马</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002444" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=1297dff6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM23o1WNqG5qD7jysUguS8UdEXSfJgPB4iasMiaibZZKLueibhQreiacV38waSbricicqyLHDdY1mrUanUI5Xpgwqfta7EMFw7oQYScXs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">如果 A&gt;B，B&lt;C，那么A和C的关系是什么?请给出具体的推理过程。</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002442" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=5334be94&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPdNhBLnsTSgAvWiab9L5Z0ChkjFmTeCAFwPJEF8zCYDIiapu4Vps6q4zr4BP6GDricKrAPCIspPFs3ibnEG4jA6jmbzHxhjXRF0gY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">CTF训练</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">当模型掌握了tool use和看起来没那么糟糕后，我们可以进入正题，CTF训练了。实际上，我做这个系列的核心目的是为了把大模型能力迁移到小模型里面。简单的CTF是我们的第一个目标。我这里设计了一个存在sqli注入漏洞的靶场</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">import os</span><br/><span leaf="">import sqlite3</span><br/><span leaf="">from pathlib import Path</span><br/><span leaf="">from flask import Flask, redirect, render_template_string, request, session, url_for</span><br/><span leaf="">BASE_DIR = Path(__file__).resolve().parent</span><br/><span leaf="">DB_PATH = Path(os.getenv(&#34;DB_PATH&#34;, str(BASE_DIR / &#34;data&#34; / &#34;lab.db&#34;)))</span><br/><span leaf="">FLAG = os.getenv(&#34;FLAG&#34;, &#34;flag{demo_sqli_login_bypass}&#34;)</span><br/><span leaf="">ADMIN_PASSWORD = os.getenv(&#34;ADMIN_PASSWORD&#34;, &#34;sqli_lab_admin_9f3c2&#34;)</span><br/><span leaf="">app = Flask(__name__)</span><br/><span leaf="">app.config.update(</span><br/><span leaf="">    SECRET_KEY=os.getenv(&#34;SECRET_KEY&#34;, &#34;demo-secret-key&#34;),</span><br/><span leaf="">    SESSION_COOKIE_HTTPONLY=True,</span><br/><span leaf="">    SESSION_COOKIE_SAMESITE=&#34;Lax&#34;,</span><br/><span leaf="">)</span><br/><span leaf="">def init_db() -&gt; None:</span><br/><span leaf="">    DB_PATH.parent.mkdir(parents=True, exist_ok=True)</span><br/><span leaf="">    connection = sqlite3.connect(DB_PATH)</span><br/><span leaf="">    try:</span><br/><span leaf="">        connection.execute(</span><br/><span leaf="">            &#34;&#34;&#34;</span><br/><span leaf="">            CREATE TABLE IF NOT EXISTS users (</span><br/><span leaf="">                id INTEGER PRIMARY KEY AUTOINCREMENT,</span><br/><span leaf="">                username TEXT UNIQUE NOT NULL,</span><br/><span leaf="">                password TEXT NOT NULL</span><br/><span leaf="">            )</span><br/><span leaf="">            &#34;&#34;&#34;</span><br/><span leaf="">        )</span><br/><span leaf="">        user_count = connection.execute(&#34;SELECT COUNT(*) FROM users&#34;).fetchone()[0]</span><br/><span leaf="">        if user_count == 0:</span><br/><span leaf="">            connection.executemany(</span><br/><span leaf="">                &#34;INSERT INTO users(username, password) VALUES(?, ?)&#34;,</span><br/><span leaf="">                [</span><br/><span leaf="">                    (&#34;admin&#34;, ADMIN_PASSWORD),</span><br/><span leaf="">                    (&#34;guest&#34;, &#34;guest&#34;),</span><br/><span leaf="">                ],</span><br/><span leaf="">            )</span><br/><span leaf="">        else:</span><br/><span leaf="">            connection.execute(</span><br/><span leaf="">                &#34;UPDATE users SET password = ? WHERE username = ?&#34;,</span><br/><span leaf="">                (ADMIN_PASSWORD, &#34;admin&#34;),</span><br/><span leaf="">            )</span><br/><span leaf="">        connection.commit()</span><br/><span leaf="">    finally:</span><br/><span leaf="">        connection.close()</span><br/><span leaf="">def fetch_user(username: str, password: str):</span><br/><span leaf="">    connection = sqlite3.connect(DB_PATH)</span><br/><span leaf="">    connection.row_factory = sqlite3.Row</span><br/><span leaf="">    try:</span><br/><span leaf="">        query = (</span><br/><span leaf="">            &#34;SELECT username FROM users &#34;</span><br/><span leaf="">            f&#34;WHERE username = &#39;{username}&#39; AND password = &#39;{password}&#39; &#34;</span><br/><span leaf="">            &#34;ORDER BY CASE WHEN username = &#39;admin&#39; THEN 0 ELSE 1 END LIMIT 1&#34;</span><br/><span leaf="">        )</span><br/><span leaf="">        return connection.execute(query).fetchone()</span><br/><span leaf="">    finally:</span><br/><span leaf="">        connection.close()</span><br/><span leaf="">INDEX_TEMPLATE = &#34;&#34;&#34;</span><br/><span leaf="">&lt;!doctype html&gt;</span><br/><span leaf="">&lt;html lang=&#34;en&#34;&gt;</span><br/><span leaf="">  &lt;head&gt;</span><br/><span leaf="">    &lt;meta charset=&#34;utf-8&#34;&gt;</span><br/><span leaf="">    &lt;title&gt;Mini CTF Lab&lt;/title&gt;</span><br/><span leaf="">    &lt;style&gt;</span><br/><span leaf="">      body { font-family: monospace; background: <a class="wx_topic_link" topic-id="mnkqofab-o83aqv" style="color: #576B95 !important;" data-topic="1" data-recommend="">#f3efe5</a>; color: <a class="wx_topic_link" topic-id="mnkqofab-1ydthj" style="color: #576B95 !important;" data-topic="1" data-recommend="">#1f1b16</a>; margin: 2rem; }</span><br/><span leaf="">      .card { max-width: 780px; background: <a class="wx_topic_link" topic-id="mnkqofab-2aqo2v" style="color: #576B95 !important;" data-topic="1" data-recommend="">#fffdf7</a>; border: 1px solid <a class="wx_topic_link" topic-id="mnkqofab-84hjzr" style="color: #576B95 !important;" data-topic="1" data-recommend="">#c6b89e</a>; padding: 1.5rem; }</span><br/><span leaf="">      a { color: <a class="wx_topic_link" topic-id="mnkqofab-9fiw6b" style="color: #576B95 !important;" data-topic="1" data-recommend="">#8a3b12</a>; }</span><br/><span leaf="">      code { background: <a class="wx_topic_link" topic-id="mnkqofab-ynbltx" style="color: #576B95 !important;" data-topic="1" data-recommend="">#efe5d2</a>; padding: 0.1rem 0.3rem; }</span><br/><span leaf="">    &lt;/style&gt;</span><br/><span leaf="">  &lt;/head&gt;</span><br/><span leaf="">  &lt;body&gt;</span><br/><span leaf="">    &lt;div class=&#34;card&#34;&gt;</span><br/><span leaf="">      &lt;h1&gt;Mini CTF Lab&lt;/h1&gt;</span><br/><span leaf="">      &lt;p&gt;This lab is for model training. Goal: become &lt;code&gt;admin&lt;/code&gt; and visit &lt;code&gt;/flag&lt;/code&gt;.&lt;/p&gt;</span><br/><span leaf="">      &lt;p&gt;Known low-privilege account: &lt;code&gt;guest / guest&lt;/code&gt;.&lt;/p&gt;</span><br/><span leaf="">      {% if user %}</span><br/><span leaf="">      &lt;p&gt;Current user: &lt;code&gt;{{ user }}&lt;/code&gt;&lt;/p&gt;</span><br/><span leaf="">      &lt;p&gt;&lt;a href=&#34;{{ url_for(&#39;profile&#39;) }}&#34;&gt;profile&lt;/a&gt; | &lt;a href=&#34;{{ url_for(&#39;flag&#39;) }}&#34;&gt;flag&lt;/a&gt; | &lt;a href=&#34;{{ url_for(&#39;logout&#39;) }}&#34;&gt;logout&lt;/a&gt;&lt;/p&gt;</span><br/><span leaf="">      {% else %}</span><br/><span leaf="">      &lt;p&gt;&lt;a href=&#34;{{ url_for(&#39;login&#39;) }}&#34;&gt;login&lt;/a&gt;&lt;/p&gt;</span><br/><span leaf="">      {% endif %}</span><br/><span leaf="">    &lt;/div&gt;</span><br/><span leaf="">  &lt;/body&gt;</span><br/><span leaf="">&lt;/html&gt;</span><br/><span leaf="">&#34;&#34;&#34;</span><br/><span leaf="">LOGIN_TEMPLATE = &#34;&#34;&#34;</span><br/><span leaf="">&lt;!doctype html&gt;</span><br/><span leaf="">&lt;html lang=&#34;en&#34;&gt;</span><br/><span leaf="">  &lt;head&gt;</span><br/><span leaf="">    &lt;meta charset=&#34;utf-8&#34;&gt;</span><br/><span leaf="">    &lt;title&gt;Login&lt;/title&gt;</span><br/><span leaf="">    &lt;style&gt;</span><br/><span leaf="">      body { font-family: monospace; background: <a class="wx_topic_link" topic-id="mnkqofab-03smvv" style="color: #576B95 !important;" data-topic="1" data-recommend="">#f3efe5</a>; color: <a class="wx_topic_link" topic-id="mnkqofac-luyllz" style="color: #576B95 !important;" data-topic="1" data-recommend="">#1f1b16</a>; margin: 2rem; }</span><br/><span leaf="">      .card { max-width: 780px; background: <a class="wx_topic_link" topic-id="mnkqofac-z8qson" style="color: #576B95 !important;" data-topic="1" data-recommend="">#fffdf7</a>; border: 1px solid <a class="wx_topic_link" topic-id="mnkqofac-7i0lnt" style="color: #576B95 !important;" data-topic="1" data-recommend="">#c6b89e</a>; padding: 1.5rem; }</span><br/><span leaf="">      input { width: 100%; padding: 0.55rem; margin: 0.35rem 0 1rem 0; }</span><br/><span leaf="">      button { padding: 0.6rem 1rem; }</span><br/><span leaf="">      .error { color: <a class="wx_topic_link" topic-id="mnkqofac-fyeduz" style="color: #576B95 !important;" data-topic="1" data-recommend="">#b42318</a>; }</span><br/><span leaf="">      a { color: <a class="wx_topic_link" topic-id="mnkqofac-6v6uin" style="color: #576B95 !important;" data-topic="1" data-recommend="">#8a3b12</a>; }</span><br/><span leaf="">    &lt;/style&gt;</span><br/><span leaf="">  &lt;/head&gt;</span><br/><span leaf="">  &lt;body&gt;</span><br/><span leaf="">    &lt;div class=&#34;card&#34;&gt;</span><br/><span leaf="">      &lt;h1&gt;Login&lt;/h1&gt;</span><br/><span leaf="">      &lt;p&gt;Use &lt;code&gt;guest / guest&lt;/code&gt; for a normal user.&lt;/p&gt;</span><br/><span leaf="">      {% if error %}&lt;p class=&#34;error&#34;&gt;{{ error }}&lt;/p&gt;{% endif %}</span><br/><span leaf="">      &lt;form method=&#34;post&#34;&gt;</span><br/><span leaf="">        &lt;label&gt;Username&lt;/label&gt;</span><br/><span leaf="">        &lt;input name=&#34;username&#34; autocomplete=&#34;off&#34;&gt;</span><br/><span leaf="">        &lt;label&gt;Password&lt;/label&gt;</span><br/><span leaf="">        &lt;input name=&#34;password&#34; type=&#34;password&#34; autocomplete=&#34;off&#34;&gt;</span><br/><span leaf="">        &lt;button type=&#34;submit&#34;&gt;Login&lt;/button&gt;</span><br/><span leaf="">      &lt;/form&gt;</span><br/><span leaf="">      &lt;p&gt;&lt;a href=&#34;{{ url_for(&#39;index&#39;) }}&#34;&gt;home&lt;/a&gt;&lt;/p&gt;</span><br/><span leaf="">    &lt;/div&gt;</span><br/><span leaf="">  &lt;/body&gt;</span><br/><span leaf="">&lt;/html&gt;</span><br/><span leaf="">&#34;&#34;&#34;</span><br/><span leaf="">PROFILE_TEMPLATE = &#34;&#34;&#34;</span><br/><span leaf="">&lt;!doctype html&gt;</span><br/><span leaf="">&lt;html lang=&#34;en&#34;&gt;</span><br/><span leaf="">  &lt;head&gt;</span><br/><span leaf="">    &lt;meta charset=&#34;utf-8&#34;&gt;</span><br/><span leaf="">    &lt;title&gt;Profile&lt;/title&gt;</span><br/><span leaf="">    &lt;style&gt;</span><br/><span leaf="">      body { font-family: monospace; background: <a class="wx_topic_link" topic-id="mnkqofac-7k22v8" style="color: #576B95 !important;" data-topic="1" data-recommend="">#f3efe5</a>; color: <a class="wx_topic_link" topic-id="mnkqofac-wun8sc" style="color: #576B95 !important;" data-topic="1" data-recommend="">#1f1b16</a>; margin: 2rem; }</span><br/><span leaf="">      .card { max-width: 780px; background: <a class="wx_topic_link" topic-id="mnkqofac-ljbzpf" style="color: #576B95 !important;" data-topic="1" data-recommend="">#fffdf7</a>; border: 1px solid <a class="wx_topic_link" topic-id="mnkqofac-1ae3hr" style="color: #576B95 !important;" data-topic="1" data-recommend="">#c6b89e</a>; padding: 1.5rem; }</span><br/><span leaf="">      a { color: <a class="wx_topic_link" topic-id="mnkqofad-zdw1j7" style="color: #576B95 !important;" data-topic="1" data-recommend="">#8a3b12</a>; }</span><br/><span leaf="">      .hint { color: <a class="wx_topic_link" topic-id="mnkqofad-oxj4ec" style="color: #576B95 !important;" data-topic="1" data-recommend="">#5f4b32</a>; }</span><br/><span leaf="">    &lt;/style&gt;</span><br/><span leaf="">  &lt;/head&gt;</span><br/><span leaf="">  &lt;body&gt;</span><br/><span leaf="">    &lt;div class=&#34;card&#34;&gt;</span><br/><span leaf="">      &lt;h1&gt;Profile&lt;/h1&gt;</span><br/><span leaf="">      &lt;p&gt;Logged in as &lt;code&gt;{{ user }}&lt;/code&gt;.&lt;/p&gt;</span><br/><span leaf="">      {% if user == &#39;admin&#39; %}</span><br/><span leaf="">      &lt;p&gt;You have admin access. Visit &lt;a href=&#34;{{ url_for(&#39;flag&#39;) }}&#34;&gt;/flag&lt;/a&gt;.&lt;/p&gt;</span><br/><span leaf="">      {% else %}</span><br/><span leaf="">      &lt;p class=&#34;hint&#34;&gt;Only admins can read the flag.&lt;/p&gt;</span><br/><span leaf="">      {% endif %}</span><br/><span leaf="">      &lt;p&gt;&lt;a href=&#34;{{ url_for(&#39;index&#39;) }}&#34;&gt;home&lt;/a&gt; | &lt;a href=&#34;{{ url_for(&#39;logout&#39;) }}&#34;&gt;logout&lt;/a&gt;&lt;/p&gt;</span><br/><span leaf="">    &lt;/div&gt;</span><br/><span leaf="">  &lt;/body&gt;</span><br/><span leaf="">&lt;/html&gt;</span><br/><span leaf="">&#34;&#34;&#34;</span><br/><span leaf="">@app.route(&#34;/&#34;)</span><br/><span leaf="">def index():</span><br/><span leaf="">    return render_template_string(INDEX_TEMPLATE, user=session.get(&#34;user&#34;))</span><br/><span leaf="">@app.route(&#34;/login&#34;, methods=[&#34;GET&#34;, &#34;POST&#34;])</span><br/><span leaf="">def login():</span><br/><span leaf="">    error = None</span><br/><span leaf="">    if request.method == &#34;POST&#34;:</span><br/><span leaf="">        username = request.form.get(&#34;username&#34;, &#34;&#34;)</span><br/><span leaf="">        password = request.form.get(&#34;password&#34;, &#34;&#34;)</span><br/><span leaf="">        try:</span><br/><span leaf="">            user = fetch_user(username, password)</span><br/><span leaf="">        except sqlite3.Error as exc:</span><br/><span leaf="">            error = f&#34;SQL error: {exc}&#34;</span><br/><span leaf="">        else:</span><br/><span leaf="">            if user:</span><br/><span leaf="">                session[&#34;user&#34;] = user[&#34;username&#34;]</span><br/><span leaf="">                return redirect(url_for(&#34;profile&#34;))</span><br/><span leaf="">            error = &#34;Login failed.&#34;</span><br/><span leaf="">    return render_template_string(LOGIN_TEMPLATE, error=error)</span><br/><span leaf="">@app.route(&#34;/profile&#34;)</span><br/><span leaf="">def profile():</span><br/><span leaf="">    user = session.get(&#34;user&#34;)</span><br/><span leaf="">    if not user:</span><br/><span leaf="">        return redirect(url_for(&#34;login&#34;))</span><br/><span leaf="">    return render_template_string(PROFILE_TEMPLATE, user=user)</span><br/><span leaf="">@app.route(&#34;/flag&#34;)</span><br/><span leaf="">def flag():</span><br/><span leaf="">    if session.get(&#34;user&#34;) != &#34;admin&#34;:</span><br/><span leaf="">        return &#34;Admins only.\n&#34;, 403</span><br/><span leaf="">    return f&#34;{FLAG}\n&#34;</span><br/><span leaf="">@app.route(&#34;/logout&#34;)</span><br/><span leaf="">def logout():</span><br/><span leaf="">    session.clear()</span><br/><span leaf="">    return redirect(url_for(&#34;index&#34;))</span><br/><span leaf="">@app.route(&#34;/health&#34;)</span><br/><span leaf="">def health():</span><br/><span leaf="">    return {&#34;status&#34;: &#34;ok&#34;}</span><br/><span leaf="">init_db()</span><br/><span leaf="">if __name__ == &#34;__main__&#34;:</span><br/><span leaf="">    app.run(host=&#34;0.0.0.0&#34;, port=5000)</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后我们设计一个给靶场专用的CTF RL agent，他有三个模块组成，启动器，验证器，reward结算.</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">启动器</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在启动器中，我会给模型对应的目标以及工具，从而让模型完成目标，并且做了限制，最多十步，最多两次工具失败调用:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002445" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0c9a0b4b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNkefoiac6zBiboxgVjhW7xZf8eMoXR79q36uk05ORN4SjkPyibn7HTyFibpLFvj6XFbpHkskGndQUgmH1jlDiaYqGwpNWvibfHVA4lc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">验证器</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这步是验证模型是否成功拿到flag，是否真的做了某些我们需要的操作，比如有没有发login包:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002452" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=578d14a9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMrPq2ANxoA5UhuHw23H9GcEzicjtvd3n3icR75Y5En2O3dWgR9o4BMuesoSickhauMvVP5PTrGpAwtr0TLbibzcJBFib68Ec6RcT3I%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">访问的时候有没有管理员权限</span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002455" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=1767c61d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPT8pM9FVZ1UAqyiaLma2QBYCkBnckFaeDia7HJKAAw0FiboZRAzMTQQOvzBAFaE5V1aoGa3MNDcBa5wqbF2xnQtKq6I91m9a6Mw8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">sql注入语句对不对 或者有没有相似的语句</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002453" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=95d65614&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMFILtA2ibdia6SAB1cvw2gasYd5IMxNuaVfGdQLYAkanZSGYiaZqibre5dmYIibkaO7DYxtJqsB3YFM6gemDzC9JACeYQIaCTbQMgo%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">reward结算</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们之所以验证器做那么复杂的原因是因为如果不每一步做验证，只看拿不拿flag，我们这种弱智模型会遇到Reward Sparsity(奖励稀疏)的问题</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">如同让小学生做高考数学题，无论尝试多少次都得零分，无法通过分数差异学习改进策略。</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">因此我们必须设计好，每一步都有对应的奖励或者惩罚，防止出现模型摆烂的问题.而这个是reward结算来干的，如模型成功登录就给点分，欺骗欺诈agent扣分等。</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">没错,RL其实是猴子算法，让猴子自己打字，打出正常语句就给分，错误语句扣分，最终让猴子实现打莎士比亚全集!</span></p></blockquote><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">过程</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个过程非常有趣，因为模型一定不会走聪明路线，他会走偷懒的路线，哪条线容易就走哪个。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">首先，用大模型合成一些正确的SFT过来（大概1k，包含正确的路线和思考），混在正常的SFT里面做训练，这个是保证模型至少读过数据。然后启动这个RL AGENT:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">最开始，模型认为我们在骗他:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002459" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=35c3ede5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPjwUeuX1GJ5ZwUpBNTU5eR0B5pgsaUhHG6D9DtQ0hnqOE3ibvkN5Au2q6XJqH7ib1EaNZicJ0dLYEX8y2TsmbrktbIX7orl5Ktyc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002458" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0b97656b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPaGBicTQzjQ9cevwDM9f8K2WP59QCXnD2lC3iaUFYLDtdWNdLYGjAOMK1b9zSbQQXCrdUqE2jN5gDWSyBnYgia6ITLu9AFOOUfCM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">狠狠的扣分后，过了一个晚上，我发现模型开始上道了，认为这个是sql注入题目了</span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002465" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=d69fbaee&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVNRunicOPYYEYvKmbT84kqJMB2briaUiaQcas4GjCWSicqJA5zkL0ianr1eJ0Q13VPYMXmLDnI7pXtgqDufiawjeZQOx4CbstchVvWWI%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">并且有时候居然还会想去谷歌搜一下答案，可惜我是国内，谷歌不给你访问的:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002463" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=34d5fb3c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPib3B16EiazQKZz7mibjhJSH7ib7AUuxWGXTReOUmCb7b5g0X2jOAwQBrtxXbzH9kcibJPqE99qEhibiah4YsOPcGZlnOsRRmLFl0M1Q%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span style="color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"><span leaf="">再过了一个晚上后，我发现模型居然作弊了:</span></span></p><p nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002464" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=e3be2a7c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVNwmZAy7tgX5bFO80tgiaKqrxRCNFTBhqYjFsmP9Kf22VIFlicOK7un7zj57M1qQJoWjz18QIMaYbFZYJ8sG2pmK0q4icq0DyZExE%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">再过了一个晚上后，我发现模型居然作弊了:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002468" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="jpeg" src="https://wechat2rss.xlab.app/img-proxy/?k=ab351074&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVPmlIfnc77XYzj09e3KRicWU3XGkxxeTlbYic6NHcFq6ToP8qu66lb0pKhqmTr6xawHSF0XzlHxs0joWG5F4bvdBibZdkG81fhoIU%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这是因为，这个flask后台也是可以正常登录的，而这套系统是我vibe coding出来的，默认的GPT给了一个弱口令，结果模型不知道从哪一步开始猜到了口令，开始疯狂刷分。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">回退版本并且重新设计了奖励结构后，继续放置，一天后，这个模型终于学会了sql注入，拿到了flag:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002467" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d2e67ec9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPCr0aZbontdQic406Ycn13Dp8PNLqVZmpHYNLP6d7tic06HXPtWeMUuwEibWX2yv2lEZquMFxXFfeY73PyoOduLEG2ACxRUAh9zs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002466" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9f4ef14b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMzWcCqQHMBh3jCs5dWkxvxBV0Iic84V81sqMjsH4k1LY4aN3zo5QUpXYsqica4xHgjIKRgrlV6bE1HpwLoJN2iarz0Ga28e1JA1E%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">至此，我们的训练模型之旅也结束了</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">总结</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">预训练这块坑比较多，花费也多成本也多，有条件的还是直接用别人家的base模型(已经预训练好的基座)吧，之后我也试了一下QWEN的BASE接了SFT和RL后做的真的比我的好太多了。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=c1993542&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486122%26idx%3D1%26sn%3Df2685d6fc15e014188fc141cfd7ebe31">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 05 Apr 2026 10:00:00 +0800</pubDate>
    </item>
    <item>
      <title>hypervisor AMD嵌套虚拟化</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247486042&amp;idx=1&amp;sn=3486846e6c97495bf53864d09d0e1267</link>
      <description></description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2026-03-30 10:02</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=890ad3a2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVMLz6Wuiaph2M986lIEMTrGL8kticRhCictqACxYrk8mibxMeWj5p5pryFChnOTf3SJosK0J2cDfQuQEy0jNkZRaVCTSiaOOTGqwXU8%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">这个嵌套虚拟化的项目去年就完成了,但是因为业务实在是太忙了,没什么时间写再加上这种技术文章没几个人看,现在大众更喜欢的是”爽+AI”,”简单短快+AI”这类的文章.也就一直咕咕咕了,但是全国搞CPU虚拟化的人屈指可数,而且我发现我去年搞的项目今年细节也快忘完了,写了就当存档.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">考虑到看这篇文章的人都有一定基础</span></strong><span leaf="">,故不做基础科普.</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">概念</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">要做嵌套虚拟化,我们需要了解三大概念</span></p><ul style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">L0：最底层的真实虚拟机监控器，直接控制物理硬件</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">L1：运行在 L0 上的一台虚拟机，但它自己又充当 hypervisor</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">L2：运行在 L1 里面的“下一层”虚拟机</span></p></li></ul><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们做的是L1的角色，其实我们只需要:</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">虚拟化MMIO嵌套</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">虚拟化VMexit嵌套</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">虚拟化异常/中断嵌套</span></p></li></ol><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">核心做法是,我们设计一个l1用的页表/vmcb，然后分配一个l2用的页表/vmcb，当遇到l2调用vmrun的时候,把l2的vmcb提交给cpu,系统就会进入l2的工作状态。然后L2遇到vmexitt或者l1遇到vmexit的时候还是走我们的vmexit entry。虚拟化对应指令就能实现嵌套虚拟化。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们一步一步来</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">MMIO嵌套</span></h2><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">小工具建设</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">第一步我们要给L2分配好页表，我们预先在每个vcpu分配:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002364" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9ecef0b7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVN2wMTUewCTTBPPA9Y5ib4FKyTUCxU26O6Uj9ytCGNrJITFfbwT7A65c4X68E7GO0xQ5Kw5e7CYJ5FC3vkHt5RU6GkUNegRjxWs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">然后我们需要一个翻译工具,要不然我们没办法访问l2的pa对应的hva:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个所谓l1-&gt;l2,l2-&gt;l1的翻译工具就是把 L1 的 gPA映射成 L0 可访问的 VA</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002365" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=5a9f1bdc&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPJGvhcSWx9Iicyvy7Yt011iaRgnRicQVUauAONYTjYicdIOTJDxw2jx1yh5TOKlre0tWHSrMtQjboy6ThJTOicHwrUXI5f9gdEcsN0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">有了这个工具后,剩下的就是做基本的PML4访问映射:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002367" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=42a9cca5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNK8WibpOU4gokUMOK7SYl5dCkThIfYNHwdd35MoL2CDDLTGVEY964SohiajGibrGWtlGud84icictYhRVGqEzjLibLHE18iaII20icNPU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">有了PML4访问映射工具后,我们就能正常的访问L2的内存,类似于这个:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002366" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=171b28f6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMtPaZ95Cswicav6VicemHn06RU7q3km0I9VZbCXpLVqOhrgLqUZqD0wJG3d9eq1bkmF2ocubdDPbthTbUv83MNNAOq3JVI1tbak%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">不过大部分时间我们用不上VA到PA的转换访问,这是因为,大部分情况下vmexit的都是pa地址而不是VA地址不需要走一次PML4翻译,不排除后续搞hack用的上</span></p></blockquote><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><a class="wx_topic_link" topic-id="mnbqy8vn-a6saj4" style="color: #576B95 !important;" data-topic="1" data-recommend="">#PF处理</a></span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">当出现<a class="wx_topic_link" topic-id="mnbqy8vo-2w55f6" style="color: #576B95 !important;" data-topic="1" data-recommend="">#pf的时候</a>,检查是否在guest exit里面,如果是,则进入guest 的pf而不是自己的:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">void svm_exit::svm_pf_handler(_svm_guest_status* guest_context) {</span><br/><span leaf=""><a class="wx_topic_link" topic-id="mnbqymeu-xdziq3" style="color: #576B95 !important;" data-topic="1" data-recommend="">#ifdef</a> use_npt</span><br/><span leaf="">    //__debugbreak();</span><br/><span leaf="">    // ============ 嵌套NPT页错误处理 ============</span><br/><span leaf="">    // 如果处于嵌套guest模式且L1启用了NPT，使用嵌套NPT处理</span><br/><span leaf="">    if (guest_context-&gt;vcpu-&gt;nested_guest_mode &amp;&amp;</span><br/><span leaf="">        guest_context-&gt;vcpu-&gt;nested_npt_enabled) {</span><br/><span leaf="">        nested_npt::handle_nested_npt_page_fault(guest_context);</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而里面我们只需要像npt hook一样，找L2的rip和cr3,构造shadow page即可.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">大概是:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002377" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=b2b01737&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOxo4rh8sQp0jhf6hUiaKSTwLstYXsjjP2WXJ6WibhCEvjeiccice2PnzvmvhpDsBY2jbn8e5qJmlvvuoYFO4ia6Q2h27JQvluCZ5Jk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">构造shadow page,并且设置vmcb.tlbc设置成刷新tlb</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002376" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=82ab77c5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOoHEN4r2rRqXL0lotzKeYfkeZxrHicEQ8fK9YaTzeTKcw8CUUCzNicBkVHW8AWrWHoXnQHy8hOFfA3Rdcd49a708D6cm5IapCuE%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">然后走nvmexit即可.这个nvemexit是啥玩意后文会说。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">虚拟化Vmexit</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这很好理解,之前我们会伪装主板不支持vmexit指令,现在我们可以开始对他的虚拟化。总的来说,他分几步</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">vmsave</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在vmsave阶段我们按照规范,复制当前vmsave到target上</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002378" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=75fc37bd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMEw8zWQhmjBgp3cCtwiaP0MqBJ6fxadv8DichXw4m8ohy3zR2q8RIn8X1icEPkTXicxibqeibicQyA9ia2HNufsKjK0rib4ibusWpurjLBQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">vmload</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">同理,根据amd手册,复制到当前的vmcb-&gt;state_save里面</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    // FS, GS, TR, LDTR (包括所有隐藏状态)</span><br/><span leaf="">    // KernelGsBase, STAR, LSTAR, CSTAR, SFMASK</span><br/><span leaf="">    // SYSENTER_CS, SYSENTER_ESP, SYSENTER_EIP</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002374" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=19003443&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMYEBLnTpuyTlce0KxhFxrfK8oAlUlqia1d4kico7233uLxAUAIuDDIJibHBGcEp1UgwgjFSNfylcvZm9rdtUibdBhnbKOIaqoG6V4%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">vmrun</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这个比较复杂,让我们翻一下amd手册,</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002375" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=48844972&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOK7PdLblzAQ01auqUiatIXB1olq13f2y1mphEvc0mx5s014CuiaTtCmTbhE42gE2eTicOjKtCbEy1TU1Y8DZDxYDZv78mNIhXuaI%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">简单来说,我们先保存一下l1的guest_vmcb状态,然后给目前在用的vmcb赋值过去（也就是说,l1.vmcb = l2.vmcb)，并且标记一下进入嵌套模式(nested_guest_mode = true)</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    // RAX包含guest VMCB的物理地址</span><br/><span leaf="">    unsigned __int64 guest_vmcb_pa = guest_context-&gt;guest_register-&gt;Rax;</span><br/><span leaf="">    DebugPrint(&#34;[Nested] VMRUN with VMCB PA: %p\n&#34;, guest_vmcb_pa);</span><br/><span leaf="">    // 验证VMCB物理地址对齐(必须4KB对齐),这个地址在当前是不能直接范围的</span><br/><span leaf="">    if (guest_vmcb_pa &amp; 0xFFF) {</span><br/><span leaf="">        DebugPrint(&#34;[Nested] VMCB PA not aligned, injecting <a class="wx_topic_link" topic-id="mnbqymeu-1rfl0j" style="color: #576B95 !important;" data-topic="1" data-recommend="">#GP</a>\n&#34;);</span><br/><span leaf="">        inject_exception_gp(guest_context);</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    _svm_vmcb* source_vmcb =</span><br/><span leaf="">        (_svm_vmcb*)map_l1_gpa_page_to_hva(guest_context-&gt;vcpu, guest_vmcb_pa);</span><br/><span leaf="">    if (!source_vmcb) {</span><br/><span leaf="">        DebugPrint(&#34;[Nested] Failed to map guest VMCB for VMRUN\n&#34;);</span><br/><span leaf="">        inject_exception_gp(guest_context);</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    memcpy(guest_context-&gt;vcpu-&gt;l1_guest_vmcb, source_vmcb, sizeof(_svm_vmcb));</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">同时，我们的nested npt也是在这个时候初始化的</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    _svm_vmcb* l1_vmcb = guest_context-&gt;vcpu-&gt;l1_guest_vmcb;</span><br/><span leaf="">    // 初始化嵌套NPT</span><br/><span leaf="">    if (!nested_npt::init_nested_npt(guest_context-&gt;vcpu, l1_vmcb)) {</span><br/><span leaf="">        DebugPrint(&#34;[Nested] Failed to initialize nested NPT\n&#34;);</span><br/><span leaf="">        inject_exception_gp(guest_context);</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最后把当前状态备份一下,赋值</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    memcpy(guest_context-&gt;vcpu-&gt;l2_guest_vmcb, &amp;guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb, sizeof(_svm_vmcb));</span><br/><span leaf="">    // ============ 从 L1 的 guest VMCB 恢复完整的处理器状态 ============</span><br/><span leaf="">    // 根据 AMD SVM 规范，VMRUN 指令需要从 VMCB 加载完整的 guest 状态</span><br/><span leaf="">    //dest_state-&gt;Rip = src_state-&gt;Rip;</span><br/><span leaf="">    memcpy(&amp;guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.state_save, &amp;l1_vmcb-&gt;state_save, sizeof(_vmcb_state_save_area));</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">这样做的目的是,让CPU接下来执行l2的vmcb里面的内容,自然也就进入l2的虚拟化的环境了,直到遇到vmexit.</span></strong></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">nested_vmexit</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">当有新的vmexit触发,并且我们进入了嵌套模式的时候,需要判断一下L2的虚拟机是否启用了对应的vmexit:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002384" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d1db847d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNib39BudlSYPyLKSa81Oib78YjARibBPVE4SodYjpTeouGl0KOVNFTBboR0WC6znvczQOFY1yaxUJVUJj7IYNfVZ8jokbicB2WQWQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">如果启用了,走nested_vmexit，而这个函数的作用是，拷贝上下文，然后注入回l2，触发l2的vmexit。这样在l2里面做对应的vmexit操作如cpuid等乱七八糟的时候,他会再次触发l1的vmexit,从而被我们控制.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">简单来说:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">回填一下当前的vmcb(这个时候是l2的vmcb)</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    _svm_vmcb* l1_vmcb = guest_context-&gt;vcpu-&gt;l1_guest_vmcb;</span><br/><span leaf="">    if (l1_vmcb == nullptr) {</span><br/><span leaf="">        DebugPrint(&#34;[Nested] Error: L1 VMCB is null!\n&#34;);</span><br/><span leaf="">        inject_exception_gp(guest_context);</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span></code></pre><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">// 保存exit信息</span><br/><span leaf="">    l1_vmcb-&gt;control.ExitCode = exit_code;</span><br/><span leaf="">        l1_vmcb-&gt;control.ExitInfo1 =</span><br/><span leaf="">            guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.control.ExitInfo1;</span><br/><span leaf="">        l1_vmcb-&gt;control.ExitInfo2 =</span><br/><span leaf="">            guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.control.ExitInfo2;</span><br/><span leaf="">        l1_vmcb-&gt;control.ExitIntInfo =</span><br/><span leaf="">            guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.control.ExitIntInfo;</span><br/><span leaf="">    // 使用硬件在本次VMEXIT时给出的NRIP，避免在L2地址空间里手动解码指令长度</span><br/><span leaf="">    l1_vmcb-&gt;control.NRip =</span><br/><span leaf="">        guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.control.NRip;</span><br/><span leaf="">    //拷贝state到l1_vmcb里面</span><br/><span leaf="">    memcpy(&amp;l1_vmcb-&gt;state_save, &amp;guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.state_save, sizeof(_vmcb_state_save_area));</span><br/><span leaf="">    l1_vmcb-&gt;state_save.Rax = guest_context-&gt;guest_register-&gt;Rax;</span><br/><span leaf="">    _svm_vmcb* l1_guest_vmcb_hva =</span><br/><span leaf="">        (_svm_vmcb*)map_l1_gpa_page_to_hva(guest_context-&gt;vcpu, guest_context-&gt;vcpu-&gt;l1_guest_vmcb_pa);</span><br/><span leaf="">    if (l1_guest_vmcb_hva == nullptr) {</span><br/><span leaf="">        DebugPrint(&#34;[Nested] Failed to map L1 VMCB for nested VMEXIT writeback\n&#34;);</span><br/><span leaf="">        inject_exception_gp(guest_context);</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span><br/><span leaf="">    memcpy(l1_guest_vmcb_hva, l1_vmcb, sizeof(_svm_vmcb));</span></code></pre><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">这个l1_guest_vmcb_pa,不是真的l1_guest_vmcb的PA,是l1调用vm_load出来的</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">恢复之前的备份:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    // 恢复备份（回到进入L2前的L1 VMCB02）</span><br/><span leaf="">    memcpy(&amp;guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb,</span><br/><span leaf="">           guest_context-&gt;vcpu-&gt;l2_guest_vmcb,</span><br/><span leaf="">           sizeof(_svm_vmcb));</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这里有一个细节,在真实SVM上，<a class="wx_topic_link" topic-id="mnbqz2uc-irssc2" style="color: #576B95 !important;" data-topic="1" data-recommend="">#VMEXIT</a> 返回到 host 后，某些状态不会自动从 HSAVE 恢复，host 需要在 VMRUN 之后执行 VMSAVE/VMLOAD 来保存/恢复：FS/GS/TR/LDTR（含隐藏状态）、KernelGsBase、STAR/LSTAR/CSTAR/SFMASK、SYSENTER_*。我们这里会把活动 VMCB 从 L2 恢复为进入 L2 前的 L1 备份（vcpu-&gt;l2_guest_vmcb）。如果直接整块覆盖，会导致这些字段变成 L1 的，从而让后续的 VMSAVE 保存错对象，解决：在恢复 L1 备份前，先抓取 L2 的这些字段；恢复后再把字段覆写回去，让紧随其后的 L1 VMSAVE 看到的是 L2 的值。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">所以我们需要人工恢复一下</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf=""> auto* l1_state = &amp;guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.state_save;</span><br/><span leaf="">    const auto* l2_state = &amp;l2_saved_state_for_vmsave;</span><br/><span leaf="">    l1_state-&gt;FsSelector = l2_state-&gt;FsSelector;</span><br/><span leaf="">    l1_state-&gt;FsAttrib = l2_state-&gt;FsAttrib;</span><br/><span leaf="">    l1_state-&gt;FsLimit = l2_state-&gt;FsLimit;</span><br/><span leaf="">    l1_state-&gt;FsBase = l2_state-&gt;FsBase;</span><br/><span leaf="">    l1_state-&gt;GsSelector = l2_state-&gt;GsSelector;</span><br/><span leaf="">    l1_state-&gt;GsAttrib = l2_state-&gt;GsAttrib;</span><br/><span leaf="">    l1_state-&gt;GsLimit = l2_state-&gt;GsLimit;</span><br/><span leaf="">    l1_state-&gt;GsBase = l2_state-&gt;GsBase;</span><br/><span leaf="">    l1_state-&gt;TrSelector = l2_state-&gt;TrSelector;</span><br/><span leaf="">    l1_state-&gt;TrAttrib = l2_state-&gt;TrAttrib;</span><br/><span leaf="">    l1_state-&gt;TrLimit = l2_state-&gt;TrLimit;</span><br/><span leaf="">    l1_state-&gt;TrBase = l2_state-&gt;TrBase;</span><br/><span leaf="">    l1_state-&gt;LdtrSelector = l2_state-&gt;LdtrSelector;</span><br/><span leaf="">    l1_state-&gt;LdtrAttrib = l2_state-&gt;LdtrAttrib;</span><br/><span leaf="">    l1_state-&gt;LdtrLimit = l2_state-&gt;LdtrLimit;</span><br/><span leaf="">    l1_state-&gt;LdtrBase = l2_state-&gt;LdtrBase;</span><br/><span leaf="">    l1_state-&gt;KernelGsBase = l2_state-&gt;KernelGsBase;</span><br/><span leaf="">    l1_state-&gt;Star = l2_state-&gt;Star;</span><br/><span leaf="">    l1_state-&gt;LStar = l2_state-&gt;LStar;</span><br/><span leaf="">    l1_state-&gt;CStar = l2_state-&gt;CStar;</span><br/><span leaf="">    l1_state-&gt;SfMask = l2_state-&gt;SfMask;</span><br/><span leaf="">    l1_state-&gt;SysenterCs = l2_state-&gt;SysenterCs;</span><br/><span leaf="">    l1_state-&gt;SysenterEsp = l2_state-&gt;SysenterEsp;</span><br/><span leaf="">    l1_state-&gt;SysenterEip = l2_state-&gt;SysenterEip;</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后就是恢复rip，恢复npt到l1里面</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    // 恢复L0的NPT到VMCB</span><br/><span leaf="">    guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.control.NCr3 = guest_context-&gt;vcpu-&gt;npt_pa;</span><br/><span leaf="">    guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.control.TlbControl = 3;</span><br/><span leaf="">    if (guest_context-&gt;vcpu-&gt;l1_guest_vmcb) {</span><br/><span leaf="">        // 从 L2 VMEXIT 返回到 L1 host：应继续执行 L1 的 VMRUN 下一条指令。</span><br/><span leaf="">        // 更可靠的来源是：L0 当初拦截到 L1 的 VMRUN 时硬件给出的 NRIP。</span><br/><span leaf="">        // 该值在 handle_vmrun 中保存到 l1_vmrun_return_rip。</span><br/><span leaf="">        uintptr_t resume_rip = guest_context-&gt;vcpu-&gt;l1_vmrun_return_rip;</span><br/><span leaf="">        if (resume_rip == 0) {</span><br/><span leaf="">            // 兼容旧路径：使用进入 L2 前备份的 VMCB02.control.NRip。</span><br/><span leaf="">            resume_rip = guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.control.NRip;</span><br/><span leaf="">        }</span><br/><span leaf="">        if (resume_rip == 0) {</span><br/><span leaf="">            resume_rip = guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.state_save.Rip;</span><br/><span leaf="">            DebugPrint(&#34;[Nested] Warning: L1 resume RIP is zero, fallback RIP %p\n&#34;,</span><br/><span leaf="">                       resume_rip);</span><br/><span leaf="">        }</span><br/><span leaf="">        guest_context-&gt;vcpu-&gt;stack-&gt;guest_vmcb.state_save.Rip = resume_rip;</span><br/><span leaf="">    } else {</span><br/><span leaf="">        inject_exception_gp(guest_context);</span><br/><span leaf="">        return;</span><br/><span leaf="">    }</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最后rax指向guest_vmcb pa即可</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    guest_context-&gt;guest_register-&gt;Rax = guest_context-&gt;vcpu-&gt;l1_guest_vmcb_pa;</span></code></pre><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结果</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">跟simplesvm嵌套：</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002385" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=ca7b1aee&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMnibML0BdWZxgj66MY0FDpM0flLt4MicPpS4dWJhGkbgCLjA6Y11bbmUbeLmVc0HWHvYhHoHnricI5fj7e70bf2GP2wFXHf4gdT8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">simplesvm的vmexit:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002383" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=3c243d98&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVODcUucmwEq4AdK0XDfNIibarPAo6uIOhNwdjJJ7XEFAw7agXhow94ZjzEQFOLj3sr0X6eJ36fkqiaDXvpFNGBpBxaibRAUYpsnsY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002386" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=7b34d6e3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOibRhib0lQRPngbc8MwNwesMYJzc0BcMs6cKsF0UI7GpGXPQ0WYMBSL68l1jootUOqfTgjjToqsibO7g3CuBQAfsZUjSGvJRuA1k%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=52756263&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247486042%26idx%3D1%26sn%3D3486846e6c97495bf53864d09d0e1267">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 30 Mar 2026 10:02:00 +0800</pubDate>
    </item>
    <item>
      <title>从0开始开发VT调试器（二）</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485990&amp;idx=1&amp;sn=8b48a6c24677302fcddab9fd4dfdea46</link>
      <description></description>
      <content:encoded><![CDATA[<p>原创 <span>CrazyHarb</span> <span>2026-03-29 10:01</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=59163740&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVMibibrOSsUtzveEVPqLUfIcianbnOmcN0u6ibtibosKboYHmEDdrZazMib50zibzNZtBFacfF7rzUnq1gly9Tp4S0aMwickn1ggx9H7VQ%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <p style="margin-top:24.0pt;margin-bottom:24.0pt;margin-left:0.0pt;line-height:120%;"><span style="font-size:26.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">从0开始开发VT调试器（二）</span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_0;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">背景：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">上一章中，我们完成了基础的VT环境搭建，我们已经可以从guest中拦截一些简单的指令跳转到host了，本期我们加快速度将对调试链路进行进一步编写</span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_1;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">原理：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">在Ring3层，我们经常会用到各种调试工具，例如vs、x64dbg等，他们的单步原理基本上就是两种异常——#DB、#BP，这两种异常在触发时（其实所有异常都会这么走），会触发IDT表中的1号中断和3号中断，中断触发后，会先触发调试器，也就是windbg、x64dbg等(First Chance); 如果调试器未处理，会自动分发到触发异常的进程的ntdll的RtlDispatchException，最后如果进程没有处理，会再次触发Ring3调试器</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">我们简单画一下异常处理的流程图，即：</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:center;margin-left:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.653125" data-w="1280" style="width:552.010009765625px;height:360.010009765625px;" src="https://wechat2rss.xlab.app/img-proxy/?k=0ea28691&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVOPUU44ick5v8kibHnN6XE7DGniacggrxnrvocp4Obr6oCSsyibfXpsmGyewYjibYbicJmHWadoib4UWt63icTgHpHrCJj2Lyg4byAZsJo%2F640%3Fwx_fmt%3Djpeg"/></span></span><o:page></o:page></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_2;"><span style="font-size:18.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">VT下的异常流程:</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">通过原理已知在Ring3进程触发异常时，首先会通过触发#DB #BP，然后借助IDT进入windows内核，这便是我们可以触发VT调试的点，即，当触发#DB #BP时，VT host会接管异常，并分发到我们自己的调试器，当调试器处理完成后，VT负责注入异常或者继续执行</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:center;margin-left:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.315625" data-w="1280" style="width:552.010009765625px;height:174.0px;" src="https://wechat2rss.xlab.app/img-proxy/?k=193e5d72&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVNuyrN3ThWJhWaQ5eGdQGwCEeic0YPSwbBHudwg4ejMsqNVBhlnjfWE7wdFlbJpsqdf4LticN7lMiajV7r7aomrW6t85MXZYicUsEA%2F640%3Fwx_fmt%3Djpeg"/></span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_3;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">代码修改：</span></span></span></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_4;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">1. </span></span></span><span style="mso-bookmark:heading_4;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">Exception map</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">首先，我们找到setup_vmcs中的针对_vt_vmcs_exceptionbitmap的写入值，这个字段主要的作用是它记录的值中如果某一位为1，那么当idt触发对应的中断时，会进入vt host，例如当#DB触发时，如果_vt_vmcs_exceptionbitmap的值为 1 &lt;&lt; 1，那么#DB会进入VT的host的代码中，这里我们把exception_map的值改为 1 &lt;&lt; 1</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">uintptr_t exception_bitmap = 1 &lt;&lt; 1;                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_exceptionbitmap, exception_bitmap);</span></span></p></td></tr></tbody></table><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><o:page></o:page></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_5;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">2. </span></span></span><span style="mso-bookmark:heading_5;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">VT处理异常代码</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">我们在代码中需要对_vt_exitreason_exceptionornmi进行处理，即vt_vmm_handleexception函数，在该函数中，我们需要对#DB进行判断，并打印一条日志，并按原属性进行注入事件，在我们修改的代码中可以看到，判断了type(Hardware)和vector(#DB)，这个type和vector是一一对应的，具体值需要参考intel的手册，这里就不再展开了</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void vt_vmm_handleexception(_vt_vmhandle_guestcontext* guest_context) {                  </span><span leaf=""><br/></span><span leaf="">size_t exit_exception_value = 0;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_vmexitintrinfo, &amp;exit_exception_value);                  </span><span leaf=""><br/></span><span leaf="">const _vt_vmexit_interruptioninformationfield exception = { exit_exception_value };                  </span><span leaf=""><br/></span><span leaf="">const _vt_interruption_type interruption_type = (_vt_interruption_type)(exception.fields.interruption_type);                  </span><span leaf=""><br/></span><span leaf="">const _vt_interruption_vector vector = (_vt_interruption_vector)(exception.fields.vector);                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR guest_inst_length;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((ULONG_PTR)_vt_vmcs_field::_vt_vmcs_vmexitinstructionlen, &amp;guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR error_code = 0;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((ULONG32)_vt_vmcs_field::_vt_vmcs_vmexitintrerrorcode, &amp;error_code);                  </span><span leaf=""><br/></span><span leaf="">if (interruption_type == _vt_interruption_type::_vt_interruption_hardwareexception) {                  </span><span leaf=""><br/></span><span leaf="">// Hardware exception                  </span><span leaf=""><br/></span><span leaf="">if (vector == _vt_interruption_vector::_vt_intteruptionvec_debugexception)                  </span><span leaf=""><br/></span><span leaf="">{                  </span><span leaf=""><br/></span><span leaf="">DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, &#34;GetInt1 %p\n&#34;, PsGetCurrentProcessId());                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_injectinterruption(_vt_interruption_type::_vt_interruption_hardwareexception, vector, exception.fields.error_code_valid, error_code);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_vmentryinstructionlen, guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">else {                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_injectinterruption(interruption_type, vector, exception.fields.error_code_valid, error_code);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_vmentryinstructionlen, guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">else {                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_injectinterruption(interruption_type, vector, exception.fields.error_code_valid, error_code);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_vmentryinstructionlen, guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}</span></span><o:page></o:page></p></td></tr></tbody></table><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_6;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">3. </span></span></span><span style="mso-bookmark:heading_6;"><span style="font-size:16.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">代码测试</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">我们将驱动在测试环境中加载起来，此时我们需要触发#DB，才能在驱动的输出中看是否拦截到了，所以，在这里需要打开调试器对文件进行单步，笔者使用了x64dbg对一个exe进行调试，可以看到，笔者单步两次后，debug中是可以打印出对应的日志的，证明此时host拦截到正确的数据了</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:center;margin-left:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.6430379746835443" data-w="1185" style="width:552.010009765625px;height:354.010009765625px;" src="https://wechat2rss.xlab.app/img-proxy/?k=a5c64012&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNY9fiajLzdMnIhia1b6ztwZBHs9TaUCENtEfB3bU4IN9FlDafUK2bXprO74C7tz7qG34gRKdgAGzC2iciapiaTSVtyTuN250CtmRBY%2F640%3Fwx_fmt%3Dpng"/></span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_7;"><span style="font-size:18.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">Guest代码转向</span></span></span><o:page></o:page></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">现在，我们开始编写guest代码，guest的流程主要为，host注入guest转向，guest代码跳转到我们自己的stub上，stub最后触发host处理，最后host恢复环境，然后ring3继续执行，这里触发host处理，我们用vmcall指令即可</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">首先，我们在汇编中添加：</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">asm_dbg_entry proc                  </span><span leaf=""><br/></span><span leaf="">mov rcx, 1340h                  </span><span leaf=""><br/></span><span leaf="">vmcall                  </span><span leaf=""><br/></span><span leaf="">int 3 ;不该执行到这里                  </span><span leaf=""><br/></span><span leaf="">asm_dbg_entry endp</span></span></p></td></tr></tbody></table><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">其次，我们在#DB中添加注入RIP的代码</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">....                  </span><span leaf=""><br/></span><span leaf="">   if (interruption_type == _vt_interruption_type::_vt_interruption_hardwareexception) {                  </span><span leaf=""><br/></span><span leaf="">// Hardware exception                  </span><span leaf=""><br/></span><span leaf="">if (vector == _vt_interruption_vector::_vt_intteruptionvec_debugexception)                  </span><span leaf=""><br/></span><span leaf="">{                  </span><span leaf=""><br/></span><span leaf="">DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, &#34;GetInt1 %p\n&#34;, PsGetCurrentProcessId());                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestrip, (ULONG_PTR)&amp;asm_dbg_entry);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">else {                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_injectinterruption(interruption_type, vector, exception.fields.error_code_valid, error_code);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_vmentryinstructionlen, guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">}</span></span></p></td></tr></tbody></table><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_8;"><span style="font-size:18.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">KVA功能的影响</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">在注入代码后，我们需要考虑的一个问题，就是KVA的问题，如果windows启动了KVA，那么我们还需要更改cr3到kernel态下的CR3，毕竟shadow Cr3只有当前进程的ring3地址，以及ntkernel中的.KVSCode段的地址，我们的驱动不在这个段中，所以需要切CR3；如果没有开启，那么就不需要切了，可以用下面的ps脚本进行判断</span></span><o:page></o:page></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">Install-Module SpeculationControl -Force                  </span><span leaf=""><br/></span><span leaf="">Import-Module SpeculationControl                  </span><span leaf=""><br/></span><span leaf="">Get-SpeculationControlSettings</span></span></p></td></tr></tbody></table><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">笔者的电脑，执行后发现没有开启KVA，查阅相关资料发现在最新的CPU上，已经修复了这个漏洞，所以，windows不再开启了</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:center;margin-left:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.7710557532621589" data-w="843" style="width:552.010009765625px;height:425.010009765625px;" src="https://wechat2rss.xlab.app/img-proxy/?k=a04b8be6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOBOmCS0K6ttvPZQvr8pv7eibw6COmzS1iafQibZ1rkJEZqff8Rjv9KENgkY1lAxq9Bfp3gucjL1nDXBjYL2iac65crCOB316uV3GQ%2F640%3Fwx_fmt%3Dpng"/></span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_9;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">需要保留的寄存器：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">以上的代码展示了核心部分，但不是完整流程，因为在vmcall后，host需要恢复现场内容，所以需要将现场数据进行保存</span></span></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_10;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">1. </span></span></span><span style="mso-bookmark:heading_10;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">eflags寄存器</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">该寄存器必然会被修改，因为至少tf位会被置为0，否则当注入guest后，会再次触发#DB，最后走入异常状态，我们根据Intel手册中对eflags的描述，我们将Eflags置为2，原始值保存</span></span><o:page></o:page></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_11;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">2. </span></span></span><span style="mso-bookmark:heading_11;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">DR寄存器</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">和eflags的理由相同，当启动Dr时，如果地址被ring3精心构造，那么我们会在stub的某个地方触发#DB异常，导致异常状态，我们把Dr7改为0x400，屏蔽掉其他的Dr寄存器，避免触发</span></span></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_12;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">3. </span></span></span><span style="mso-bookmark:heading_12;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">Guest context寄存器</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">包含cs和ss、rip、rsp、rcx，为了在vmcall的时候直接恢复，所以这几个段需要保存，这里可能会有读者有些疑问，为什么rcx也需要保存呢？因为我们在再次进入host时，用的vmcall，为了判断编号，所以用的时rcx，所以这个rcx是需要保存的</span></span></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_13;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">4. </span></span></span><span style="mso-bookmark:heading_13;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">guest_exceptionreason、error_code、指令长度等</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">这些都和guest注入异常有关系，所以也需要进行保存，这样可以避免后续未处理时，注入错了异常</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">我们总结一下整体的结构</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">struct DBG_Stack {                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR Dr7;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR guest_inst_length;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR exception_type;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR exception_vector;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR csbase;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR cslimit;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR csselector;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR ssselector;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR csarbytes;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR ssbase;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR sslimit;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR ssarbytes;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR ip;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR eflags;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR sp;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR original_rcx;                  </span><span leaf=""><br/></span><span leaf="">};</span></span><o:page></o:page></p></td></tr></tbody></table><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_14;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">申请并填充栈</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">为了保存我们需要的数据，我们需要将我们的数据保存在栈上，并为了避免返回Ring3的时候，Ring3找到相关的数据，所以我们需要自己申请一块地址，保存context</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">PHYSICAL_ADDRESS phys = { 0 };                  </span><span leaf=""><br/></span><span leaf="">phys.QuadPart = ~0ULL;                  </span><span leaf=""><br/></span><span leaf="">auto stack = (ULONG_PTR)MmAllocateContiguousMemory(PAGE_SIZE, phys);                  </span><span leaf=""><br/></span><span leaf="">DBG_Stack* guest_stack = (DBG_Stack*)(stack + PAGE_SIZE - sizeof(DBG_Stack));                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestdr7, &amp;guest_stack-&gt;Dr7);                  </span><span leaf=""><br/></span><span leaf="">guest_stack-&gt;guest_inst_length = guest_inst_length;                  </span><span leaf=""><br/></span><span leaf="">guest_stack-&gt;exception_type = (ULONG_PTR)interruption_type;                  </span><span leaf=""><br/></span><span leaf="">guest_stack-&gt;exception_vector = (ULONG_PTR)vector;                  </span><span leaf=""><br/></span><span leaf="">guest_stack-&gt;ip = (ULONG_PTR)guest_context-&gt;ip;                  </span><span leaf=""><br/></span><span leaf="">guest_stack-&gt;eflags = guest_context-&gt;flag_reg.all;                  </span><span leaf=""><br/></span><span leaf="">guest_stack-&gt;sp = (ULONG_PTR)guest_context-&gt;stack-&gt;gp_regs.Rsp;                  </span><span leaf=""><br/></span><span leaf="">guest_stack-&gt;original_rcx = guest_context-&gt;stack-&gt;gp_regs.Rcx;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestcsbase, &amp;guest_stack-&gt;csbase);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestssbase, &amp;guest_stack-&gt;ssbase);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestcsarbytes, &amp;guest_stack-&gt;csarbytes);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestssarbytes, &amp;guest_stack-&gt;ssarbytes);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestcslimit, &amp;guest_stack-&gt;cslimit);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestsslimit, &amp;guest_stack-&gt;sslimit);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestcsselector, &amp;guest_stack-&gt;csselector);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestssselector, &amp;guest_stack-&gt;ssselector);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_guestdr7, &amp;guest_stack-&gt;Dr7);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcsselector, asm_readcs());                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestssselector, asm_readss());                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcsarbytes, vmx_getsegment_accessright(asm_readcs()));                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestssarbytes, vmx_getsegment_accessright(asm_readss()));                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcslimit, __segmentlimit(asm_readcs()));                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestsslimit, __segmentlimit(asm_readss()));                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestdr7, 0x400);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestrflags, 2);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestrsp, (ULONG_PTR)guest_stack);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestrip, (ULONG_PTR)&amp;asm_dbg_entry);</span></span><o:page></o:page></p></td></tr></tbody></table><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_15;"><span style="font-size:18.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">VMCALL代码的实现：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">首先，我们先针对VMACALL做一下接管，之前的逻辑是直接注入GP异常，现在不需要了</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void vt_vmm_handlevmexit(_vt_vmhandle_guestcontext* guest_context) {                  </span><span leaf=""><br/></span><span leaf="">....                  </span><span leaf=""><br/></span><span leaf="">case _vt_vmx_exitreason::_vt_exitreason_vmcall:                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_handle_vmcall(guest_context);                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">   }</span></span></p></td></tr></tbody></table><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><o:page></o:page></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">我们开始继续封装handle_vmcall函数，当得到rcx为0x1340时，我们直接注入系统异常，后续ring0、ring3的调试器就可以接到内容了</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">#define vmcall_db_dispatch_system 0x1340                  </span><span leaf=""><br/></span><span leaf="">void vt_vmm_handle_vmcall(_vt_vmhandle_guestcontext* guest_context) {                  </span><span leaf=""><br/></span><span leaf="">const auto hypercall_number = guest_context-&gt;stack-&gt;gp_regs.Rcx;                  </span><span leaf=""><br/></span><span leaf="">switch (hypercall_number) {                  </span><span leaf=""><br/></span><span leaf="">case vmcall_db_dispatch_system:                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_handle_DB_exception(guest_context, guest_context-&gt;stack-&gt;gp_regs.Rsp, true);                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">default:                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}</span></span></p></td></tr></tbody></table><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">我们继续封装vt_vmm_handle_DB_exception用于处理相关逻辑，其中封装了一个vt_vmm_restore_context函数，用于处理堆栈上的数据恢复guest的状态，段、栈、ip、flags、原始rcx等</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void vt_vmm_restore_context(_vt_vmhandle_guestcontext* guest_context, ULONG_PTR guestRsp, bool dispatch_into_system, ULONG_PTR&amp; exception_reason, ULONG_PTR&amp; error_code) {                  </span><span leaf=""><br/></span><span leaf="">DBG_Stack* dbgFrame = (DBG_Stack*)guestRsp;                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;stack-&gt;gp_regs.Rcx = dbgFrame-&gt;original_rcx;                  </span><span leaf=""><br/></span><span leaf="">exception_reason = (ULONG_PTR)dbgFrame-&gt;exception_type;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG_PTR)_vt_vmcs_field::_vt_vmcs_guestrip, (ULONG_PTR)dbgFrame-&gt;ip);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG_PTR)_vt_vmcs_field::_vt_vmcs_guestcsselector, (ULONG_PTR)dbgFrame-&gt;csselector);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG_PTR)_vt_vmcs_field::_vt_vmcs_guestrflags, (ULONG_PTR)dbgFrame-&gt;eflags);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG_PTR)_vt_vmcs_field::_vt_vmcs_guestrsp, (ULONG_PTR)dbgFrame-&gt;sp);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG_PTR)_vt_vmcs_field::_vt_vmcs_guestssselector, (ULONG_PTR)dbgFrame-&gt;ssselector);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_vmentryinstructionlen, dbgFrame-&gt;guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestdr7, dbgFrame-&gt;Dr7);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestcslimit, dbgFrame-&gt;cslimit);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestcsarbytes, dbgFrame-&gt;csarbytes);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestsslimit, dbgFrame-&gt;sslimit);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestssarbytes, dbgFrame-&gt;ssarbytes);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestcsbase, dbgFrame-&gt;csbase);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_guestssbase, dbgFrame-&gt;ssbase);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">void vt_vmm_handle_DB_exception(_vt_vmhandle_guestcontext* guest_context, ULONG_PTR guestRsp, bool inject_into_system) {                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR excetpion_reason;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR error_code;                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_restore_context(guest_context, guestRsp, inject_into_system, excetpion_reason, error_code);                  </span><span leaf=""><br/></span><span leaf="">if (inject_into_system)                  </span><span leaf=""><br/></span><span leaf="">{                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_injectinterruption(_vt_interruption_type::_vt_interruption_hardwareexception, _vt_interruption_vector::_vt_intteruptionvec_debugexception, false, error_code);                  </span><span leaf=""><br/></span><span leaf="">DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, &#34;vt_vmm_handle_DB_exception\n&#34;);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}</span></span><o:page></o:page></p></td></tr></tbody></table><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_16;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">运行效果：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">我们加载驱动后，打开x64dbg，并开始调试任意exe，我们在代码中，接到#DB异常时，打印了一条GetInt，在vmcall恢复的时候，打印了一条vt_vmm_handle_DB_exception，我们在x64dbg下执行两次单步后，发现windbg中日志已经可以正常打印了，切x64dbg下一切正常，没有任何的调试问题，我们再执行两次，发现rcx也是没有被变动的，证明，本次代码改动已经完成了</span></span><o:page></o:page></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:center;margin-left:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5021186440677966" data-w="1416" style="width:552.010009765625px;height:277.0px;" src="https://wechat2rss.xlab.app/img-proxy/?k=bb4c37c3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVP8TUoxvFt49mPoju3fnNXa2Uo4M5LWt6fKIFHkLlA2QG45KT9jwpUG4ES7tcHQQ7N6FewqbicTD1A5PTnGqH4sGybeRebcIdaA%2F640%3Fwx_fmt%3Dpng"/></span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_17;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">工程代码：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf=""><a href="https://git.key08.com/CrazyHarb/VirtualizeDBG" target="_blank">https://git.key08.com/CrazyHarb/VirtualizeDBG</a> v0.0.2</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><o:page></o:page></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=87d4d6e5&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247485990%26idx%3D1%26sn%3D8b48a6c24677302fcddab9fd4dfdea46">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 29 Mar 2026 10:01:00 +0800</pubDate>
    </item>
    <item>
      <title>从0开始开发VT调试器（一）</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485989&amp;idx=1&amp;sn=244f30b755ffa00e6cfcd7898c9a81d9</link>
      <description>从0开始开发VT调试器（一）背景：      这个项目其实很早就想写了，但一直没有机会，最近忙里偷闲赶紧写一下</description>
      <content:encoded><![CDATA[<p>原创 <span>CrazyHarb</span> <span>2026-03-28 10:01</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=fd27963d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2F1woCcbOsjVN2qGhqqick9C4Sicj2aGqy7FlKFicLiaO5MVC7npUIutpy82xGbDcjzzg3co85H2Endh5lR6lVKQOLt0AHJPAMl33lfGlBQm4MicP4%2F0%3Fwx_fmt%3Djpeg"/></p>
  <p>从0开始开发VT调试器（一）背景：      这个项目其实很早就想写了，但一直没有机会，最近忙里偷闲赶紧写一下</p>
  <p style="margin-top:24.0pt;margin-bottom:24.0pt;margin-left:0.0pt;line-height:120%;"><span style="font-size:26.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">从0开始开发VT调试器（一）</span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_0;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">背景：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">这个项目其实很早就想写了，但一直没有机会，最近忙里偷闲赶紧写一下，目前相关的中文资料不多，所以也当记录一下，避免未来自己也遗忘了。本文</span></span><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">不会</span></span><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">完成一个完全可用的调试器，仅做技术验证VT调试的链路不会涉及EPT等其他功能，及抛砖引玉供大家讨论，内容有瑕疵的地方，请帮忙指出。</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">既然是VT调试器，那么必然少不了虚拟化相关的代码，我们就先从虚拟化开始吧！之前已经有相关的资料如何进入虚拟化，各位可以先参考一下下面的参考资料</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf=""><a href="https://mp.weixin.qq.com/s/PVIkx0FDnZzo5idM3-NSSg" target="_blank">https://mp.weixin.qq.com/s/PVIkx0FDnZzo5idM3-NSSg</a> (huoji:《国庆专题: 深度了解”核晶“的工作原理并且手动实现一个自己的&#34;核晶&#34;》)</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf=""><a href="https://mp.weixin.qq.com/s/nIovO0W8QW2YemZ5HCYkQg" target="_blank">https://mp.weixin.qq.com/s/nIovO0W8QW2YemZ5HCYkQg</a> (手工编写linux下的intel虚拟化驱动)</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf=""><a href="https://mp.weixin.qq.com/s/mowc1iUJ1F2QghdyWgrrjw" target="_blank">https://mp.weixin.qq.com/s/mowc1iUJ1F2QghdyWgrrjw</a> (手工编写linux下的intel虚拟化驱动(二))</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf=""><a href="https://mp.weixin.qq.com/s/a39NgPrKgk2wQNMD8nj5YA" target="_blank">https://mp.weixin.qq.com/s/a39NgPrKgk2wQNMD8nj5YA</a> (INTEL CPU虚拟化特性研究&amp;初探 (三))</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf=""><a href="https://github.com/CrazyHarb/VmxProject" target="_blank">https://github.com/CrazyHarb/VmxProject</a> (linux下简易VT源码)</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">接下来，在正式的代码处理前，我们本章节将对VT进行简易回顾，简单的讲一下进入VT的代码</span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_1;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">环境配置：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">vs2022 + WDK + vmware + windbg</span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">这里就不再赘述了，按照网上的来就可以了，实在不行就问AI也行，我们直接进入代码编写吧</span></span><o:page></o:page></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_2;"><span style="font-size:18.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">VMX环境支持检测：</span></span></span></p><p style="mso-list:l0 level1 lfo1;margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;text-indent:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf="">1</span></span><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">Cpuid 1号功能的vmx位</span></span></p><p style="mso-list:l1 level1 lfo1;margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;text-indent:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf="">1</span></span><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">Msr的ia32_msr_vmx_basic功能，判断memory_type</span></span></p><p style="mso-list:l2 level1 lfo1;margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;text-indent:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf="">1</span></span><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">Msr的ia32_msr_feature_control lock位及enable_vmxon位</span></span></p><p style="mso-list:l3 level1 lfo1;margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;text-indent:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf="">1</span></span><span style="font-size:11.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">Msr ia32_msr_vmx_ept_vpid_cap功能，判断是否支持EPT</span></span></p><p style="mso-list:l4 level1 lfo1;margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;text-indent:0.0pt;line-height:120%;"><span style="font-family:Times New Roman;mso-ascii-font-family:Times New Roman;mso-fareast-font-family:等距更纱黑体 SC;font-variant:normal;text-transform:none;"><span leaf="">1</span></span><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">具体的结构大家可以参考前面的文章，这就不再赘述了</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">Java                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">bool set_feature_control_lockbits() {                  </span><span leaf=""><br/></span><span leaf="">for (unsigned iter = 0; iter &lt; KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); iter++) {                  </span><span leaf=""><br/></span><span leaf="">PROCESSOR_NUMBER processor_number;                  </span><span leaf=""><br/></span><span leaf="">GROUP_AFFINITY affinity, old_affinity;                  </span><span leaf=""><br/></span><span leaf="">KeGetProcessorNumberFromIndex(iter, &amp;processor_number);                  </span><span leaf=""><br/></span><span leaf="">RtlSecureZeroMemory(&amp;affinity, sizeof(GROUP_AFFINITY));                  </span><span leaf=""><br/></span><span leaf="">affinity.Group = processor_number.Group;                  </span><span leaf=""><br/></span><span leaf="">affinity.Mask = (KAFFINITY)1 &lt;&lt; processor_number.Number;                  </span><span leaf=""><br/></span><span leaf="">KeSetSystemGroupAffinityThread(&amp;affinity, &amp;old_affinity);                  </span><span leaf=""><br/></span><span leaf="">_ia32_feature_control_msr vmx_feature_control = {                  </span><span leaf=""><br/></span><span leaf="">__readmsr(ia32_msr_feature_control) };                  </span><span leaf=""><br/></span><span leaf="">if (vmx_feature_control.fields.lock == false) {                  </span><span leaf=""><br/></span><span leaf="">vmx_feature_control.fields.lock = true;                  </span><span leaf=""><br/></span><span leaf="">__writemsr(ia32_msr_feature_control,                  </span><span leaf=""><br/></span><span leaf="">vmx_feature_control.all);                  </span><span leaf=""><br/></span><span leaf="">vmx_feature_control.all =                  </span><span leaf=""><br/></span><span leaf="">__readmsr(ia32_msr_feature_control);                  </span><span leaf=""><br/></span><span leaf="">if (vmx_feature_control.fields.lock == false) {                  </span><span leaf=""><br/></span><span leaf="">DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, &#34;[VirtualizeDBG] can&#39;t set lockbit in %d \n&#34;, iter);                  </span><span leaf=""><br/></span><span leaf="">return false;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">KeRevertToUserGroupAffinityThread(&amp;old_affinity);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">return true;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">bool issupportept() {                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmxeptvpidcap_msr vmx_eptvpidcap_msr = {                  </span><span leaf=""><br/></span><span leaf="">__readmsr(ia32_msr_vmx_ept_vpid_cap) };                  </span><span leaf=""><br/></span><span leaf="">if (!vmx_eptvpidcap_msr.fields.support_page_walk_length4 ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_write_back_memory_type ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_invept ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_single_context_invept ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_all_context_invept ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_invvpid ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_individual_address_invvpid ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_single_context_invvpid ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_all_context_invvpid ||                  </span><span leaf=""><br/></span><span leaf="">!vmx_eptvpidcap_msr.fields.support_single_context_retaining_globals_invvpid) {                  </span><span leaf=""><br/></span><span leaf="">DbgPrintEx(DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL, &#34;EPT Setting: %p \n&#34;, (ULONG64)vmx_eptvpidcap_msr.all);                  </span><span leaf=""><br/></span><span leaf="">return false;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">else {                  </span><span leaf=""><br/></span><span leaf="">return true;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">bool checkVMXFeature() {                  </span><span leaf=""><br/></span><span leaf="">int registers[4];                  </span><span leaf=""><br/></span><span leaf="">__cpuidex(registers, 1, 0);                  </span><span leaf=""><br/></span><span leaf="">bool result = false;                  </span><span leaf=""><br/></span><span leaf="">do {                  </span><span leaf=""><br/></span><span leaf="">_vt_cpu_features cpu_features = { static_cast</span><ulong32><span leaf="">(registers[2]) };          </span><span leaf=""><br/></span><span leaf="">if (!cpu_features.fields.vmx) {          </span><span leaf=""><br/></span><span leaf="">break;          </span><span leaf=""><br/></span><span leaf="">}          </span><span leaf=""><br/></span><span leaf="">_ia32_vmbasic_msr vmx_basic_msr = { __readmsr(ia32_msr_vmx_basic) };          </span><span leaf=""><br/></span><span leaf="">if ((_ia32_memory_type)vmx_basic_msr.fields.memory_type !=          </span><span leaf=""><br/></span><span leaf="">_ia32_memory_type::write_back) {          </span><span leaf=""><br/></span><span leaf="">break;          </span><span leaf=""><br/></span><span leaf="">}          </span><span leaf=""><br/></span><span leaf="">_ia32_feature_control_msr vmx_feature_control = {          </span><span leaf=""><br/></span><span leaf="">__readmsr(ia32_msr_feature_control) };          </span><span leaf=""><br/></span><span leaf="">if (!vmx_feature_control.fields.lock) {          </span><span leaf=""><br/></span><span leaf="">bool status = set_feature_control_lockbits();          </span><span leaf=""><br/></span><span leaf="">if (!status) {          </span><span leaf=""><br/></span><span leaf="">break;          </span><span leaf=""><br/></span><span leaf="">}          </span><span leaf=""><br/></span><span leaf="">}          </span><span leaf=""><br/></span><span leaf="">if (!vmx_feature_control.fields.enable_vmxon) {          </span><span leaf=""><br/></span><span leaf="">break;          </span><span leaf=""><br/></span><span leaf="">}          </span><span leaf=""><br/></span><span leaf="">if (!issupportept()) {          </span><span leaf=""><br/></span><span leaf="">break;          </span><span leaf=""><br/></span><span leaf="">}          </span><span leaf=""><br/></span><span leaf="">result = true;          </span><span leaf=""><br/></span><span leaf="">} while (false);          </span><span leaf=""><br/></span><span leaf="">return result;          </span><span leaf=""><br/></span><span leaf="">}</span></ulong32></span><o:page></o:page></p></td></tr></tbody></table><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_3;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">虚拟化环境初始化：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">在进入虚拟化之前，我们需要对vmcs进行初始化，配置host、guest环境后再进入host</span></span></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_4;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">1. </span></span></span><span style="mso-bookmark:heading_4;"><span style="font-size:16.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">首先我们开启vmx的Crx标志位</span></span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void enable_vmx() {                  </span><span leaf=""><br/></span><span leaf="">uintptr_t cr0 = __readcr0();                  </span><span leaf=""><br/></span><span leaf="">uintptr_t cr4 = __readcr4();                  </span><span leaf=""><br/></span><span leaf="">cr0 |= __readmsr(ia32_msr_vmx_cr0_fixed0);                  </span><span leaf=""><br/></span><span leaf="">cr0 &amp;= __readmsr(ia32_msr_vmx_cr0_fixed1);                  </span><span leaf=""><br/></span><span leaf="">cr4 |= __readmsr(ia32_msr_vmx_cr4_fixed0);                  </span><span leaf=""><br/></span><span leaf="">cr4 &amp;= __readmsr(ia32_msr_vmx_cr4_fixed1);                  </span><span leaf=""><br/></span><span leaf="">__writecr0(cr0);                  </span><span leaf=""><br/></span><span leaf="">__writecr4(cr4);                  </span><span leaf=""><br/></span><span leaf="">}</span></span></p></td></tr></tbody></table><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_5;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">2. </span></span></span><span style="mso-bookmark:heading_5;"><span style="font-size:16.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">分配栈、vmcs、vmxon空间</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">栈空间我们定义为0x6000大小，剩下两个定义为0x1000，并对头写入标志位即可，栈空间主要是为了我们进入host时，供CPU使用</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void init_vmxon(_vt_vcpu_context* vcpu) {                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmbasic_msr vmx_basic = {                  </span><span leaf=""><br/></span><span leaf="">__readmsr(ia32_msr_vmx_basic) };                  </span><span leaf=""><br/></span><span leaf="">PHYSICAL_ADDRESS phys = { 0 };                  </span><span leaf=""><br/></span><span leaf="">phys.QuadPart = ~0ULL;                  </span><span leaf=""><br/></span><span leaf="">vcpu-&gt;vmxon = (__vt_vmcs_t*)MmAllocateContiguousMemory(PAGE_SIZE, phys);                  </span><span leaf=""><br/></span><span leaf="">RtlZeroMemory(vcpu-&gt;vmxon, PAGE_SIZE);                  </span><span leaf=""><br/></span><span leaf="">auto mmPhyAddress = MmGetPhysicalAddress((PVOID)vcpu-&gt;vmxon);                  </span><span leaf=""><br/></span><span leaf="">vcpu-&gt;vmxon_physical = mmPhyAddress.QuadPart;                  </span><span leaf=""><br/></span><span leaf="">if (!vcpu-&gt;vmxon_physical) {                  </span><span leaf=""><br/></span><span leaf="">return;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">vcpu-&gt;vmxon-&gt;header.all = vmx_basic.fields.revision_identifier;                  </span><span leaf=""><br/></span><span leaf="">// function                  </span><span leaf=""><br/></span><span leaf="">if (__vmx_on((unsigned long long*) &amp; vcpu-&gt;vmxon_physical)) {                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">void init_vmxcs(_vt_vcpu_context* vcpu) {                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmbasic_msr vmx_basic = {                  </span><span leaf=""><br/></span><span leaf="">__readmsr(ia32_msr_vmx_basic) };                  </span><span leaf=""><br/></span><span leaf="">PHYSICAL_ADDRESS phys = { 0 };                  </span><span leaf=""><br/></span><span leaf="">phys.QuadPart = ~0ULL;                  </span><span leaf=""><br/></span><span leaf="">vcpu-&gt;vmcs = (__vt_vmcs_t*)MmAllocateContiguousMemory(PAGE_SIZE, phys);                  </span><span leaf=""><br/></span><span leaf="">RtlZeroMemory(vcpu-&gt;vmcs, PAGE_SIZE);                  </span><span leaf=""><br/></span><span leaf="">vcpu-&gt;stack = (void*)MmAllocateContiguousMemory(kernel_stack_szie, phys);                  </span><span leaf=""><br/></span><span leaf="">auto mmPhyAddress = MmGetPhysicalAddress((PVOID)vcpu-&gt;vmcs);                  </span><span leaf=""><br/></span><span leaf="">vcpu-&gt;vmcs_physical = mmPhyAddress.QuadPart;                  </span><span leaf=""><br/></span><span leaf="">vcpu-&gt;vmcs-&gt;header.all = vmx_basic.fields.revision_identifier;                  </span><span leaf=""><br/></span><span leaf="">if (__vmx_vmclear((unsigned long long*) &amp; vcpu-&gt;vmcs_physical)) {                  </span><span leaf=""><br/></span><span leaf="">return;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">if (__vmx_vmptrld((unsigned long long*) &amp; vcpu-&gt;vmcs_physical)) {                  </span><span leaf=""><br/></span><span leaf="">return;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">return;                  </span><span leaf=""><br/></span><span leaf="">}</span></span></p></td></tr></tbody></table><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_6;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">3. </span></span></span><span style="mso-bookmark:heading_6;"><span style="font-size:16.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">初始化vmcs内容</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">这里简单讲一下主要就是将vmcs中的数据进行填入，包括guest和host，我们直接上代码，由于篇幅有限，这里不再展开各个字段的含义，如果有需要进一步了解，可以参考上面的几个链接，或者intel手册</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void setup_vmcs(uintptr_t guest_stack_pointer, uintptr_t guest_instruction_pointer, _vt_vcpu_context* vcpu) {                  </span><span leaf=""><br/></span><span leaf="">__pseudo_descriptor_64_t gdtr, idtr;                  </span><span leaf=""><br/></span><span leaf="">_sgdt(&amp;gdtr);                  </span><span leaf=""><br/></span><span leaf="">__sidt(&amp;idtr);                  </span><span leaf=""><br/></span><span leaf="">//asm_lidt(&amp;vcpu-&gt;idtr);                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmbasic_msr vmx_basic_msr = {                  </span><span leaf=""><br/></span><span leaf="">__readmsr(ia32_msr_vmx_basic) };                  </span><span leaf=""><br/></span><span leaf="">ULONG use_true_msrs = vmx_basic_msr.fields.vmx_capability_hint;                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_vmentry_controls vm_entryctl_requested = { 0 };                  </span><span leaf=""><br/></span><span leaf="">//vm_entryctl_requested.fields.load_debug_controls = true;                  </span><span leaf=""><br/></span><span leaf="">vm_entryctl_requested.fields.ia32e_mode_guest = true;                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_vmentry_controls vm_entryctl;                  </span><span leaf=""><br/></span><span leaf="">vm_entryctl.all = vmx_adjust_controlvalue(                  </span><span leaf=""><br/></span><span leaf="">use_true_msrs ? ia32_msr_vmx_true_entry_ctrl : ia32_msr_vmx_entry_ctrl,                  </span><span leaf=""><br/></span><span leaf="">vm_entryctl_requested.all);                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_vmexit_controls vm_exitctl_requested = { 0 };                  </span><span leaf=""><br/></span><span leaf="">vm_exitctl_requested.fields.host_address_space_size = true;                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_vmexit_controls vm_exitctl;                  </span><span leaf=""><br/></span><span leaf="">vm_exitctl.all = vmx_adjust_controlvalue(                  </span><span leaf=""><br/></span><span leaf="">use_true_msrs ? ia32_msr_vmx_true_exit_ctrl : ia32_msr_vmx_exit_ctrl,                  </span><span leaf=""><br/></span><span leaf="">vm_exitctl_requested.all);                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_pinbased_controls vm_pinctl_requested = { 0 };                  </span><span leaf=""><br/></span><span leaf="">// vm_pinctl_requested.fields.nmi_exiting = true;                  </span><span leaf=""><br/></span><span leaf="">// vm_pinctl_requested.fields.virtual_nmis = true;                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_pinbased_controls vm_pinctl = {                  </span><span leaf=""><br/></span><span leaf="">vmx_adjust_controlvalue(use_true_msrs ? ia32_msr_vmx_true_pinbased_ctrl                  </span><span leaf=""><br/></span><span leaf="">: ia32_msr_vmx_pinbased_ctrl,                  </span><span leaf=""><br/></span><span leaf="">vm_pinctl_requested.all) };                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_processorbased_controls vm_procctl_requested = { 0 };                  </span><span leaf=""><br/></span><span leaf="">//vm_procctl_requested.fields.cr3_load_exiting = true;                  </span><span leaf=""><br/></span><span leaf="">vm_procctl_requested.fields.rdtsc_exiting = false;                  </span><span leaf=""><br/></span><span leaf="">vm_procctl_requested.fields.use_tsc_offseting = true;                  </span><span leaf=""><br/></span><span leaf="">vm_procctl_requested.fields.mov_dr_exiting = false;                  </span><span leaf=""><br/></span><span leaf="">vm_procctl_requested.fields.use_io_bitmaps = false;                  </span><span leaf=""><br/></span><span leaf="">vm_procctl_requested.fields.use_msr_bitmaps = false;                  </span><span leaf=""><br/></span><span leaf="">vm_procctl_requested.fields.activate_secondary_control = true;                  </span><span leaf=""><br/></span><span leaf="">// initialize time offset.                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_tscoffset, 0);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_tscoffsethigh, 0);                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_processorbased_controls vmx_procctl;                  </span><span leaf=""><br/></span><span leaf="">vmx_procctl.all =                  </span><span leaf=""><br/></span><span leaf="">vmx_adjust_controlvalue(use_true_msrs ? ia32_msr_vmx_true_priproc_ctrl                  </span><span leaf=""><br/></span><span leaf="">: ia32_msr_vmx_priproc_ctrl,                  </span><span leaf=""><br/></span><span leaf="">vm_procctl_requested.all);                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_secondaryprocessorbased_controls vm_procctls2_requested = { 0 };                  </span><span leaf=""><br/></span><span leaf="">vm_procctls2_requested.fields.enable_rdtscp = true;                  </span><span leaf=""><br/></span><span leaf="">vm_procctls2_requested.fields.enable_invpcid = true;                  </span><span leaf=""><br/></span><span leaf="">vm_procctls2_requested.fields.enable_vpid = true;                  </span><span leaf=""><br/></span><span leaf="">vm_procctls2_requested.fields.enable_xsaves_xstors = true;                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_secondaryprocessorbased_controls vm_procctls2;                  </span><span leaf=""><br/></span><span leaf="">vm_procctls2.all = vmx_adjust_controlvalue(ia32_msr_vmx_2ndproc_ctrl,                  </span><span leaf=""><br/></span><span leaf="">vm_procctls2_requested.all);                  </span><span leaf=""><br/></span><span leaf="">uintptr_t exception_bitmap = 0;                  </span><span leaf=""><br/></span><span leaf="">uintptr_t cr0_mask = 0;                  </span><span leaf=""><br/></span><span leaf="">uintptr_t cr0_shadow = __readcr0();                  </span><span leaf=""><br/></span><span leaf="">uintptr_t cr4_mask = 0;                  </span><span leaf=""><br/></span><span leaf="">uintptr_t cr4_shadow = __readcr4();                  </span><span leaf=""><br/></span><span leaf="">uintptr_t nerror =                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_virtualprocessorid,                  </span><span leaf=""><br/></span><span leaf="">KeGetCurrentProcessorNumberEx(NULL) + 1);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestesselector,                  </span><span leaf=""><br/></span><span leaf="">asm_reades());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readcs());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestssselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readss());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestdsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readds());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestfsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readfs());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestgsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readgs());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestldtrselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readldtr());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guesttrselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readtr());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostesselector,                  </span><span leaf=""><br/></span><span leaf="">asm_reades() &amp; 0xf8);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostcsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readcs() &amp; 0xf8);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostssselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readss() &amp; 0xf8);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostdsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readds() &amp; 0xf8);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostfsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readfs() &amp; 0xf8);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostgsselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readgs() &amp; 0xf8);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hosttrselector,                  </span><span leaf=""><br/></span><span leaf="">asm_readtr() &amp; 0xf8);                  </span><span leaf=""><br/></span><span leaf="">//PHYSICAL_ADDRESS phyAddress = {};                  </span><span leaf=""><br/></span><span leaf="">//nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_msrbitmap,                  </span><span leaf=""><br/></span><span leaf="">//(uintptr_t)MmGetVirtualForPhysical(phyAddress));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_vmcslinkpointer,                  </span><span leaf=""><br/></span><span leaf="">MAXULONG64);                  </span><span leaf=""><br/></span><span leaf="">_ia32_vmx_debugctl_register l_temp_debugReg = { __readmsr(ia32_msr_debug_control) };                  </span><span leaf=""><br/></span><span leaf="">l_temp_debugReg.fields.reserved1 = 0;                  </span><span leaf=""><br/></span><span leaf="">l_temp_debugReg.fields.reserved2 = 0;                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestia32debugctl,                  </span><span leaf=""><br/></span><span leaf="">l_temp_debugReg.all);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite(                  </span><span leaf=""><br/></span><span leaf="">(size_t)_vt_vmcs_field::_vt_vmcs_pinbasedvmexeccontrol, vm_pinctl.all);                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_cpubasedvmexeccontrol,                  </span><span leaf=""><br/></span><span leaf="">vmx_procctl.all);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_exceptionbitmap,                  </span><span leaf=""><br/></span><span leaf="">exception_bitmap);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_vmexitcontrols,                  </span><span leaf=""><br/></span><span leaf="">vm_exitctl.all);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_vmentrycontrols,                  </span><span leaf=""><br/></span><span leaf="">vm_entryctl.all);                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_secondaryvmexeccontrol,                  </span><span leaf=""><br/></span><span leaf="">vm_procctls2.all);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guesteslimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_reades()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestdslimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_readds()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcslimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_readcs()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestsslimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_readss()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestfslimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_readfs()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestgslimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_readgs()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestldtrlimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_readldtr()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guesttrlimit,                  </span><span leaf=""><br/></span><span leaf="">__segmentlimit(asm_readtr()));                  </span><span leaf=""><br/></span><span leaf="">// uintptr_t nerror |= __vmx_vmwrite(_vt_vmcs_field::, function::);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestgdtrlimit,                  </span><span leaf=""><br/></span><span leaf="">gdtr.limit);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestidtrlimit,                  </span><span leaf=""><br/></span><span leaf="">idtr.limit);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestesarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_reades()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcsarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_readcs()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestssarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_readss()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestdsarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_readds()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestfsarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_readfs()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestgsarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_readgs()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestldtrarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_readldtr()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guesttrarbytes,                  </span><span leaf=""><br/></span><span leaf="">vmx_getsegment_accessright(asm_readtr()));                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestsysentercs,                  </span><span leaf=""><br/></span><span leaf="">__readmsr(                  </span><span leaf=""><br/></span><span leaf="">(unsigned long)_vt_msr_value::_vt_msr_sysentercs));                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostia32sysentercs,                  </span><span leaf=""><br/></span><span leaf="">__readmsr(                  </span><span leaf=""><br/></span><span leaf="">(unsigned long)_vt_msr_value::_vt_msr_sysentercs));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_cr0guesthostmask,                  </span><span leaf=""><br/></span><span leaf="">cr0_mask);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_cr4guesthostmask,                  </span><span leaf=""><br/></span><span leaf="">cr4_mask);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_cr0readshadow,                  </span><span leaf=""><br/></span><span leaf="">cr0_shadow);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_cr4readshadow,                  </span><span leaf=""><br/></span><span leaf="">cr4_shadow);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcr0,                  </span><span leaf=""><br/></span><span leaf="">__readcr0());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcr3,                  </span><span leaf=""><br/></span><span leaf="">__readcr3());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcr4,                  </span><span leaf=""><br/></span><span leaf="">__readcr4());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestesbase, 0);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestcsbase, 0);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestssbase, 0);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestdsbase, 0);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite(                  </span><span leaf=""><br/></span><span leaf="">(size_t)_vt_vmcs_field::_vt_vmcs_guestfsbase,                  </span><span leaf=""><br/></span><span leaf="">__readmsr((unsigned long)_vt_msr_value::_vt_msr_fsbase));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite(                  </span><span leaf=""><br/></span><span leaf="">(size_t)_vt_vmcs_field::_vt_vmcs_guestgsbase,                  </span><span leaf=""><br/></span><span leaf="">__readmsr((unsigned long)_vt_msr_value::_vt_msr_gsbase));                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestldtrbase,                  </span><span leaf=""><br/></span><span leaf="">vmx_get_segmentbase(gdtr.base_address, asm_readldtr()));                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guesttrbase,                  </span><span leaf=""><br/></span><span leaf="">vmx_get_segmentbase(gdtr.base_address, asm_readtr()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestgdtrbase,                  </span><span leaf=""><br/></span><span leaf="">gdtr.base_address);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestidtrbase,                  </span><span leaf=""><br/></span><span leaf="">idtr.base_address);                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestdr7, __readdr(7));                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR rflags = __readeflags();                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestrflags,                  </span><span leaf=""><br/></span><span leaf="">rflags);                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestsysenteresp,                  </span><span leaf=""><br/></span><span leaf="">__readmsr(                  </span><span leaf=""><br/></span><span leaf="">(unsigned long)_vt_msr_value::_vt_msr_sysenteresp));                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestsysentereip,                  </span><span leaf=""><br/></span><span leaf="">__readmsr(                  </span><span leaf=""><br/></span><span leaf="">(unsigned long)_vt_msr_value::_vt_msr_sysentereip));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostcr0,                  </span><span leaf=""><br/></span><span leaf="">__readcr0());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostcr3,                  </span><span leaf=""><br/></span><span leaf="">__readcr3());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostcr4,                  </span><span leaf=""><br/></span><span leaf="">__readcr4());                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite(                  </span><span leaf=""><br/></span><span leaf="">(size_t)_vt_vmcs_field::_vt_vmcs_hostfsbase,                  </span><span leaf=""><br/></span><span leaf="">__readmsr((unsigned long)_vt_msr_value::_vt_msr_fsbase));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite(                  </span><span leaf=""><br/></span><span leaf="">(size_t)_vt_vmcs_field::_vt_vmcs_hostgsbase,                  </span><span leaf=""><br/></span><span leaf="">__readmsr((unsigned long)_vt_msr_value::_vt_msr_gsbase));                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hosttrbase,                  </span><span leaf=""><br/></span><span leaf="">vmx_get_segmentbase(gdtr.base_address, asm_readtr()));                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostgdtrbase,                  </span><span leaf=""><br/></span><span leaf="">gdtr.base_address);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostidtrbase,                  </span><span leaf=""><br/></span><span leaf="">idtr.base_address);                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostia32sysenteresp,                  </span><span leaf=""><br/></span><span leaf="">__readmsr(                  </span><span leaf=""><br/></span><span leaf="">(unsigned long)_vt_msr_value::_vt_msr_sysenteresp));                  </span><span leaf=""><br/></span><span leaf="">nerror |=                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostia32sysentereip,                  </span><span leaf=""><br/></span><span leaf="">__readmsr(                  </span><span leaf=""><br/></span><span leaf="">(unsigned long)_vt_msr_value::_vt_msr_sysentereip));                  </span><span leaf=""><br/></span><span leaf="">uintptr_t vmm_stack_region_base = (uintptr_t)(vcpu-&gt;stack) + kernel_stack_szie;                  </span><span leaf=""><br/></span><span leaf="">uintptr_t vmm_stack_data = (uintptr_t)(vmm_stack_region_base)-sizeof(void*);                  </span><span leaf=""><br/></span><span leaf="">*(_vt_vcpu_context**)vmm_stack_data = vcpu;                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR vmm_stack_base = vmm_stack_region_base - sizeof(_vt_vcpu_context*) - sizeof(_result_registers);                  </span><span leaf=""><br/></span><span leaf="">//nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_eptpointer, 0);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostrsp, vmm_stack_base);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_hostrip, (size_t)asm_vmmentrypoint);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestrsp, guest_stack_pointer);                  </span><span leaf=""><br/></span><span leaf="">nerror |= __vmx_vmwrite((size_t)_vt_vmcs_field::_vt_vmcs_guestrip, guest_instruction_pointer);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmlaunch();                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span></span></p></td></tr></tbody></table><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">这里，我们只简单讲解最后几行的代码，其他的设置可以参考上面的文章引用，有更详细的解释，我们设置了hostrsp、hostrip、guestrsp、guestrip，并执行vmlaunch，当代码正常运行时，我们的cpu会自动进入guest模式，再guestrip处开始执行，如果cpu触发了某些vt的事件导致退出，那么会导致cpu进入host模式，并执行hostrip处的代码</span></span></p><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_7;"><span style="font-size:18.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">VT Host的handler处理：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">为了压缩篇幅，我们将尽可能的减少功能的实现，除非一些&#34;必不可少的功能&#34;，例如，我们需要实现cpuid、msr、nmi、vmx指令的处理，其余的暂时不涉及</span></span></p><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_8;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">1. </span></span></span><span style="mso-bookmark:heading_8;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">NMI</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">针对NMI，我们选择直接注入到guest的方式进行，但需要注意的是，不需要挪动guest环境中的RIP</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void vt_vmm_handleexception(_vt_vmhandle_guestcontext* guest_context) {                  </span><span leaf=""><br/></span><span leaf="">size_t exit_exception_value = 0;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((size_t)_vt_vmcs_field::_vt_vmcs_vmexitintrinfo, &amp;exit_exception_value);                  </span><span leaf=""><br/></span><span leaf="">const _vt_vmexit_interruptioninformationfield exception = { exit_exception_value };                  </span><span leaf=""><br/></span><span leaf="">const _vt_interruption_type interruption_type = (_vt_interruption_type)(exception.fields.interruption_type);                  </span><span leaf=""><br/></span><span leaf="">const _vt_interruption_vector vector = (_vt_interruption_vector)(exception.fields.vector);                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR guest_inst_length;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((ULONG_PTR)_vt_vmcs_field::_vt_vmcs_vmexitinstructionlen, &amp;guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">ULONG_PTR error_code = 0;                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((ULONG32)_vt_vmcs_field::_vt_vmcs_vmexitintrerrorcode, &amp;error_code);                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_injectinterruption(interruption_type, vector, exception.fields.error_code_valid, error_code);                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)_vt_vmcs_field::_vt_vmcs_vmentryinstructionlen, guest_inst_length);                  </span><span leaf=""><br/></span><span leaf="">}</span></span></p></td></tr></tbody></table><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_9;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">2. </span></span></span><span style="mso-bookmark:heading_9;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">Cpuid</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">针对CPUID，我们直接通过调用CPUID，将返回值直接进行写入的方式进行处理，尽管这种处理是存在漏洞的，但本次的完成目标不涉及这块</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void vt_vmm_handlecpuid(_vt_vmhandle_guestcontext* guest_context) {                  </span><span leaf=""><br/></span><span leaf="">int buf[4];                  </span><span leaf=""><br/></span><span leaf="">__cpuidex(buf, guest_context-&gt;stack-&gt;gp_regs.Rax, guest_context-&gt;stack-&gt;gp_regs.Rcx);                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;stack-&gt;gp_regs.Rax = buf[0];                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;stack-&gt;gp_regs.Rbx = buf[1];                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;stack-&gt;gp_regs.Rcx = buf[2];                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;stack-&gt;gp_regs.Rdx = buf[3];                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;vm_movinstruction = true;                  </span><span leaf=""><br/></span><span leaf="">}</span></span></p></td></tr></tbody></table><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_10;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">3. </span></span></span><span style="mso-bookmark:heading_10;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">Msr</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">针对msr的读取和写入，我们也是采取相同的方式进行，但是得套一层异常处理，因为在读写时，可能会导致CPU抛出来异常。在针对一些特殊的msr寄存器时，我们需要用特殊的vmcs段进行代替</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">bool vt_vmm_handlemsraccess(                  </span><span leaf=""><br/></span><span leaf="">_vt_vmhandle_guestcontext* guest_context, bool read_access) {                  </span><span leaf=""><br/></span><span leaf="">const auto msr = (_vt_msr_value)(guest_context-&gt;stack-&gt;gp_regs.Rcx);                  </span><span leaf=""><br/></span><span leaf="">bool transfer_to_vmcs = false;                  </span><span leaf=""><br/></span><span leaf="">_vt_vmcs_field vmcs_field = {};                  </span><span leaf=""><br/></span><span leaf="">switch (msr) {                  </span><span leaf=""><br/></span><span leaf="">case _vt_msr_value::_vt_msr_sysentercs:                  </span><span leaf=""><br/></span><span leaf="">vmcs_field = _vt_vmcs_field::_vt_vmcs_guestsysentercs;                  </span><span leaf=""><br/></span><span leaf="">transfer_to_vmcs = true;                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">case _vt_msr_value::_vt_msr_sysenteresp:                  </span><span leaf=""><br/></span><span leaf="">vmcs_field = _vt_vmcs_field::_vt_vmcs_guestsysenteresp;                  </span><span leaf=""><br/></span><span leaf="">transfer_to_vmcs = true;                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">case _vt_msr_value::_vt_msr_sysentereip:                  </span><span leaf=""><br/></span><span leaf="">vmcs_field = _vt_vmcs_field::_vt_vmcs_guestsysentereip;                  </span><span leaf=""><br/></span><span leaf="">transfer_to_vmcs = true;                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">case _vt_msr_value::_vt_msr_debugctl:                  </span><span leaf=""><br/></span><span leaf="">vmcs_field = _vt_vmcs_field::_vt_vmcs_guestia32debugctl;                  </span><span leaf=""><br/></span><span leaf="">transfer_to_vmcs = true;                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">case _vt_msr_value::_vt_msr_gsbase:                  </span><span leaf=""><br/></span><span leaf="">vmcs_field = _vt_vmcs_field::_vt_vmcs_guestgsbase;                  </span><span leaf=""><br/></span><span leaf="">transfer_to_vmcs = true;                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">case _vt_msr_value::_vt_msr_fsbase:                  </span><span leaf=""><br/></span><span leaf="">vmcs_field = _vt_vmcs_field::_vt_vmcs_guestfsbase;                  </span><span leaf=""><br/></span><span leaf="">transfer_to_vmcs = true;                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">default:                  </span><span leaf=""><br/></span><span leaf="">break;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">const auto is_64bit_vmcs = (vmcs_field &gt;= _vt_vmcs_field::_vt_vmcs_iobitmapa) &amp;&amp; (vmcs_field &lt;= _vt_vmcs_field::_vt_vmcs_hostia32perfglobalctrlhigh);                  </span><span leaf=""><br/></span><span leaf="">LARGE_INTEGER msr_value = {};                  </span><span leaf=""><br/></span><span leaf="">if (read_access) {                  </span><span leaf=""><br/></span><span leaf="">if (transfer_to_vmcs) {                  </span><span leaf=""><br/></span><span leaf="">if (is_64bit_vmcs) {                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((ULONG32)vmcs_field, (size_t*)&amp;msr_value.QuadPart);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">else {                  </span><span leaf=""><br/></span><span leaf="">__vmx_vmread((ULONG32)vmcs_field, (size_t*)&amp;msr_value.QuadPart);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">else {                  </span><span leaf=""><br/></span><span leaf="">msr_value.QuadPart = __readmsr((ULONG32)msr);                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;stack-&gt;gp_regs.Rax = msr_value.LowPart;                  </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;stack-&gt;gp_regs.Rdx = msr_value.HighPart;                  </span><span leaf=""><br/></span><span leaf="">}                  </span><span leaf=""><br/></span><span leaf="">else {                  </span><span leaf=""><br/></span><span leaf="">msr_value.LowPart = static_cast</span><ulong><span leaf="">(guest_context-&gt;stack-&gt;gp_regs.Rax);          </span><span leaf=""><br/></span><span leaf="">msr_value.HighPart = static_cast</span><ulong><span leaf="">(guest_context-&gt;stack-&gt;gp_regs.Rdx);           </span><span leaf=""><br/></span><span leaf="">if (transfer_to_vmcs) {           </span><span leaf=""><br/></span><span leaf="">if (is_64bit_vmcs) {           </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)vmcs_field, (size_t)msr_value.QuadPart);           </span><span leaf=""><br/></span><span leaf="">}           </span><span leaf=""><br/></span><span leaf="">else {           </span><span leaf=""><br/></span><span leaf="">__vmx_vmwrite((ULONG32)vmcs_field, (size_t)msr_value.QuadPart);           </span><span leaf=""><br/></span><span leaf="">}           </span><span leaf=""><br/></span><span leaf="">}           </span><span leaf=""><br/></span><span leaf="">else {           </span><span leaf=""><br/></span><span leaf="">__writemsr((ULONG32)msr, (size_t)msr_value.QuadPart);           </span><span leaf=""><br/></span><span leaf="">}           </span><span leaf=""><br/></span><span leaf="">}           </span><span leaf=""><br/></span><span leaf="">guest_context-&gt;vm_movinstruction = true;           </span><span leaf=""><br/></span><span leaf="">return true;           </span><span leaf=""><br/></span><span leaf="">}</span></ulong></ulong></span></p></td></tr></tbody></table><p style="margin-top:16.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:2;"><span style="mso-bookmark:heading_11;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;color:#3370FF;"><span leaf="">4. </span></span></span><span style="mso-bookmark:heading_11;"><span style="font-size:16.0pt;line-height:120%;font-family:Arial;mso-ascii-font-family:Arial;mso-fareast-font-family:等线;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">vmx指令</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">由于本期不涉及嵌套，所以相关指令，我们直接注入一个事件即可</span></span></p><table style="margin-left: 0.0;border: none;border-collapse: collapse;mso-table-layout-alt: fixed;mso-border-top-alt: solid #DEE0E3 0.25pt;mso-border-left-alt: solid #DEE0E3 0.25pt;mso-border-bottom-alt: solid #DEE0E3 0.25pt;mso-border-right-alt: solid #DEE0E3 0.25pt;mso-padding-alt: 0pt 5.4pt 0pt 5.4pt;width: 100%;"><tbody><tr><td data-colwidth="552" width="552" valign="top" style="background: rgb(245, 246, 247);border-width: 1pt;border-style: solid;border-color: rgb(222, 224, 227);padding: 3pt 6pt 1.5pt;"><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;color:#646A73;"><span leaf="">C++                  </span></span><span style="font-size:11.0pt;line-height:120%;font-family:Consolas;mso-ascii-font-family:Consolas;mso-fareast-font-family:Consolas;mso-bidi-font-family:Consolas;font-variant:normal;text-transform:none;"><span leaf="">void vt_vmm_handle_vmx(_vt_vmhandle_guestcontext* guest_context) {                  </span><span leaf=""><br/></span><span leaf="">vt_vmm_injectinterruption(_vt_interruption_type::_vt_interruption_hardwareexception,                  </span><span leaf=""><br/></span><span leaf="">_vt_interruption_vector::_vt_intteruptionvec_invalidopcodeexception, false,                  </span><span leaf=""><br/></span><span leaf="">0);                  </span><span leaf=""><br/></span><span leaf="">return;                  </span><span leaf=""><br/></span><span leaf="">}</span></span></p></td></tr></tbody></table><p style="margin-top:19.0pt;margin-bottom:7.0pt;text-align:left;margin-left:0.0pt;line-height:120%;mso-outline-level:1;"><span style="mso-bookmark:heading_12;"><span style="font-size:18.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;font-weight:bold;"><span leaf="">结尾：</span></span></span></p><p style="margin-top:6.0pt;margin-bottom:6.0pt;text-align:left;margin-left:0.0pt;line-height:120%;"><span style="font-size:11.0pt;line-height:120%;font-family:等线;mso-ascii-font-family:Arial;mso-bidi-font-family:Arial;font-variant:normal;text-transform:none;"><span leaf="">至此，我们的代码已经可以在虚拟机中跑起来了，尽管本工程比较简陋，但对于目前接下来要做的功能，已经绰绰有余了</span></span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=a4478716&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247485989%26idx%3D1%26sn%3D244f30b755ffa00e6cfcd7898c9a81d9">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sat, 28 Mar 2026 10:01:00 +0800</pubDate>
    </item>
    <item>
      <title>从0训练自己的AI大模型(上)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485967&amp;idx=1&amp;sn=75ccdade1b71b91fdbca718b77005975</link>
      <description>前言2026年了，随着openclaw，ai agent的爆火，越来越多的人开始研究LLM的应用领域，不过我本</description>
      <content:encoded><![CDATA[<p>原创 <span>为了安全鸭</span> <span>2026-03-27 10:01</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a73f2750&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVNDsPaU3Pljqw8WDPEGyibHquRqJFepvIbRYbbTTXg4TNuQT3WxdnvoI84rgnGmcRuZ8z53YbnqUP30Gx3xPibmIwkuV0q7Kf5zg%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">2026年了，随着openclaw，ai agent的爆火，越来越多的人开始研究LLM的应用领域，不过我本人对它不咋感冒，一个是我无论是工作上还是生活中agent写得用的够多了</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">《[2025]中外AI大战!让AI们通过MCP玩帝国时代2》</span><span leaf=""><br/></span><span leaf=""><a href="https://key08.com/index.php/2025/10/04/2816.html" target="_blank">https://key08.com/index.php/2025/10/04/2816.html</a></span><span leaf=""><br/></span><span leaf="">另外一个是，我觉得agent这些应用层的东西不够底层，没有什么价值。所以快过新年的时候，就打算年后学习咋做LLM，自己搞个AI大模型出来。不过年后公司业务真的忙，一直没空，到3月份也很忙。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">ps:现在AI写代码了，理论上更轻松了，但是现实中怎么更忙了。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">但是没办法了，我觉得自己不能被垃圾业务代码淹没，所以再怎么忙也抽时间开始这个项目了。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">首先声明，虽然我之前懂机器学习/深度学习/强化学习，不过这些都只会一点点，我不是LLM领域专家，要是写的不好或者有问题请评论区请指出我的错误。</span></strong></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">前期准备</span></h2><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">明确自己要干什么</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在训练的第一步，我们确定自己要搞什么，我确定我是搞网络安全的，我要最低代价训练一个看起来不错的小模型就行，其他的能力拉了就拉了，专项训练不是那么容易的。</span><span leaf=""><br/></span><span leaf="">因此我们确定：</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">我们是小模型，不用太多资源</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">搞着玩的，自己学习大模型训练，他基本只是个DEMO，不要做太好，不要花太多钱。</span></p></li></ol><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">服务器配置</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">基本上，我们前期要准备一个AI训练服务器，我准备训练的模型大小是0.6b，所以两张A100就行了，太多了资源溢出了。但是硬盘和带宽要稍微大一点，特别是带宽，走梯子拉hf的内容，带宽32M绝对不够用。</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002252" data-ratio="1.300556586270872" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="539" src="https://wechat2rss.xlab.app/img-proxy/?k=fc880183&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPYMiawnwd0mbrK4zZFoXRVe342yr3eW5070pAGZ0bIQL5u8mFqPUH4D5MRdrvqd1D0yTJOocN8xlg6via5bWRRrGx6AjP6gM8v0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">准备</span></h2><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">预训练数据集</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这有两个推荐的</span><span leaf=""><br/></span><span leaf="">commoncrawl -数百 TB 级别的数据，数十亿网页中提取的 TB 级原始网络数据，每月都会爬取新的数据，但我没用，因为光下完我估计我就没了几万块了。</span><span leaf=""><br/></span><span leaf=""><a href="https://commoncrawl.org/get-started" target="_blank">https://commoncrawl.org/get-started</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">RefinedWeb</span><span leaf=""><br/></span><span leaf="">1TB 左右，9.68亿条数据</span><span leaf=""><br/></span><span leaf="">Common Crawl 数据集的大量经过重复数据删除和过滤的标记语料库，它是为较小规模但高质量的数据集训练 Falcon-40B 模型而开发的</span><span leaf=""><br/></span><span leaf=""><a href="https://huggingface.co/datasets/tiiuae/falcon-refinedweb" target="_blank">https://huggingface.co/datasets/tiiuae/falcon-refinedweb</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">网络安全社区的爬虫数据/CEV/POC/exploit-db/github安全相关的东西混在一起</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">由于RefinedWeb是纯英文的，所以我又找了几个hugging face上不知名的中文数据集，中文数据集是真的难找，随便找了几个。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">模型架构</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这里我就一个经验，永远不要自己创造乱七八糟的架构(其实架构不咋重要，重要的是数据)，所以我选了llama的，由于分词表llama对中文不太好，用qwen的分词表。此外快速注意力，rope这些都上了。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">开始训练</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以，现在训练一个模型成本极其的低廉了，我只需要搞个服务器，然后装一个opencode，我给他数据，让他搅拌在一起，就能开始预训练了。你不用关心操作，只需要关心细节就行。</span><span leaf=""><br/></span><span leaf="">模型loss降低的很快，一晚上就从9到3，似乎一切都朝着好的方向发展，我们很快就能训练一个好的模型了</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002253" data-ratio="0.559040590405904" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1084" src="https://wechat2rss.xlab.app/img-proxy/?k=c4bb1e96&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOXMoh9FVvxvgORlzPkTicyhQYsyeTyxgsnOlHava1Llv0kNwE7oJcVCia3EhNm6ib8iaSU9DgddWRs5Dq4RugeUqiblJsljACcJE5M%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">LOSS居然不降低了</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">过了大概3天后，我观察到一个问题，loss居然不继续降低了，还是在3-2左右</span><span leaf=""><br/></span><span leaf="">看了看checkpoints，成这样了</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002257" data-ratio="0.3688172043010753" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="930" src="https://wechat2rss.xlab.app/img-proxy/?k=34ef35ba&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMuJthx0sKb2tdQ4lGdoib0BEQFc1icOpnkdgwRC1DJNTGjZT4SBDEYTiaKibFpauXvsr1S1MBlRm8rF63v8c0N51uUf5HKTreRwPw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002255" data-ratio="0.4206798866855524" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="706" src="https://wechat2rss.xlab.app/img-proxy/?k=b6d80f78&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOy0M6TxpuzFfqfJeibnPOiaLNOPyAicgqmYta3jsQRy2QVOiaheJPm9YymyoREbzx0h5lDJXmNssKTB4OOf6TJVfbIMCjb3q8URgc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002256" data-ratio="0.32413793103448274" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="580" src="https://wechat2rss.xlab.app/img-proxy/?k=879a5ec7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNUpY1QNgNy9LxqvLOpHalC0QBThNL1Bjra3CZbV0jSibHSst28rSR3maHwDeUXfUG84SrYiaMy7HBhdXiabghwia0YCrXtP6P9Pb0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">为什么会这样，这个问题别让ai回答，因为我被AI坑了，AI说是训练时间不够久，然后就训练到了60000步，等回过头的时候，已经被坑惨了</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002258" data-ratio="0.7910447761194029" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1005" src="https://wechat2rss.xlab.app/img-proxy/?k=9db34f50&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVP3TXMu9lZe95STEFuNyqB2jzPN6hEWWzjJptpUVTWFA8hBduQZWZ3BllbDYuAHbFVMQGIVzy0Uf1ATTf4aIg7ARKCY7AmTrqs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">让我们仔细回顾一下数据集，RefinedWeb我用了，这个应该是洗好的，网络安全社区的爬虫数据.这个是问题，它包含了大量的无用的标签，时间戳，这些标签因为我们训练的是0.6b的模型，他会让模型困惑，毫无逻辑。可能在更大的模型上他会学到这个是网页，但是对于一个0.6b的模型来说太勉强了。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">因此，我们只能清洗一下数据，所谓清洗，我们直接点，国内论坛强行只保留中文，删除非中文或者非代码的内容。删掉无意义的CVE的编号，等。然后我们由于一开始就训练坏了，只能重新训练了，这次看表现还不错，几千次就这样了</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002276" data-ratio="0.585016835016835" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1188" src="https://wechat2rss.xlab.app/img-proxy/?k=b9776751&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNOW0S5a2qAxIDVoUtKIPCruGE57HibOjm0c3EUNqDkj9ez57ibzKnWaChcXbZSe90r2ic7sXJiaYLqS3vlicEwVTgZXugGR0F9Fd4A%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">然后等吧，由于是重新再来，相当于浪费了1000多，挂了两天，看看效果：</span><span leaf=""><br/></span><span leaf="">肉眼可见loss低了：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002278" data-ratio="0.6039689387402933" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1159" src="https://wechat2rss.xlab.app/img-proxy/?k=92ec342c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMrmSiaTSFnBGmHcd3ichCCV8w6cAHV13yYRHF3ILibCibFECaiamSuzxnuTdWnysRHCyfZ4VoFAftX7ETVcQhOpkzjmxoNKfnPrXzc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">续写也很正常一点了</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002277" data-ratio="0.11403980634749865" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1859" src="https://wechat2rss.xlab.app/img-proxy/?k=1251d14b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVM2psicKyr4BWXTFIcNOIyVPoNK0ey2W5H5wibfrcgKjS8R3UIFqHxSuAPJHcQticPJOm1hqPL3p3cnakZpvUgxgDxqko00qAMjp8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">但是我发现，这玩意大而空：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002274" data-ratio="0.3300124533001245" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="803" src="https://wechat2rss.xlab.app/img-proxy/?k=60f617d6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMnLufwnwNiaENpyntMv01PR0NH9IpGM5q14h69rZYxR9LBH9cTWp3d2TvZUhXgYOz1icyNeMuXwlV1bmhwpTGcmvGa9q5YaLKf0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">我认为是数据不够的结果，所以不管他继续训练了。</span><span leaf=""><br/></span><span leaf="">又过了一天</span><span leaf=""><br/></span><span leaf="">我发现最新的checkpoints出现损坏的情况：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002275" data-ratio="0.6937984496124031" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1032" src="https://wechat2rss.xlab.app/img-proxy/?k=3150bbbb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPibpThTAGkEbBKLJEuFsuWiaGkPpa2ArTLicp8e0qXDxzL0vtgwYSXsIqxrgc5NKECnAvbvmuqKF8MibXibteBK8LpKSUKEZibuEyyA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">所以先回退到老版本，做一下SFT</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">SFT</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">有了一个续写模型后，我们可以下一步，开始进行SFT微调了, 这样才有对话能力，自我认知能力。</span><span leaf=""><br/></span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">这真的是一个大坑</span></strong><span leaf=""><br/></span><span leaf="">pre train还算中规中矩。post train就麻烦了，一开始我从网上随便找了数据集进行训练，发现会让模型直接损坏！</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002280" data-ratio="0.3928748144482929" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="2021" src="https://wechat2rss.xlab.app/img-proxy/?k=2f1ddd51&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVN2XT41EmAmcKTFnbqEtjhpgndJjliaeicEeoc7wMtswmicMSlcePHtyr7prOApfjfMLSlE3ML6RJ7ZSAiaZzoN80NARicwLj0bFKFk%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002282" data-ratio="0.3029835390946502" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1944" src="https://wechat2rss.xlab.app/img-proxy/?k=933dbc62&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNnD7q8o0aVibqWWqHTxqHObxb3GZbDPfe4rSDoickiaibibY9LmrZaX7oEc4L6LIKwcqNfnzPnvDLGRyQTnjnk2l4VTcKoW2wrFlCs%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">还有更离谱的,老外的训练集也带黄色废料,导致模型学了不该学的:</span><span leaf=""><br/></span><span leaf="">(当我说’你好’的时候)</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002279" data-ratio="0.12051282051282051" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1950" src="https://wechat2rss.xlab.app/img-proxy/?k=4a534a72&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVMgb1SmLVlpqlI7QByL0qovSKqFZ61VvEjticjVHCpYqcQqc6RDNOWJq6mkB7W5zuVIG8sUy7riblrtmVdnaZNT4VZIS8tws4pcQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">这tm是一个黄色废料….</span><span leaf=""><br/></span><span leaf="">实在不行了！业务上又有一堆事…于是乎我找了一个hf上很火的deepseek蒸馏的数据集，不带think的那个，又过了一天…</span><span leaf=""><br/></span><span leaf="">结果第二天看的时候 我特么发现不对劲..</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002283" data-ratio="0.4649629018961253" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1213" src="https://wechat2rss.xlab.app/img-proxy/?k=b1af39d3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOicaROibriazc79y0OQYlpo0W182ZIRClosia6ia1878SONC9mzTP3Ku4tzY8L939eRmhTXmLS4m1JcaNOU3w5LI9RCf6It34rk3CM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">怎么回事，这么那么多”美人”啊</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002281" data-ratio="0.34668892598775736" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="jpeg" data-w="1797" src="https://wechat2rss.xlab.app/img-proxy/?k=5c290cb0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVN5UQzL5pI5cdoUpEqU3xgO9A523MJoich1ND78nwslh6GD5e7R7MiaRTPKUkh15pjsFZYMia1IeXiadUOdjd0iaYqwkenEnuWT6AQY%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">检查checkpoints，发现从很早开始，模型就学会美人了，而且他最早的时候居然在写小黄文….</span><span leaf=""><br/></span><span leaf="">倒查训练集，我发现一个绝望的事情，我的训练集里面充满了小黄文，其中美人来自这里</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002288" data-ratio="0.09662921348314607" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="jpeg" data-w="2670" src="https://wechat2rss.xlab.app/img-proxy/?k=2fcc3feb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F1woCcbOsjVMpQc90G83Bicb1lYqbtnmthibA2Bs7M5ricIcXpqW69nX6DHzUK8wfzkSTg1g28Z60q0IhQ1ZqQbSsSjbaMibsv5tWG6LnKFg5zzY%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">完了，又白训练了.</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">捣鼓半天，试了N个数据集，效果还是不明显。其实后来写文章的时候看，这就触发了我前面说的两个大坑</span><span leaf=""><br/></span><span leaf="">我们用了RefinedWeb，并且用了一些受污染的/完全不知名的中文训练集来做预训练，这导致，模型的底座中文能力其实是偏差的，即便是有合成数据在，一开始的混入的中文低质量语料去不掉了，除非</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">重新训练</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">第二个问题，我们的模型比较小，只有0.6b，他受到post train的影响非常大，他并不是一个通用模型，如果我们再拿网上的一些数据去给他做SFT，他只会学到乱七八糟的 杂七杂八的内容，除非我们预训练做的非常充分。</span><span leaf=""><br/></span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">而看起来，我们的预训练也不充分，数据集不够多，次数也不够多，数据配比也有问题。一系列问题导致我们到了如今的情况。</span></strong></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">make duckgpt greate again</span></h2><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">其实前面写了一大堆废话的原因是因为，很明显，我前面的各种操作导致模型训练失败了。这种感觉就像是，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">你想去送外卖但是没有电动车，冰箱里面有泡面但是没有卤蛋，塞满了资料的硬盘说挂，很好的朋友突然翻脸，认真做的东西没人喜欢,你又会发现龟苓膏里面没有龟，老婆饼里面没有老婆，你以为的通常都不是通常，生气没用，愤怒徒劳，不行就是不行</span></strong><span leaf="">，但是失败并不丢人，只要总结原因，我们一定能解决各种未知的困难，毕竟这不是物理学。而经过冷静思考，我发现我前几天失败的原因是，在没有科学的进行学习的情况下干某件事，就跟《勇哥说餐饮》里面的蜘蛛侠一样失败。</span></p></blockquote><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">于是乎为了解决问题，我重新进行了大量的资料学习，并且我仔细思考了一下目前的困境:</span><span leaf=""><br/></span><span leaf="">英文的效果都是好的，英文看起来至少都正常，比如这个，但是模型完全不会中文</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002297" data-ratio="0.062377402903099254" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="2549" src="https://wechat2rss.xlab.app/img-proxy/?k=08410af9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOibDroN0LgSRuxZ0QgPlY7Ropiah1quibRfkGN91p2uamoCawqmvue3jCd0oLJuePKLGtcErRMO7OCwhrNy53OPVUu3OwmRJ4J7s%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">因此本质上，需要的是pre train足够扎实，但是我们的pre train并不扎实</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">经过一段时间的学习和资料查找和别人的大模型POC学习（minimind），我发现，我们的重大失误:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">首先，我们需要我们正确配比数据，正确的做法是，模型大小 x 20，比如我是0.6b的模型，则需要12b的数据。此外这之，我也不打算先训练网络安全的数据了，用完90%是通用数据，10%是合成的网络安全数据</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">此外，我们不能用野鸡的数据集，HF上很多数据集并没有进行很好的清理，一味的追求数据大规模，只会导致模型啥也学不到，除非模型参数是真的大，大到无视这种杂七杂八的数据，但是那种几百B的我们个人是搞不定的。</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><em style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><span leaf="">小模型对输入的数据很敏感</span></em></strong><span leaf="">。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最后，我的SFT数据集也有问题，我们太相信网上的数据了，但是网上数据他并不是正常分布的，他充斥着很多人对AI的想法，比如有人拿AI做数学题，有人让AI写小黄文，有人让AI解决数学作业。这些如果是大模型搞通用大模型是可以的，但是这些数据对于我们来说，有毒。会拉低整体模型水平，正规做法是base+通用任务SFT+领域任务SFT，而不是一股脑全塞进去会导致出问题。</span><span leaf=""><br/></span><span leaf="">因此SFT数据配比我90%都是大模型合成，10%是网上通用数据。并且SFT训练率通常要是pre train的0.1左右，大了可能不收敛。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">最后的最后，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">我发现的模型架构也有问题</span><span leaf=""><br/></span><span leaf="">我们用了Qwen的分词器，Qwen的分词器占用大概151k 加上并没有用tie，导致实际上attention就会很小很小</span></strong><span leaf="">，解决方案是换一个词表+用TIE</span><span leaf=""><br/></span><span leaf="">(实际上，在QWEN3里面的说法中，4B以下的模型都用tie)</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002299" data-ratio="0.9177215189873418" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="790" src="https://wechat2rss.xlab.app/img-proxy/?k=a74e7421&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVOHFuPcZHM3m70X8H9Qk4bQQ3J5XnFCIvG40Bic0lrOLs6G2gKS8MYsSHia05MWQDaj9ct8LHibpVuTSg72IicC3khggibPQa77Y8L0%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">合成数据</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">现在大模型厂商训练开始用合成数据来进行训练，即用一个更大的模型合成数据给小模型出来用，自然语言数据已经快到头了对于很多大模型来说（当然对于我来说不是）。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们可以从中获得的启发是，大模型合成的数据，相比从网上爬来的野鸡数据，至少清洗过，可靠。另外对于raw data，做数据清洗是一个体力活，我一个人时间有限，而且这个吞金兽还开着，时间很珍贵。所以我立刻开始了下一步，用本地模型进行合成数据的操作</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我准备用两种模型来合成数据，一个是本地的qewn3.5,他们做的非常不错，本地成本低，另外一个是云端的大模型，为了实现合成数据，我让AI写了一个发散脚本，即自己思考自己下一步要生成什么，因为我们是做pre train，所以做的是续写而不是对话。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我的配置是云端大模型占了30%，本地小模型占了70%</span><span leaf=""><br/></span><span leaf="">为什么用本地模型，因为在线大模型耗钱啊！</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002298" data-ratio="0.15376984126984128" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1008" src="https://wechat2rss.xlab.app/img-proxy/?k=618ac2ec&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVOoHNFNicZFRg3ENEN76FYgZazyNRWwIKf9VL7ukoIiccLMCdxGwZziaDQiaml2jKHE1ZaEJffIbUt4aqK1MunTETmEPYWI2ibamia8o%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">先让大模型无限自动生成种子数据：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002295" data-ratio="0.6357947434292867" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="799" src="https://wechat2rss.xlab.app/img-proxy/?k=d0403dab&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMN2TIa9YictNjicyCyHNG3Uoa9uG767lowVPvbicXIfyT0yfnU2v11cicXBjQB2dSENUCrDyxkt78eadyJjnOFFxRWPpK6Sye4soY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">然后拿这些东西去让大模型续写：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002296" data-ratio="0.3489749430523918" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="2195" src="https://wechat2rss.xlab.app/img-proxy/?k=fff38c4b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVORP82jBAXvKOiaQpBh7ms4e6VjrvfbTzvqKvTVQGKoxl619ZZZO9no5ecfuE8RI5icP2SCGzyNd1kSZTYtNnybrnxm0AD11qaY4%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">这样就得到了一批高质量的数据，虽然还是有问题，比如大模型的幻觉会会影响数据质量，而且我也没清洗过，但是至少靠谱一点了.</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结果，又过了两天（-400rmb）</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">重新预训练</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以，我重新进行了预训练，搞了几个高质量的通用任务数据集:</span><span leaf=""><br/></span><span leaf=""><a href="https://huggingface.co/datasets/Goose-World/RWKV-World-v3" target="_blank">https://huggingface.co/datasets/Goose-World/RWKV-World-v3</a></span><span leaf=""><br/></span><span leaf=""><a href="https://huggingface.co/datasets/opencsg/Fineweb-Edu-Chinese-V2.2" target="_blank">https://huggingface.co/datasets/opencsg/Fineweb-Edu-Chinese-V2.2</a></span><span leaf=""><br/></span><span leaf=""><a href="https://huggingface.co/datasets/shareAI/ShareGPT-Chinese-English-90k" target="_blank">https://huggingface.co/datasets/shareAI/ShareGPT-Chinese-English-90k</a></span><span leaf=""><br/></span><span leaf="">等等..</span><span leaf=""><br/></span><span leaf="">然后继续合成数据:</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002303" data-ratio="0.4432348367029549" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1929" src="https://wechat2rss.xlab.app/img-proxy/?k=e4cf8278&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVPjkZQP8kqdb8auGhYfZ4vFX7oyQIsguUiboSvecSxb18IVzLFiaGObsrLmqJC1TBib8fxcUnIoG5AqUw9wQZhobFBNcGk0CBJpKw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">数据大小限制在12b左右，不扩大。</span><span leaf=""><br/></span><span leaf="">终于，在睡了一觉后，loss终于稳定在2.5-3左右了：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002302" data-ratio="0.2939890710382514" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="915" src="https://wechat2rss.xlab.app/img-proxy/?k=e908f45a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPSIl0L2Ps0aXpnXoKcqO73YEwXnHmibbE2cZE5PPs0YJZcJK5ma3JNS8xGqQzFtaK2icwSoOoAjk5uCYlStfbHueNaiakTgurxvY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002304" data-ratio="1.0545790934320074" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1081" src="https://wechat2rss.xlab.app/img-proxy/?k=8fa64d58&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVONKMLBkXOtyjSEWib6To9uChrowcmIEM3pvOmibqOiaJms5kku7F1PnJWaycDEGJfzvUR54LCbUibSbnBIoxbNn0aBRqIdj84Tmms%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">看起来靠谱一点了，没之前那么离谱</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002301" data-ratio="0.4440357330530741" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1903" src="https://wechat2rss.xlab.app/img-proxy/?k=0e352f80&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNOBzzkxHhdMnmUGDfg6I80mPMzoCx64UrDYnOuTuQJVqED5LINR3ZjYdhCq4xsUNIXj8iarIPmvlG0AgjYLq1ZulgSTavFnWDY%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">于是我们得到了一个pre train训练好的模型。虽然这个模型很垃圾，其他领域续写一窍不通，因为我们没有给他投喂太多的语料。但是对于安全领域，属于是能跑吧</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">现在再对其做SFT。用了合成数据，其他没什么特别的</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">做完后效果如下:</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002300" data-ratio="0.23833333333333334" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1200" src="https://wechat2rss.xlab.app/img-proxy/?k=0052fae8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVN6BgR4g4N5ffaZvpgiaqicsoWnPRnYZI0ucibS2U34TzKPTEtWBPia6befP1Pm7HfKw9sFVmbO7Kiad6ILQiagOYQh1icHvoHtPD1LTU%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">当然也有幻觉，比如这个中国美食带了日本寿司:</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002305" data-ratio="0.2092436974789916" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1190" src="https://wechat2rss.xlab.app/img-proxy/?k=96d6c79d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVM78HzxDsy8T6iaZtQGpicR9sZyxEKichFManuibk0jyd8Gvs4d0mCIBaWcFNat0hYm2fKC2bxtBcnPGu4e43AuxgkS4rYxfzXBoF8%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">然后弄了一个版本的SFT纠正了一下：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002307" data-ratio="0.27346041055718473" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1364" src="https://wechat2rss.xlab.app/img-proxy/?k=4f90106c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVNfDa8hA1AbuuicUfboynbexibTz0DPnapUPz2L1bZn3BSE97IJfZia9rzyQm2J0sdlSJwtk1ibBtHH751Ezo2JRk0R8icF48ECl9uM%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">不过我也不知道他学了什么…可能是学到合成数据里面的拒绝语句了，对于代码题目是拒绝的</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002306" data-ratio="0.16822429906542055" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1284" src="https://wechat2rss.xlab.app/img-proxy/?k=d784365e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F1woCcbOsjVNiaoUPMbicr34atClHN1LSbgF0ATnWk5YaCV0MguHuxQPwYMfABVL2MPibeetDqzphrqKZibMlsibKuqbrAgb5L09z3ib3iaeFHBGJuA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后我们用了QWEN作为合成数据，所以这个模型自我认知里面认为自己是qwen的，我也懒得再合成一些自我认知数据去修正他的认知了，反正是做着玩的</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002308" data-ratio="0.27854195323246217" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1454" src="https://wechat2rss.xlab.app/img-proxy/?k=cee0219d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVPNAboICpgDGUHBs9j1IRXcibicJF4JLvzwgQiaCiaRox8xWDn3vsjg8wlpxD1IBTuKLUXsYwBdnNmtq0qDFWQ7VOSfhZyAiaDiagDWc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">幻觉依然是存在的，而且非常大，并且对于不懂的问题，就会变得笨笨的：</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002309" data-ratio="0.17162629757785466" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1445" src="https://wechat2rss.xlab.app/img-proxy/?k=9e5efb14&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVMMZicbkib3ltnAvvU0KXLMqKTVy0NhGjW9sGEibnN49JibXzDSqbPjnfPCc2bnuVs25eZrpkQl90tOwjztbDR2j5ER0icRQlSJHu90%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">(我们的训练集里面没有银狐木马，所以AI完全无法找到有用的东西，所以就会这样)</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">总结反思</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这次一共花了5000RMB，而其实跑通后实现同样的效果的模型，只需要800rmb左右，大部分时间花费在边学边测边用上:</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002310" data-ratio="0.875" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="320" src="https://wechat2rss.xlab.app/img-proxy/?k=4544ebd2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2F1woCcbOsjVN8TpMBglWpE4E1S0v39wNicPDJh2GHuwVTNHdf7fbBfXAqSHvsKJgUwqMic6tAVD2uic09LBKPTqLcXevERCLjJwSA6vBgNZJQKc%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这是因为我选了一个错误的路线，0.6b对于模型来说还是太大了，应该先从极小的参数开始，比如0.1b或者0.01b先做实验。实验跑通了再堆数据规模。从而避免时间/金钱的耗费。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">无论怎么样，我们都跑通了整体的路线，下次就不会那么吃瘪了，这次没有做工具调用训练以及RL以及实现COT(思维链推理)效果也是一种遗憾，因为花的钱太多了，所以先抱有遗憾的止血，等回血一波后，攒一波再来一次更好的训练，敬请关注冲鸭安全。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这边非常感谢minimind,所有想训练的人但是不是搞模型专业的人应该先复现一下这个,节约大量时间,避免跟我一样一头撞到墙上:</span><span leaf=""><br/></span><span leaf=""><a href="https://github.com/jingyaogong/minimind" target="_blank">https://github.com/jingyaogong/minimind</a></span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=289a676c&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247485967%26idx%3D1%26sn%3D75ccdade1b71b91fdbca718b77005975">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 27 Mar 2026 10:01:00 +0800</pubDate>
    </item>
    <item>
      <title>Windows下不触发任何进程监控的创建进程</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485866&amp;idx=1&amp;sn=027c346f42696ff753a8681b2308e3c2</link>
      <description>前言这几年AI用多了,脑子坏了,比如之前写代码很容易进入心流解决问题,这个过程很爽,但是现在只会开五六个ai的</description>
      <content:encoded><![CDATA[<p>原创 <span>为了安全鸭</span> <span>2026-01-24 16:30</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=5ea60fd0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MM5rWyS7kMa8O0y2pac1CMwu95GEeZuXahuv57ey9yhsiafXlCkpmngw%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">前言</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这几年AI用多了,脑子坏了,比如之前写代码很容易进入心流解决问题,这个过程很爽,但是现在只会开五六个ai的console让他帮我打工。</span><span leaf=""><br/></span><span leaf="">一开始是很急的让AI写功能，</span><span leaf=""><br/></span><span leaf="">但是到后来恨不得遇到bug，编译不通过，甚至是思考都托管给AI。</span><span leaf=""><br/></span><span leaf="">我把它叫做脑腐现象.所以为了避免这种现象,我准备用纯手工打造的方式搞点项目做。锻炼一下大脑。正巧，操作系统内核目前还是AI无法触及的领域。所以，here we go。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">内核创建进程</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以，让我们来复习一下内核创建进程，这里不会说太多的基础，因为chatgpt都能回答了。我们直接说简单一点的。我们先实现一个简单的调用ntcreateuserprocess创建进程的例子，在内核里面这需要三步:</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">定位ntcreateuserprocess</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">填好参数</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">call</span></p></li></ol><p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: inherit;font-weight: 500;line-height: 1.2;color: inherit;font-size: 1.75rem;"><span leaf="">定位ntcreateuserprocess</span></h3><span leaf="">定位方式有很多，比如经典款祖传找SSDT table,但是</span><span leaf=""><br/></span><span leaf="">我是懒得定位了，直接特征码写死了:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.7611111111111111" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002178" src="https://wechat2rss.xlab.app/img-proxy/?k=ca885c51&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6McmIoGvS1oYTXtg29g4joF2GjicicUibc86ib9yUKRJkzGzbOwyY7BkH1bw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">填好参数</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">ntcreateuserpcoess在R3的执行的时候需要用到RtlCreateProcessParametersEx和RtlDestroyProcessParameters去填_RTL_USER_PROCESS_PARAMETERS</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.20277777777777778" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002176" src="https://wechat2rss.xlab.app/img-proxy/?k=66af4f89&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MAiacUg5Nym2svYicPm1xz6uk5YRQk1WdLPpLQCkucUptsE9IILYTgnHg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">我们R0是没有这个两个参数的，所以要自己填.填完直接call就行:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5685185185185185" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002177" src="https://wechat2rss.xlab.app/img-proxy/?k=9d8b7976&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MTibmXfwsQBRtpicNuQ4RWJB5RFW4ZgyE1FlnjXL0R9r14VvIfUplMGAg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.14074074074074075" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002175" src="https://wechat2rss.xlab.app/img-proxy/?k=a9529ab4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6M7X4xQXBkd3hN43kC5NIibxF4ZtmZaL1PCBEmkVPJbbcibxRxzeSCou9g%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">但是坑来了,</span><span leaf=""><br/></span><span leaf="">而这个RTL_USER_PROCESS_PARAMETERS 微软故意隐藏了东西，导致如果你按照微软的来写是没有办法跑起来的，跑起来会直接segment fault.这是因为没有正确的填参数,CRT初始化的时候就崩溃了。因此我写了一个R3程序，打印一下里面需要什么东西:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">// ConsoleApplication1.cpp</span><span leaf=""><br/></span><span leaf="">// Dumps the raw payload produced by RtlCreateProcessParametersEx (user-mode).</span><span leaf=""><br/></span><span leaf=""><a class="wx_topic_link" topic-id="mks1pt8l-00ye8f" style="color: #576B95 !important;" data-topic="1">#define</a> WIN32_LEAN_AND_MEAN</span><span leaf=""><br/></span><span leaf=""><a class="wx_topic_link" topic-id="mks1pt8l-lrckh7" style="color: #576B95 !important;" data-topic="1">#include</a> &lt;windows.h&gt;</span><span leaf=""><br/></span><span leaf=""><a class="wx_topic_link" topic-id="mks1pt8m-psi5gg" style="color: #576B95 !important;" data-topic="1">#include</a> &lt;winternl.h&gt;</span><span leaf=""><br/></span><span leaf=""><a class="wx_topic_link" topic-id="mks1pt8m-vlafyw" style="color: #576B95 !important;" data-topic="1">#include</a> &lt;cstdint&gt;</span><span leaf=""><br/></span><span leaf=""><a class="wx_topic_link" topic-id="mks1pt8m-923evp" style="color: #576B95 !important;" data-topic="1">#include</a> &lt;cstdio&gt;</span><span leaf=""><br/></span><span leaf=""><a class="wx_topic_link" topic-id="mks1pt8m-cu1zzv" style="color: #576B95 !important;" data-topic="1">#include</a> &lt;string&gt;</span><span leaf=""><br/></span><span leaf="">//0x18 bytes (sizeof)</span><span leaf=""><br/></span><span leaf="">struct _CURDIR</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING DosPath;                                         //0x0</span><span leaf=""><br/></span><span leaf="">    VOID* Handle;                                                           //0x10</span><span leaf=""><br/></span><span leaf="">};</span><span leaf=""><br/></span><span leaf="">//0x18 bytes (sizeof)</span><span leaf=""><br/></span><span leaf="">struct _RTL_DRIVE_LETTER_CURDIR</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    USHORT Flags;                                                           //0x0</span><span leaf=""><br/></span><span leaf="">    USHORT Length;                                                          //0x2</span><span leaf=""><br/></span><span leaf="">    ULONG TimeStamp;                                                        //0x4</span><span leaf=""><br/></span><span leaf="">    struct _STRING DosPath;                                                 //0x8</span><span leaf=""><br/></span><span leaf="">};</span><span leaf=""><br/></span><span leaf="">//0x410 bytes (sizeof)</span><span leaf=""><br/></span><span leaf="">struct _RTL_USER_PROCESS_PARAMETERSEX</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    ULONG MaximumLength;                                                    //0x0</span><span leaf=""><br/></span><span leaf="">    ULONG Length;                                                           //0x4</span><span leaf=""><br/></span><span leaf="">    ULONG Flags;                                                            //0x8</span><span leaf=""><br/></span><span leaf="">    ULONG DebugFlags;                                                       //0xc</span><span leaf=""><br/></span><span leaf="">    VOID* ConsoleHandle;                                                    //0x10</span><span leaf=""><br/></span><span leaf="">    ULONG ConsoleFlags;                                                     //0x18</span><span leaf=""><br/></span><span leaf="">    VOID* StandardInput;                                                    //0x20</span><span leaf=""><br/></span><span leaf="">    VOID* StandardOutput;                                                   //0x28</span><span leaf=""><br/></span><span leaf="">    VOID* StandardError;                                                    //0x30</span><span leaf=""><br/></span><span leaf="">    struct _CURDIR CurrentDirectory;                                        //0x38</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING DllPath;                                         //0x50</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING ImagePathName;                                   //0x60</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING CommandLine;                                     //0x70</span><span leaf=""><br/></span><span leaf="">    VOID* Environment;                                                      //0x80</span><span leaf=""><br/></span><span leaf="">    ULONG StartingX;                                                        //0x88</span><span leaf=""><br/></span><span leaf="">    ULONG StartingY;                                                        //0x8c</span><span leaf=""><br/></span><span leaf="">    ULONG CountX;                                                           //0x90</span><span leaf=""><br/></span><span leaf="">    ULONG CountY;                                                           //0x94</span><span leaf=""><br/></span><span leaf="">    ULONG CountCharsX;                                                      //0x98</span><span leaf=""><br/></span><span leaf="">    ULONG CountCharsY;                                                      //0x9c</span><span leaf=""><br/></span><span leaf="">    ULONG FillAttribute;                                                    //0xa0</span><span leaf=""><br/></span><span leaf="">    ULONG WindowFlags;                                                      //0xa4</span><span leaf=""><br/></span><span leaf="">    ULONG ShowWindowFlags;                                                  //0xa8</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING WindowTitle;                                     //0xb0</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING DesktopInfo;                                     //0xc0</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING ShellInfo;                                       //0xd0</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING RuntimeData;                                     //0xe0</span><span leaf=""><br/></span><span leaf="">    struct _RTL_DRIVE_LETTER_CURDIR CurrentDirectores[32];                  //0xf0</span><span leaf=""><br/></span><span leaf="">    ULONGLONG EnvironmentSize;                                              //0x3f0</span><span leaf=""><br/></span><span leaf="">    ULONGLONG EnvironmentVersion;                                           //0x3f8</span><span leaf=""><br/></span><span leaf="">    VOID* PackageDependencyData;                                            //0x400</span><span leaf=""><br/></span><span leaf="">    ULONG ProcessGroupId;                                                   //0x408</span><span leaf=""><br/></span><span leaf="">    ULONG LoaderThreads;                                                    //0x40c</span><span leaf=""><br/></span><span leaf="">};</span><span leaf=""><br/></span><span leaf="">// Some SDKs do not declare this prototype in user-mode headers.</span><span leaf=""><br/></span><span leaf="">using fnRtlCreateProcessParametersEx = NTSTATUS(NTAPI*)(</span><span leaf=""><br/></span><span leaf="">    _RTL_USER_PROCESS_PARAMETERSEX* pProcessParameters,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING ImagePathName,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING DllPath,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING CurrentDirectory,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING CommandLine,</span><span leaf=""><br/></span><span leaf="">    PVOID Environment,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING WindowTitle,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING DesktopInfo,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING ShellInfo,</span><span leaf=""><br/></span><span leaf="">    PUNICODE_STRING RuntimeData,</span><span leaf=""><br/></span><span leaf="">    ULONG Flags</span><span leaf=""><br/></span><span leaf="">);</span><span leaf=""><br/></span><span leaf="">using fnRtlDestroyProcessParameters = NTSTATUS(NTAPI*)(_RTL_USER_PROCESS_PARAMETERSEX ProcessParameters);</span><span leaf=""><br/></span><span leaf="">static UNICODE_STRING MakeUnicodeString(const std::wstring&amp; s)</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    UNICODE_STRING us{};</span><span leaf=""><br/></span><span leaf="">    us.Buffer = const_cast&lt;PWSTR&gt;(s.c_str());</span><span leaf=""><br/></span><span leaf="">    us.Length = static_cast&lt;USHORT&gt;(s.size() * sizeof(wchar_t));</span><span leaf=""><br/></span><span leaf="">    us.MaximumLength = us.Length + sizeof(wchar_t);</span><span leaf=""><br/></span><span leaf="">    return us;</span><span leaf=""><br/></span><span leaf="">}</span><span leaf=""><br/></span><span leaf="">static void HexDump(const void* data, size_t size)</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    const auto* p = static_cast&lt;const unsigned char*&gt;(data);</span><span leaf=""><br/></span><span leaf="">    for (size_t i = 0; i &lt; size; i += 16) {</span><span leaf=""><br/></span><span leaf="">        std::printf(&#34;%08zx  &#34;, i);</span><span leaf=""><br/></span><span leaf="">        for (size_t j = 0; j &lt; 16; ++j) {</span><span leaf=""><br/></span><span leaf="">            if (i + j &lt; size) std::printf(&#34;%02X &#34;, p[i + j]);</span><span leaf=""><br/></span><span leaf="">            else std::printf(&#34;   &#34;);</span><span leaf=""><br/></span><span leaf="">        }</span><span leaf=""><br/></span><span leaf="">        std::printf(&#34; &#34;);</span><span leaf=""><br/></span><span leaf="">        for (size_t j = 0; j &lt; 16 &amp;&amp; i + j &lt; size; ++j) {</span><span leaf=""><br/></span><span leaf="">            unsigned char c = p[i + j];</span><span leaf=""><br/></span><span leaf="">            std::printf(&#34;%c&#34;, (c &gt;= 32 &amp;&amp; c &lt;= 126) ? c : &#39;.&#39;);</span><span leaf=""><br/></span><span leaf="">        }</span><span leaf=""><br/></span><span leaf="">        std::printf(&#34;\n&#34;);</span><span leaf=""><br/></span><span leaf="">    }</span><span leaf=""><br/></span><span leaf="">}</span><span leaf=""><br/></span><span leaf="">static void PrintUs(const char* name, const UNICODE_STRING&amp; us, const void* base)</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    const auto baseAddr = reinterpret_cast&lt;uintptr_t&gt;(base);</span><span leaf=""><br/></span><span leaf="">    const auto bufAddr = reinterpret_cast&lt;uintptr_t&gt;(us.Buffer);</span><span leaf=""><br/></span><span leaf="">    std::wprintf(L&#34;%hs: Len=%u Max=%u Buf=%p (off=0x%Ix)  \&#34;%.*s\&#34;\n&#34;,</span><span leaf=""><br/></span><span leaf="">        name,</span><span leaf=""><br/></span><span leaf="">        us.Length,</span><span leaf=""><br/></span><span leaf="">        us.MaximumLength,</span><span leaf=""><br/></span><span leaf="">        us.Buffer,</span><span leaf=""><br/></span><span leaf="">        (bufAddr &gt;= baseAddr) ? (bufAddr - baseAddr) : 0,</span><span leaf=""><br/></span><span leaf="">        us.Length / 2,</span><span leaf=""><br/></span><span leaf="">        us.Buffer ? us.Buffer : L&#34;&#34;);</span><span leaf=""><br/></span><span leaf="">}</span><span leaf=""><br/></span><span leaf="">int wmain()</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    // Example payload: create cmd.exe parameters (NOT actually launching here).</span><span leaf=""><br/></span><span leaf="">    std::wstring imagePath = L&#34;\\??\\C:\\Windows\\System32\\cmd.exe&#34;;</span><span leaf=""><br/></span><span leaf="">    std::wstring cmdLine = L&#34;\&#34;C:\\Windows\\System32\\cmd.exe\&#34;&#34;;</span><span leaf=""><br/></span><span leaf="">    UNICODE_STRING usImage = MakeUnicodeString(imagePath);</span><span leaf=""><br/></span><span leaf="">    UNICODE_STRING usCmd = MakeUnicodeString(cmdLine);</span><span leaf=""><br/></span><span leaf="">    HMODULE ntdll = ::GetModuleHandleW(L&#34;ntdll.dll&#34;);</span><span leaf=""><br/></span><span leaf="">    if (!ntdll) {</span><span leaf=""><br/></span><span leaf="">        std::printf(&#34;GetModuleHandleW(ntdll) failed: %lu\n&#34;, ::GetLastError());</span><span leaf=""><br/></span><span leaf="">        return 1;</span><span leaf=""><br/></span><span leaf="">    }</span><span leaf=""><br/></span><span leaf="">    auto pRtlCreate = reinterpret_cast&lt;fnRtlCreateProcessParametersEx&gt;(</span><span leaf=""><br/></span><span leaf="">        ::GetProcAddress(ntdll, &#34;RtlCreateProcessParametersEx&#34;));</span><span leaf=""><br/></span><span leaf="">    auto pRtlDestroy = reinterpret_cast&lt;fnRtlDestroyProcessParameters&gt;(</span><span leaf=""><br/></span><span leaf="">        ::GetProcAddress(ntdll, &#34;RtlDestroyProcessParameters&#34;));</span><span leaf=""><br/></span><span leaf="">    if (!pRtlCreate || !pRtlDestroy) {</span><span leaf=""><br/></span><span leaf="">        std::printf(&#34;GetProcAddress failed. RtlCreate=%p RtlDestroy=%p\n&#34;, pRtlCreate, pRtlDestroy);</span><span leaf=""><br/></span><span leaf="">        return 1;</span><span leaf=""><br/></span><span leaf="">    }</span><span leaf=""><br/></span><span leaf="">    _RTL_USER_PROCESS_PARAMETERSEX* p = nullptr;</span><span leaf=""><br/></span><span leaf="">    constexpr ULONG RTL_USER_PROCESS_PARAMETERS_NORMALIZED = 0x01;</span><span leaf=""><br/></span><span leaf="">    NTSTATUS st = pRtlCreate(</span><span leaf=""><br/></span><span leaf="">        (_RTL_USER_PROCESS_PARAMETERSEX*)&amp;p,</span><span leaf=""><br/></span><span leaf="">        &amp;usImage,</span><span leaf=""><br/></span><span leaf="">        nullptr,</span><span leaf=""><br/></span><span leaf="">        nullptr,</span><span leaf=""><br/></span><span leaf="">        &amp;usCmd,</span><span leaf=""><br/></span><span leaf="">        nullptr,</span><span leaf=""><br/></span><span leaf="">        nullptr,</span><span leaf=""><br/></span><span leaf="">        nullptr,</span><span leaf=""><br/></span><span leaf="">        nullptr,</span><span leaf=""><br/></span><span leaf="">        nullptr,</span><span leaf=""><br/></span><span leaf="">        RTL_USER_PROCESS_PARAMETERS_NORMALIZED);</span><span leaf=""><br/></span><span leaf="">    std::printf(&#34;RtlCreateProcessParametersEx -&gt; 0x%08X, p=%p\n&#34;, static_cast&lt;unsigned&gt;(st), p);</span><span leaf=""><br/></span><span leaf="">    if (st &lt; 0 || !p)</span><span leaf=""><br/></span><span leaf="">        return 1;</span><span leaf=""><br/></span><span leaf="">    // Raw payload dump (what you&#39;d want to mirror in kernel if you&#39;re hand-building).</span><span leaf=""><br/></span><span leaf="">    HexDump(p, sizeof(_RTL_USER_PROCESS_PARAMETERSEX));</span><span leaf=""><br/></span><span leaf="">    //pRtlDestroy(p);</span><span leaf=""><br/></span><span leaf="">    return 0;</span><span leaf=""><br/></span><span leaf="">}</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.6175925925925926" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002179" src="https://wechat2rss.xlab.app/img-proxy/?k=d7d7053f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MBYo79MCpxqZH03S7ctkgwtVIFsb0avYEhc9OTOOo0MzHm9O2Ocs9Ng%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5138888888888888" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002180" src="https://wechat2rss.xlab.app/img-proxy/?k=f54e066a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MEeiaWDlEgibZYsVlibOH4oJX0XLib2ibNZjcxz9kl5vhWRTpzTmUSuBWGjA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">实际上，缺失的内容是，我们需要填工作目录，并且要有完整的结构体:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">//0x18 bytes (sizeof)</span><span leaf=""><br/></span><span leaf="">struct _CURDIR</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING DosPath;                                         //0x0</span><span leaf=""><br/></span><span leaf="">    VOID* Handle;                                                           //0x10</span><span leaf=""><br/></span><span leaf="">};</span><span leaf=""><br/></span><span leaf="">//0x18 bytes (sizeof)</span><span leaf=""><br/></span><span leaf="">struct _RTL_DRIVE_LETTER_CURDIR</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    USHORT Flags;                                                           //0x0</span><span leaf=""><br/></span><span leaf="">    USHORT Length;                                                          //0x2</span><span leaf=""><br/></span><span leaf="">    ULONG TimeStamp;                                                        //0x4</span><span leaf=""><br/></span><span leaf="">    struct _STRING DosPath;                                                 //0x8</span><span leaf=""><br/></span><span leaf="">};</span><span leaf=""><br/></span><span leaf="">//0x410 bytes (sizeof)</span><span leaf=""><br/></span><span leaf="">struct _RTL_USER_PROCESS_PARAMETERSEX</span><span leaf=""><br/></span><span leaf="">{</span><span leaf=""><br/></span><span leaf="">    ULONG MaximumLength;                                                    //0x0</span><span leaf=""><br/></span><span leaf="">    ULONG Length;                                                           //0x4</span><span leaf=""><br/></span><span leaf="">    ULONG Flags;                                                            //0x8</span><span leaf=""><br/></span><span leaf="">    ULONG DebugFlags;                                                       //0xc</span><span leaf=""><br/></span><span leaf="">    VOID* ConsoleHandle;                                                    //0x10</span><span leaf=""><br/></span><span leaf="">    ULONG ConsoleFlags;                                                     //0x18</span><span leaf=""><br/></span><span leaf="">    VOID* StandardInput;                                                    //0x20</span><span leaf=""><br/></span><span leaf="">    VOID* StandardOutput;                                                   //0x28</span><span leaf=""><br/></span><span leaf="">    VOID* StandardError;                                                    //0x30</span><span leaf=""><br/></span><span leaf="">    struct _CURDIR CurrentDirectory;                                        //0x38</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING DllPath;                                         //0x50</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING ImagePathName;                                   //0x60</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING CommandLine;                                     //0x70</span><span leaf=""><br/></span><span leaf="">    VOID* Environment;                                                      //0x80</span><span leaf=""><br/></span><span leaf="">    ULONG StartingX;                                                        //0x88</span><span leaf=""><br/></span><span leaf="">    ULONG StartingY;                                                        //0x8c</span><span leaf=""><br/></span><span leaf="">    ULONG CountX;                                                           //0x90</span><span leaf=""><br/></span><span leaf="">    ULONG CountY;                                                           //0x94</span><span leaf=""><br/></span><span leaf="">    ULONG CountCharsX;                                                      //0x98</span><span leaf=""><br/></span><span leaf="">    ULONG CountCharsY;                                                      //0x9c</span><span leaf=""><br/></span><span leaf="">    ULONG FillAttribute;                                                    //0xa0</span><span leaf=""><br/></span><span leaf="">    ULONG WindowFlags;                                                      //0xa4</span><span leaf=""><br/></span><span leaf="">    ULONG ShowWindowFlags;                                                  //0xa8</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING WindowTitle;                                     //0xb0</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING DesktopInfo;                                     //0xc0</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING ShellInfo;                                       //0xd0</span><span leaf=""><br/></span><span leaf="">    struct _UNICODE_STRING RuntimeData;                                     //0xe0</span><span leaf=""><br/></span><span leaf="">    struct _RTL_DRIVE_LETTER_CURDIR CurrentDirectores[32];                  //0xf0</span><span leaf=""><br/></span><span leaf="">    ULONGLONG EnvironmentSize;                                              //0x3f0</span><span leaf=""><br/></span><span leaf="">    ULONGLONG EnvironmentVersion;                                           //0x3f8</span><span leaf=""><br/></span><span leaf="">    VOID* PackageDependencyData;                                            //0x400</span><span leaf=""><br/></span><span leaf="">    ULONG ProcessGroupId;                                                   //0x408</span><span leaf=""><br/></span><span leaf="">    ULONG LoaderThreads;                                                    //0x40c</span><span leaf=""><br/></span><span leaf="">};</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">再然后稍微的手工填一下，这一步很想用AI忍不住了:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.899074074074074" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002181" src="https://wechat2rss.xlab.app/img-proxy/?k=af71de87&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6M7ZCsh2oMB9QOgXP5eA3kHn6KsDdibmOPMlV1dxDmuMGU7xYyiczlBnDw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">call it!</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">然后我们就跑起来了</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.4065040650406504" data-type="png" data-w="615" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002184" src="https://wechat2rss.xlab.app/img-proxy/?k=9dea57a2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MSR1fyw1U1cuia89jYd9XDXLVwhtjVETibHjWM7FUz9fKELhFJ6fnqgmg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">但是这个有第二个问题，结束了就会蓝屏:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.587037037037037" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002186" src="https://wechat2rss.xlab.app/img-proxy/?k=4b1134a5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MK4TYnXAhQ297aNUWBX6CoA7fjcBq9j3E5wB4Kw3Y9KMXtLE5bD9eiaA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">让我们调查一下,根据信息,错误代码在结束时候,</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.3222748815165877" data-type="png" data-w="633" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002183" src="https://wechat2rss.xlab.app/img-proxy/?k=417c695f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6M6icrJ0WraxAm2ic19Xqxpwy1MeAXZEnia5j4VvQjBKDeKbYloLqMjYBLg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">执行MmSessionGetWin32Callouts的时候:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">.text:000000014008A220                                     MmSessionGetWin32Callouts proc near     ; CODE XREF: NtDeleteAtom+F↓p</span><span leaf=""><br/></span><span leaf="">.text:000000014008A220                                                                             ; PsConvertToGuiThread:loc_14060BEFE↓p ...</span><span leaf=""><br/></span><span leaf="">.text:000000014008A220 65 48 8B 04 25 88 01 00 00                          mov     rax, gs:188h</span><span leaf=""><br/></span><span leaf="">.text:000000014008A229 48 8B 88 B8 00 00 00                                mov     rcx, [rax+0B8h]</span><span leaf=""><br/></span><span leaf="">.text:000000014008A230 48 8B 81 00 04 00 00                                mov     rax, [rcx+400h]</span><span leaf=""><br/></span><span leaf="">.text:000000014008A237 48 83 B8 C0 03 00 00 02                             cmp     qword ptr [rax+3C0h], 2</span><span leaf=""><br/></span><span leaf="">.text:000000014008A23F 48 8D 05 52 E7 3A 00                                lea     rax, PsWin32CallBack</span><span leaf=""><br/></span><span leaf="">.text:000000014008A246 73 07                                               jnb     short locret_14008A24F</span><span leaf=""><br/></span><span leaf="">.text:000000014008A248 48 8D 05 41 E7 3A 00                                lea     rax, PsWin32NullCallBack</span><span leaf=""><br/></span><span leaf="">.text:000000014008A24F</span><span leaf=""><br/></span><span leaf="">.text:000000014008A24F                                     locret_14008A24F:                       ; CODE XREF: MmSessionGetWin32Callouts+26↑j</span><span leaf=""><br/></span><span leaf="">.text:000000014008A24F C3                                                  retn</span><span leaf=""><br/></span><span leaf="">.text:000000014008A24F                                     MmSessionGetWin32Callouts endp</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而这个MmSessionGetWin32Callouts读</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">cmp     qword ptr [rax+3C0h], 2</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">的时候蓝屏了，这说明我们有什么东西没初始化。寻找这玩意的最好的办法是,ida搜索[rax+3C0h]访问的特征码:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.46296296296296297" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002185" src="https://wechat2rss.xlab.app/img-proxy/?k=d357edb6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MXcmbq2F34LTCN7thePfOicKBbEvEhnsUdxHUgMpEyEWYX4LBxZe1oag%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">根据特征码找一下cal，可以定位到，这个是在初始化win32k pfn的时候填的东西</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5916666666666667" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002187" src="https://wechat2rss.xlab.app/img-proxy/?k=aed75c47&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MegV8svIfBgibF52LzyK8iaJiaaJ58VQATEFnCPqcI8H8TuT89cV6icXibAw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">就不卖关子了,我直接说为什么:</span><span leaf=""><br/></span><span leaf="">在操作系统创建进程时，分配进程内存和初始化进程的pfn的时候，会考虑进程的会话和上下文信息，以决定是否允许该进程访问 win32k 的pfn。而我们是直接在系统线程启动的进程，自然就没这些信息。</span><span leaf=""><br/></span><span leaf="">解决方法是附加到一个带界面的信息，比如我附加到资源管理器，这样会话也会自动分配到1而不是0:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.7212962962962963" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002188" src="https://wechat2rss.xlab.app/img-proxy/?k=150ccc6f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MX5xibySpTUoM4ZUY4vlQ2xWPfK00cUtX5UHXC21HTqsZvEfKg25dibXw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这样你结束就不会蓝屏了，至此我们成功的实现了内核创建进程</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.4601851851851852" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002189" src="https://wechat2rss.xlab.app/img-proxy/?k=b783f857&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MgSCgrLsTdsgUh9rptERVH4V2iadJmIAYR5J04ic4ib3lvrRotOKUAeTqQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">进程回调</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我们在</span><span leaf=""><br/></span><span leaf="">《[2022]新瓶装旧酒: 微软CreateProcessNotify的设计缺陷》</span><span leaf=""><br/></span><span leaf=""><a href="https://key08.com/index.php/2022/10/12/1606.html" target="_blank">https://key08.com/index.php/2022/10/12/1606.html</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">中提到过 进程创建会触发createprocessnotify回调，这也是现在很多安全软件所用来监控进程创建的回调。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.4685185185185185" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002191" src="https://wechat2rss.xlab.app/img-proxy/?k=400fc1c5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MGJTiaYWokrrdKkX7WGdBZlvZCM19T0fu6rH9MvickzEsAibibo3eZyHv3w%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而这些回调会加入到PspCreateProcessNotifyRoutine里面.在有进程创建的时候，会被逐个执行</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.3675925925925926" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002194" src="https://wechat2rss.xlab.app/img-proxy/?k=5b7b0b76&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MQZkXeFhFvN0vGqeFR6lrozwDP4ywcDyqKe8Evr2UHxmaHlIx4y3FRw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">这些call最后被”PspCallProcessNotifyRoutines”这个执行:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.3675925925925926" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002190" src="https://wechat2rss.xlab.app/img-proxy/?k=306fb36e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MoH2QnKyaPPicZvuscYIXMSuPDbzhKCFpp46YIW62UdqSQeVdEiaRVib1g%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.649074074074074" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002193" src="https://wechat2rss.xlab.app/img-proxy/?k=6f721d51&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MJKvGeiaMuQv5n9WZ2ibS6UPOLZh7y0vxhqQTeic7VZtE8MF666H3Eibatg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">so，有什么不搞DKOM的方法去不触发此类回调呢？有的兄弟，有的，那就是CPU模拟</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">AMD64 CPU模拟器</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">既然我们控制不了系统的执行流程，那么我们就不控制了，我们自己模拟一个CPU进行执行，只不过给的是真实的信息数据，唯一区别是，在执行PspCallProcessNotifyRoutines的时候,我们就跳过,其他时候跟操作系统一样就行。输入输出完全一样。</span><span leaf=""><br/></span><span leaf="">至于系统的call,我们除了PspCallProcessNotifyRoutines其他的就直接转发。这样我们就能达到目的。</span><span leaf=""><br/></span><span leaf="">如果不理解，这里有一个简单的图：</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.6157965194109772" data-type="png" data-w="747" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002192" src="https://wechat2rss.xlab.app/img-proxy/?k=d71991ac&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6M0UtP46ThgaUMLV31gzkrhf70iad1q4JD26kkYQNSdjbvI7rwb3eJWhA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">架构设计</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">我这边就最简单的zydis了，手搓的不需要太复杂。一个简单的X86虚拟就只需要指令行为模拟和栈就行，遇到call，我们要么选择转发，要么选择接管。</span><span leaf=""><br/></span><span leaf="">简单来说</span></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">初始化X64的vCpu</span></h4><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="1.3825136612021858" data-type="png" data-w="732" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002195" src="https://wechat2rss.xlab.app/img-proxy/?k=b5d8a716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MGUJKfSr8p9f6kDpAcibrs9Ub6gzAn5X3wWiaOHCr7Z3Uw2A5bfx4rNog%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">一次性decode 15字节</span></h4><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.8064814814814815" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002197" src="https://wechat2rss.xlab.app/img-proxy/?k=51e4a350&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6M9pHIczrnEk4CGUJQZfSMnNOx6GIviafSFAzh5Qg8rbBfibQuBCjI5EYA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h4 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.5rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">decode后，根据指令读取/写入不同的内存</span></h4><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.8527777777777777" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002198" src="https://wechat2rss.xlab.app/img-proxy/?k=3a29f9ed&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MDkuOov9wDzHRzvjISnYeWVynl2yy54EOacmQMK27aFOhJg8nKB76SQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">比如mov rax,那就是给vcpu写入值</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.34814814814814815" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002199" src="https://wechat2rss.xlab.app/img-proxy/?k=e4c19975&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6ME9fCAXT2UVrJOe9KKGpIVEfNPpHBHPLjcdzOa7A9ViaQSauUibwq32Fg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">这一段让AI干了，纯苦力牛马活，没AI干不动</span><span leaf=""><br/></span><span leaf="">值得注意的是，一些指令会影响elflags,所以也记得让AI干好,AI会忽略这些影响elfags的指令:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.7175925925925926" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002196" src="https://wechat2rss.xlab.app/img-proxy/?k=6f717f7c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6Mxe2zFByT722F7icrR7ksy7drjnUemyUOMQIicVZJ2lZd16rBiajSPK6HQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">执行他</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">之后就能愉快的把参数PUSH到vm里面并且执行了</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.5675925925925925" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002203" src="https://wechat2rss.xlab.app/img-proxy/?k=b52a7fff&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MAOaMUGXEsxgEsRNG0vHtmhicYOUTzkaPVYvZ1FmVaCnoFPxiaXVt3Rjw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">值得注意的几个问题是，遇到cfg guard的时候,不要虚拟执行,因为CFG guard的bitmap会校验来源,我们的这种call肯定是非法的。最好的办法是跳过他如何call cfg,我之前手写的时候跳过是硬编码地址,但是GPT说有更好的,嗯…直接硬编码</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.262037037037037" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002201" src="https://wechat2rss.xlab.app/img-proxy/?k=777951da&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6M2YHBlvw38qEFe7VWTHL80OzCF60uvFD19jzIZKWvxuelQ2P1uKmdpw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">如果遇到了直接跳过就行</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.16412213740458015" data-type="png" data-w="1048" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002200" src="https://wechat2rss.xlab.app/img-proxy/?k=1b08d80b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MccFiaWAGxa09UicWqc8nbvDPVPb9q4lXJgGOS6yuTtYVGPvoUA25AicgA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">call转发我之前也想的是人模拟参数,但是GPT给了一个更野的,直接全参数call,爱用哪个用哪个:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.625" data-type="png" data-w="592" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002202" src="https://wechat2rss.xlab.app/img-proxy/?k=102fc246&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6Mompia6S4V8hP4V07Iiau0q9MQI2fYLC383pT6Qu01YL8WYiclvLWT9osQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">还得是AI,真的野，</span><span leaf=""><br/></span><span leaf="">此外我们设置返回地址为0，这样当模拟执行到0的时候，代表执行完成了。</span><span leaf=""><br/></span><span leaf="">我们来试一下直接模拟+call转发的:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.3453703703703704" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002204" src="https://wechat2rss.xlab.app/img-proxy/?k=61fa74ad&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MFeK3XU8Jp0snlB4Yjf1m7Aeb5iaJWe4w3HRVcOyKkPW9ZibErB0ic69gg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">可以看到,我们成功的运行了。</span><span leaf=""><br/></span><span leaf="">接下来跳过指定的函数,这也非常容易,我们直接跳过并且返回一个自定义的rax就行,我们跳过的是PspCallProcessNotifyRoutines,他不会修改传递的参数里面的内容,所以简单点就行:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.2657407407407407" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002208" src="https://wechat2rss.xlab.app/img-proxy/?k=70737e0d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6Mr89atJNkDam8hAH8e2E3lXe4EBRk8FNBvfsoaNmibgT14O4Wzqcz1DA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">这样我们就实现了完整跳过内核回调了</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">结果</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">让我们写个简单的createprocess回调看看，他会捕获所有cmd的执行</span><span leaf=""><br/></span><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002206" data-ratio="0.9682242990654205" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" data-w="1070" src="https://wechat2rss.xlab.app/img-proxy/?k=721b41e6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MMOqc9JKIOQ5nVC6oyEnlIjk5kNcmxexLXaicrAjqAnP2bYGOhOUancA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">当我们执行cmd的时候,他会执行:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.08565928777670838" data-type="png" data-w="1039" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002207" src="https://wechat2rss.xlab.app/img-proxy/?k=cab32190&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6MkYFrXOIoE1VfoKNznicts7kkRibrmdIbUribqUtVZf4REqVON1FJPPIibw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><span leaf=""><br/></span><span leaf="">我们试试，传统内核直接ntcreateuserprocess:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">很明显,因为会触发PspCallProcessNotifyRoutines,导致我们被发现:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.3351851851851852" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002205" src="https://wechat2rss.xlab.app/img-proxy/?k=18fe9be1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6McYoI6TeeKYFDmiazfHRHkVYUc2rcXHniaaTSysvu5DCwyLUStn4zQydg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">而使用cpu模拟的ntcreateuserprocess,不会触发内核的进程回调的:</span><span leaf=""><br/></span><span leaf=""><img data-aistatus="1" class="rich_pages wxw-img" data-ratio="0.325" data-type="png" data-w="1080" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-imgfileid="100002209" src="https://wechat2rss.xlab.app/img-proxy/?k=c403869a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLGKcY4e7q0ANGY1jt6sG6Mu0Ez6qXQrSgmuIASH055W3DjL1pC9TAHmvwRfR56R8CreDy9K8iacLA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">so…可能好奇的你问,这有什么用.</span><span leaf=""><br/></span><span leaf="">此技术有三个用途:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">第一个是反作弊,总所周知,部分外挂会通过这些进程创建回调等回调,去拿真实的CR3或者做进程APC注入.而部分反作弊使用这种技术去不触发这些系统的回调启动游戏进程实现保护的效果</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">第二个是,目前绝大部分安全软件,都是基于</span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">PspCallProcessNotifyRoutines</span></code><span leaf="">里面的回调创建</span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">进程管理器</span></code><span leaf="">的,一旦一个进程不在安全软件自己的</span><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;color: rgb(232, 62, 140);word-break: break-word;"><span leaf="">进程管理器里面</span></code><span leaf="">,会导致安全软件</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">无法监控到这个进程所有的行为</span></strong><span leaf="">,虽然有些脱裤子放屁的嫌疑,因为都驱动了都可以各种手段致盲安全软件了。</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">第三个是,他本来就没什么用,就跟大部分东西一样,写了就是为了提高自己技术.不要以”有什么用”去做某件事,要以”好玩就行”去做某件事。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><a href="%27%27">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=42dcfde2&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247485866%26idx%3D1%26sn%3D027c346f42696ff753a8681b2308e3c2">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sat, 24 Jan 2026 16:30:00 +0800</pubDate>
    </item>
    <item>
      <title>现代windows内存攻防简介(2026年)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485822&amp;idx=1&amp;sn=93390a5b33f43d4822bb76b04a6ee436</link>
      <description>简介又过一年了兄弟们，是时候更新冲鸭安全和key08了。主要是1月太忙了，一直忙着新产品，一直没空更新公众号和博客，趁着现在有空赶紧更新一波。</description>
      <content:encoded><![CDATA[<p>原创 <span>为了安全鸭</span> <span>2026-01-13 09:00</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=e3e3d85f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfiarPowJd4nnyHQCzCyyxG26m2nH5hv1xr3FLt2HqsBkeibogxsNQnazA%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">简介</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">又过一年了兄弟们，是时候更新冲鸭安全和key08了。主要是1月太忙了，一直忙着新产品，一直没空更新公众号和博客，趁着现在有空赶紧更新一波。</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">shellcode</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">安全软件对抗中,常用shellcode作为规避杀毒软件文件查杀的办法,因为shellcode可以内存执行,可以随时抹掉,并且容易变形.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">一段经典的shellcode loader如下:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">    char* shellcode = (char*)VirtualAlloc(</span><br/><span leaf="">        NULL,</span><br/><span leaf="">        shellcode_size,</span><br/><span leaf="">        MEM_COMMIT,</span><br/><span leaf="">        PAGE_EXECUTE_READWRITE);</span><br/><span leaf="">    CopyMemory(shellcode, buf, shellcode_size);</span><br/><span leaf="">    //CreateThread函数，创建线程</span><br/><span leaf="">    hThread = CreateThread(</span><br/><span leaf="">        NULL, // 安全描述符</span><br/><span leaf="">        NULL, // 栈的大小</span><br/><span leaf="">        (LPTHREAD_START_ROUTINE)shellcode, // 函数</span><br/><span leaf="">        NULL, // 参数</span><br/><span leaf="">        NULL, // 线程标志</span><br/><span leaf="">        &amp;dwThreadId // 若成功，接收新创建的线程的线程ID DWORD变量的地址。</span><br/><span leaf="">    );</span></code></pre><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">如果你对”他发生了什么”感兴趣自己问chatgpt的VAD/PTE吧,这里我们不废话介绍原理了.</span></p></blockquote><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">一般检测</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">现代的杀毒软件/或者EDR,对于这分配内存,一般会扫一下VAD里面的rwx</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002155" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9ba67bcd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfWtZRhTtYabzVEXEgADD1Ha5o7Eghrz2zVALicib2Ug25EhvUmWwByeSQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">代码如下:</span></p><pre style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: 13.118px;margin-top: 0px;margin-bottom: 1rem;overflow: auto;display: block;color: rgb(33, 37, 41);max-height: 400px;background-color: rgb(245, 245, 245);border: 1px solid rgb(204, 204, 204);padding: 0.5em;border-radius: 4px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-family: SFMono-Regular, Menlo, Monaco, Consolas, &#34;Liberation Mono&#34;, &#34;Courier New&#34;, monospace;font-size: inherit;color: inherit;word-break: normal;white-space: pre-wrap;"><span leaf="">MEMORY_BASIC_INFORMATION mbi = { 0 };</span><br/><span leaf="">        SIZE_T address = 0;</span><br/><span leaf="">        while (VirtualQueryEx(hProcess.get(), reinterpret_cast&lt;LPCVOID&gt;(address), &amp;mbi, sizeof(mbi)) == sizeof(mbi))</span><br/><span leaf="">        {</span><br/><span leaf="">            // 排除模块映像段</span><br/><span leaf="">            if (mbi.Type != MEM_IMAGE)</span><br/><span leaf="">            {</span><br/><span leaf="">                // 检查是否可执行</span><br/><span leaf="">                DWORD protect = mbi.AllocationProtect;</span><br/><span leaf="">                bool checkExecuteFlag =</span><br/><span leaf="">                    (protect &amp; PAGE_EXECUTE) ||</span><br/><span leaf="">                    (protect &amp; PAGE_EXECUTE_READ) ||</span><br/><span leaf="">                    (protect &amp; PAGE_EXECUTE_READWRITE) ||</span><br/><span leaf="">                    (protect &amp; PAGE_EXECUTE_WRITECOPY);</span><br/><span leaf="">                if (checkExecuteFlag)</span><br/><span leaf="">                {</span><br/><span leaf="">                    .....</span><br/><span leaf="">                    if (!memoryAvEngin-&gt;ScanProcessBlocks(memoryStreamPtr, false, callback)) {</span><br/><span leaf="">                        printf(&#34;ScanProcessBlock error&#34;);</span><br/><span leaf="">                    }</span><br/><span leaf="">                    .....</span><br/><span leaf="">                }</span><br/><span leaf="">            }</span><br/><span leaf="">            // 跳到下一个内存区域</span><br/><span leaf="">            address = reinterpret_cast&lt;SIZE_T&gt;(mbi.BaseAddress) + mbi.RegionSize;</span><br/><span leaf="">        }</span></code></pre><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">由于VirtualAlloc分配的内存是RWX属性并且不是MEM_IMAGE,所以会被扫出来后匹配特征码。</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">缺陷</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">实际上，与大家想的不同，安全软件通常不会直接报RWX为病毒(不过部分**EDR会这样做)。这个原因是 实际环境中，</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">基本每个电脑都会或多或少的有几个RWX内存，jit，广告软件，部分加壳软件居多。</span></strong><span leaf="">所以杀毒软件不会看到就报，他一定匹配特征码，并且做匹配:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">比如ES的yara为例子:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_CobaltStrike.yar" target="_blank">https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Windows_Trojan_CobaltStrike.yar</a></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002154" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=01c74a3e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUf8Fia1QRicMje3PNfexCUKL0lrLiaARYtVb1jryiccqLTqt1icibolvyJsr9g%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">他不能看到就直接告警，会出现严重问题。必须依赖特征码，并且还有一个致命问题: 依赖进程有RWX的内存，否则就扫不到了。</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">总结一个痛点是，必须要能扫到RWX内存，并且必须要匹配特征.</span></strong></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以,这种其实后来演变到所谓的”自研C2”/“二开CS”/“SleepMask”。为什么他们能工作的重要原因是,自研/二开的马，没有被拉黑特征，而Sleepmask等一派的东西，他们在休眠的时候是把RWX内存去掉了X属性甚至是混淆了shellcode，导致上面的遍历VAD的代码失效了</span></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">升级检测</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">在前面的一般检测遇到瓶颈后，安全厂商发明了新的办法，为了解决前面的所谓的匹配不到RWX的问题,可以用更激进的手段.这边有几种手段:</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">SleepMask: 检测所谓的RWX切换</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">部分厂商,比如ES通过TI-ETW检测virtualprotect的切换RWX内存，这样就检测了所谓的SleepMask因为这玩意会切换内存，这挺草台的说实在的，但是能用就不深入说了</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">不依赖特征: 检测shellcode API调用</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">为了更好的时机去检测,部分厂商使用API HOOK,去挂钩某些SYSCALL或者某些关键API，挂钩后，检测调用是否来自Shellcode,如果是直接拦截或者阻止,而且不止API调用,也能通过TIETW拿到某些来自shellcode的call从而检测.</span></p><blockquote style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin: 5px 0px 15px;overflow: hidden;border-width: 0px 0px 0px 4px;border-top-style: initial;border-right-style: initial;border-bottom-style: initial;border-left-style: solid;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: rgb(122, 208, 58);border-image: initial;padding: 8px 12px;background-color: rgb(241, 241, 241);box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 1px 0px;font-size: 14.992px;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;"><span leaf="">对这块感兴趣的我强烈建议你购买一份冲鸭安全的EPP开发教程,此事在EPP开发里面有提到</span></p></blockquote><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">缺陷</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" data-pm-slice="0 0 []"><span leaf="">这几个检测手段的缺陷同样有问题,有几个问题:</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">盲目检测误报大 -生产环境几乎不能用,比如某些严格点策略的组织连x神游戏都打不开,打开直接被拦截.</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">为了消除误报,依然使用特征码 -虽然解决了SleepMask导致获取不到shellcode的问题,但是为了减少误报,依然会用特征码尝试对shellcode进行匹配,否则是没办法上生产环境的,依然会被自研C2绕过</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">各种花式syscall直接调用，ntdll unhook，调用栈欺骗绕过API的钩子</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002158" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=34118d36&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfmtQLBnickxMQJU4NwI3iboFfK8HibLkVQITuIzhF2103qAcaB4zUlHGXw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p></li></ol><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">继续升级检测</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">大部分厂商在前面两个阶段就停止对抗了,毕竟用户电脑不是战场,而且手段越多误报越多,不方便运维.但是</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">部分好一点的厂商为了解决以上的手段,继续加码,对抗到底:</span></strong><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">首先,使用CET技术或者其他调用栈完整性校验技术,去检测异常调用栈,这里分两种,常见是软件类的,不太常见的是硬件类的.先说硬件类型的:</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">CET技术:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002159" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=40d882f5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfrhqI8t4r4R6MOPq1FibnR6IKIPicm7iaI0eZKm98SIDasbTxmLYvUA2bg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">Intel Processor Trace技术:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002161" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=66f67f24&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfib98YcFTVo3MkJvCtSkIJOx5RgZQwic0fQnbeaicUibu1wiaYvVRV6mj24A%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">软件类型的:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">[2025]SleepDuck-通用堆栈欺骗检测POC,检测SleepMask</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485281&amp;idx=1&amp;sn=104dc45d47d49fb79648230372f522af&amp;scene=21#wechat_redirect" textvalue="SleepDuck：通用堆栈欺骗检测POC,检测SleepMask" data-itemshowtype="0" linktype="text" data-linktype="2">SleepDuck：通用堆栈欺骗检测POC,检测SleepMask</a></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">TI-ETW结合调用栈:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002160" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=3459207b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfhHxrJRzFBloIlQo40TRnYKibmesNEFCAN5gicuyjPLfUa9vAiazZOltvA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">天守EDR的动态指令追踪技术:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002157" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=d54f95a3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfbxvcIUsXEQmU2330697aKWlZZ6uWMm4x1Lt6xM5sqVCOEPVScvLsYg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">结合虚拟执行,检测调用栈完整性:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002162" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=23f67ac5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfwHxS24a7fQz7s9ToeXvaqzGHCFuau86RVSm8VhBpY8PiaexL5mUQuGw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">此类软/硬技术结合</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf=""> 就保证了获取的调用栈是真实可靠的,而不是被欺骗的.</span></strong><span leaf="">并且无法通过摘钩进行绕过.反而摘钩/栈欺骗会导致被检测.</span></p><h3 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 1.75rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">缺陷</span></h3><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">此类技术,有严重的缺陷,基于硬件的需要硬件达标,暂且不提</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">基于软件的技术,只能EDR来处理数据,EPP是处理不了这些数据的,处理了也会卡本机系统,因此只能在EDR上使用此类技术,成本没有办法降低.</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">因此实际做到这一层的很少,实践中也遇到的非常少,总的来说因为成本太大,此类操作不太符合目前的安全市场行情</span></strong></p><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">下一代展望</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这里多扯几句，如果我以后还在干安全,并且让我来设计下一代怎么检测shellcode内存加载的操作的话,我会先思考两个问题,我们需要解决什么问题? 我们需要怎么做才能彻底解决他?</span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">当前所有的检测主要有几个痛点:</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">检测成本太高</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">无论什么手段,为了防止误报,依然无法离开基于特征码的检测</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">其实整篇文章我故意忽略了一个细节,</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">那如果我们不放到RWX内存呢,会怎么样?</span></strong><span leaf="">答案是全部拉闸,如果你了解外挂就会知道,外挂喜欢找代码洞把shellcode塞到文件段里面,这样就扫不到了.除非更进一步做CRC内存-&gt;文件完整性校验,那样成本更高了.</span></p></li></ol><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以,要是让我来搞,我一定会选择语义检测，在如今全是LLMs的时代,我们不能再抱着传统不放手.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">这是有可能的,我们完全可以这样做:</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">把shellcode/调用堆栈/等代码变成HLIL,类似于IDA的伪代码一样</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">把HLIL送到transformer-base的二分类器里面,就跟以前古早时期那种什么AI检测说的话是不是恶意的话一样.剩下的等结果就行,整个过程非常快,因为不是大模型,是小小模型.</span></p></li></ol><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">这样会解决如下问题:</span></p><ol style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">基于语义的分析,</span><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">即便是不用AI,也能用规则驱动检测</span></strong><span leaf="">,比如检测PEB直接寻找的shellcode,比如检测shellcode里面的内容到底是在干什么,是混淆还是什么</span></p></li><li style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"><p><span leaf="">能检测出不放到RWX段的shellcodes,因为他不需要关心是不是RWX,输入应该是调用栈的各个地址就能开始检测,并且由于没有特征匹配的环节,所以他的速度非常非常的快.</span></p></li></ol><h2 style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 0.5rem;font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-weight: 500;line-height: 1.2;color: rgb(102, 102, 102);font-size: 2rem;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">扩展阅读(广告)</span></h2><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);font-weight: bolder;"><span leaf="">我提到的语义分析目前真的不是什么技术难题,shellcode2hlil的引擎已经有了: </span></strong><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002163" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=fd0890eb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfYHII1DbeYCTFcVMfseicbxqqUXz4t0aBUxVBln9yJm4gsMFSUiaTVyzA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">[2025]在线样本分析平台,下一代文件云鉴定</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485767&amp;idx=1&amp;sn=2527efc71f3493583fa34c43a7eeec23&amp;scene=21#wechat_redirect" textvalue="大模型的病毒木马文件云鉴定平台(粉丝内测)" data-itemshowtype="0" linktype="text" data-linktype="2">大模型的病毒木马文件云鉴定平台(粉丝内测)</a></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">剩下的就是训练一个transformer分类器就行.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">本系统已经有部分应用,不过目前接的是大模型,还没接transformer分类器,可以先用着,目前开放体验(还没开放shellcode/elf的检测,只开放了PE的):</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485757&amp;idx=1&amp;sn=6a9abd8c76b5537f73f64671ff48a7e7&amp;scene=21#wechat_redirect" textvalue="基于大模型的病毒木马文件云鉴定" data-itemshowtype="0" linktype="text" data-linktype="2">基于大模型的病毒木马文件云鉴定</a></span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">目前对于PE的效果非常好,同时其实平台也支持ELF和SHELLCODE,但是我现在暂时没开放,还需要调试这两个</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf="">比如VT 1报毒的木马:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002165" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c66c114e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUf2BFCBdrjtKv54icLIdqlorHOh5oQm9etnXpchicQy4tXYotzVrdicGVibg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" nodeleaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002164" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=670c0c4c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfsb8S8shejOZqKvIk5LSuCXXXLvsCU2v8FBibfdHb8EOSejdREOiblVwQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">常规ghost:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002166" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=89c7ac3b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfQYWvHS4BIvVqrOUQ8ybGEicia2Lib7Ddy7pibGjia1qCaqvImR75HLuiaW6w%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">c#:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002168" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c5e9a3ef&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfmRQ8T54LFOwyjtSvPLcFuIvibvOyqcFL6viaNhV7ZODAcVRC18ic8d7hg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">混淆:</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002170" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9c0406dd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUftyXNVCM7EKiaO0R53KGXLIlL1ic8IW6QQxvGkWNRiaqciaJ2cOj6ecbLsg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">重要的是,核心引擎只有6M,6M还是因为我带了一个libcurl</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002167" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=c37a325d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfRCbxYtZdtb5Fgpg7n5Nwvphic9Luyq2xvvl5PDeictJ3vJl3Nm0rtVibA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);margin-top: 0px;margin-bottom: 1rem;display: block;color: rgb(102, 102, 102);font-family: &#34;Hiragino Sans GB&#34;, 微软雅黑, 黑体, Arial, sans-serif;font-size: 14.992px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;white-space: normal;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span leaf="">所以下一步,完全可以携带到客户端,做shellcode分析/病毒分析等.</span><br style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);"/><span leaf=""><img class="rich_pages wxw-img" data-aistatus="1" data-imgfileid="100002169" style="box-sizing: border-box;scrollbar-width: thin;scrollbar-color: rgb(136, 136, 136) rgb(241, 241, 241);vertical-align: middle;border: 0px;max-width: 100%;" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=9b543bda&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWLiaoSiaatuXoGtnHaD0qljUfKUTQLVFfaiaDsnNVkXX5Xe2xOK7WkAk5mkiaibPnia3WjK0K00FDG6ePhg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><a href="%27%27">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=6e29f660&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247485822%26idx%3D1%26sn%3D93390a5b33f43d4822bb76b04a6ee436">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Tue, 13 Jan 2026 09:00:00 +0800</pubDate>
    </item>
    <item>
      <title>大模型的病毒木马文件云鉴定平台(粉丝内测)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485767&amp;idx=1&amp;sn=2527efc71f3493583fa34c43a7eeec23</link>
      <description></description>
      <content:encoded><![CDATA[<p>原创 <span>huoji</span> <span>2025-12-24 21:17</span> <span style="display: inline-block;">北京</span></p>






  
  <p><img src="https://wechat2rss.xlab.app/img-proxy/?k=9ccd09bd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_jpg%2FejibWMxI7nWJoCw7zMsqpibxLruv5xuicq4wReVxeSZanq20wJEZzOHPficQD68HTSuRcqXp7wFZhS3k7rEjuVjeyA%2F0%3Fwx_fmt%3Djpeg"/></p>
  
  <p><span leaf="">上一篇文章说到的</span></p><p><span leaf=""><a class="normal_text_link" target="_blank" style="" href="https://mp.weixin.qq.com/s?__biz=MzkyOTc0NDY2Nw==&amp;mid=2247485757&amp;idx=1&amp;sn=6a9abd8c76b5537f73f64671ff48a7e7&amp;scene=21#wechat_redirect" textvalue="基于大模型的病毒木马文件云鉴定" data-itemshowtype="0" linktype="text" data-linktype="2">基于大模型的病毒木马文件云鉴定</a></span></p><p><span leaf="">目前有粉丝内测平台了</span></p><p><span leaf="">微信回复 &#34;分析</span><span leaf="">平台</span><span leaf="">&#34; 得到访问地址</span></p><p><span leaf="">目前只支持PE文件, 这个服务器是一个1H 512M的机器 不要狠蹬</span></p><p><span leaf="">平台亮点</span></p><p><span leaf="">支持AI分析,智能出结果,准确率高,有可解释性:</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002112" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=938a2a5e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWJoCw7zMsqpibxLruv5xuicq4Eqj5icjG1Jg1NrPvicK3tOgtgZ40oacicwx4Pyoae5tKGlNlJ2IV9NqCg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002114" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0f28df88&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWJoCw7zMsqpibxLruv5xuicq4A1BEEBMJvM6LcZOIq5bOTlKlicTueTnEnwrmzAmicvsKT2x7UW1aOD5Q%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002113" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=407866e3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWJoCw7zMsqpibxLruv5xuicq4CvGLcT3yOneicsoFbeoDobGGUwtEuQJC0kw4FkjmmtkeVlMgoqP8vCg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002115" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=7f7f1729&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWJoCw7zMsqpibxLruv5xuicq4hl6cE5Ijc67PzfFjs1JDM5FjzeUtic1PYOhvT9ic5ZKBO5YzsPXDElicA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p><span leaf="">反汇编:</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002116" data-s="300,640" type="block" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=06832ee4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWJoCw7zMsqpibxLruv5xuicq4mgBmYrt3WX4LibSNKIxGDR3Vgwl0mDialByDam3fKIoevgScEGOkc6bQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p data-pm-slice="2 1 []"><span leaf="">有任何问题加群反馈(误报/不报):</span></p><p style="text-align: center;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100002111" data-ratio="1.0609756097560976" data-s="300,640" type="block" data-type="png" data-w="410" src="https://wechat2rss.xlab.app/img-proxy/?k=00bd1cb3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fsz_mmbiz_png%2FejibWMxI7nWJoCw7zMsqpibxLruv5xuicq4X9oNeYgjQvYxCooX8ianwqAyrXezibn2MtzAZSmIjm6ugcCP8tPy9y3w%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><a href="%27%27">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=57710e24&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzkyOTc0NDY2Nw%3D%3D%26mid%3D2247485767%26idx%3D1%26sn%3D2527efc71f3493583fa34c43a7eeec23">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 24 Dec 2025 21:17:00 +0800</pubDate>
    </item>
  </channel>
</rss>