<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Udp on 备忘</title>
    <link>https://blog.witd.in/tags/udp/</link>
    <description>Recent content in Udp on 备忘</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>kongfei605@gmail.com (kongfei)</managingEditor>
    <webMaster>kongfei605@gmail.com (kongfei)</webMaster>
    <copyright>(c) 2022 witd. All rights reserved</copyright>
    <lastBuildDate>Sat, 19 Aug 2023 21:45:10 +0800</lastBuildDate>
    
	<atom:link href="https://blog.witd.in/tags/udp/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>udp端口探活</title>
      <link>https://blog.witd.in/2023/08/19/udp%E7%AB%AF%E5%8F%A3%E6%8E%A2%E6%B4%BB/</link>
      <pubDate>Sat, 19 Aug 2023 21:45:10 +0800</pubDate>
      <author>kongfei605@gmail.com (kongfei)</author>
      <guid>https://blog.witd.in/2023/08/19/udp%E7%AB%AF%E5%8F%A3%E6%8E%A2%E6%B4%BB/</guid>
      <description>&lt;h1 id=&#34;一-背景&#34;&gt;一 背景&lt;/h1&gt;

&lt;p&gt;商业客户反馈用&lt;code&gt;categraf&lt;/code&gt;的&lt;code&gt;net_response&lt;/code&gt;插件配置了&lt;code&gt;udp&lt;/code&gt;探测, 遇到报错了，如图
&lt;img src=&#34;https://blog.witd.in/images/udp_port_scanning/error.png&#34; alt=&#34;error.png&#34; /&gt;&lt;/p&gt;

&lt;p&gt;udp是无连接的，无法用建立连接的形式判断端口。 插件最初的设计是需要配置udp的发送字符，并且配置期望返回的字符串，&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[[instances]]
targets = [
      &amp;quot;127.0.0.1:161&amp;quot;,
]

protocol = &amp;quot;udp&amp;quot;

## string sent to the server
  send = &amp;quot;hello&amp;quot;
## expected string in answer
  expect = &amp;quot;hello&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;通过返回字符与期望字符是否相等，来判断端口是否连通。用户随即发了另一张图 ，用ncat 来探测端口是ok的
&lt;img src=&#34;https://blog.witd.in/images/udp_port_scanning/ncat.png&#34; alt=&#34;ncat.png&#34; /&gt;
&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>