2019-04-21 11:50:48 +08:00

42 lines
2.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="nc">nc</h1>
<p>命令用于设置路由器。</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>nc命令</strong> 用于设置路由器。执行本指令可设置路由器的相关参数。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">nc [-hlnruz][-g&lt;网关...&gt;][-G&lt;指向器数目&gt;][-i&lt;延迟秒数&gt;][-o&lt;输出文件&gt;][-p&lt;通信端口&gt;]
[-s&lt;来源位址&gt;][-v...][-w&lt;超时秒数&gt;][主机名称][通信端口...]</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-g&lt;网关&gt; 设置路由器跃程通信网关最丢哦可设置8个。
-G&lt;指向器数目&gt; 设置来源路由指向器其数值为4的倍数。
-h 在线帮助。
-i&lt;延迟秒数&gt; 设置时间间隔,以便传送信息及扫描通信端口。
-l 使用监听模式,管控传入的资料。
-n 直接使用IP地址而不通过域名服务器。
-o&lt;输出文件&gt; 指定文件名称把往来传输的数据以16进制字码倾倒成该文件保存。
-p&lt;通信端口&gt; 设置本地主机使用的通信端口。
-r 乱数指定本地与远端主机的通信端口。
-s&lt;来源位址&gt; 设置本地主机送出数据包的IP地址。
-u 使用UDP传输协议。
-v 显示指令执行过程。
-w&lt;超时秒数&gt; 设置等待连线的时间。
-z 使用0输入/输出模式,只在扫描通信端口时使用。</code></pre>
<h3 id="实例">实例</h3>
<p>TCP端口扫描</p>
<pre><code class="language-bash">[root@localhost ~]# nc -v -z -w2 192.168.0.3 1-100
192.168.0.3: inverse host lookup failed: Unknown host
(UNKNOWN) [192.168.0.3] 80 (http) open
(UNKNOWN) [192.168.0.3] 23 (telnet) open
(UNKNOWN) [192.168.0.3] 22 (ssh) open</code></pre>
<p>扫描192.168.0.3 的端口 范围是 1-100 扫描UDP端口</p>
<pre><code class="language-bash">[root@localhost ~]# nc -u -z -w2 192.168.0.1 1-1000 # 扫描192.168.0.3 的端口 范围是 1-1000</code></pre>
<p>扫描指定端口</p>
<pre><code class="language-bash">[root@localhost ~]# nc -nvv 192.168.0.1 80 # 扫描 80端口
(UNKNOWN) [192.168.0.1] 80 (?) open
y //用户输入</code></pre>
<p>查看从服务器到目的地的出站端口 443 是否被防火墙阻止</p>
<div class="sourceCode" id="cb6"><pre><code class="language-bash"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="ex">nc</span> -vz acme-v02.api.letsencrypt.org 443 -w2</a>
<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="co"># Ncat: Version 7.50 ( https://nmap.org/ncat )</span></a>
<a class="sourceLine" id="cb6-3" data-line-number="3"><span class="co"># Ncat: Connected to 23.77.214.183:443.</span></a>
<a class="sourceLine" id="cb6-4" data-line-number="4"><span class="co"># Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds.</span></a></code></pre></div>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->