<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wireshark &#8211; セキュリティエンジニアの雑多ブログ</title>
	<atom:link href="https://cybermemo.blog/tag/wireshark/feed" rel="self" type="application/rss+xml" />
	<link>https://cybermemo.blog</link>
	<description>セキュリティエンジニアの学習記録</description>
	<lastBuildDate>Sun, 26 Oct 2025 07:50:13 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://cybermemo.blog/wp-content/uploads/2025/10/cropped-トップアイコン-32x32.jpg</url>
	<title>Wireshark &#8211; セキュリティエンジニアの雑多ブログ</title>
	<link>https://cybermemo.blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Nmapでポートスキャンをしてみる</title>
		<link>https://cybermemo.blog/nmap-port-scan</link>
					<comments>https://cybermemo.blog/nmap-port-scan#respond</comments>
		
		<dc:creator><![CDATA[miyuki]]></dc:creator>
		<pubDate>Sun, 26 Oct 2025 07:50:12 +0000</pubDate>
				<category><![CDATA[TryHackMe]]></category>
		<category><![CDATA[コマンド]]></category>
		<category><![CDATA[セキュリティ]]></category>
		<category><![CDATA[Nmap]]></category>
		<category><![CDATA[tshark]]></category>
		<category><![CDATA[Wireshark]]></category>
		<category><![CDATA[ポートスキャン]]></category>
		<guid isPermaLink="false">https://cybermemo.blog/?p=540</guid>

					<description><![CDATA[<p><img src="https://cybermemo.blog/wp-content/uploads/2025/10/コマンド用アイキャッチ.jpg" class="webfeedsFeaturedVisual" /></p>はじめに Nmapで実際にポートスキャンをしてみた。検証環境は TryHackMe の Nmap ルーム。 本記事の内容は教育目的のみに記載しています。実環境での悪用は犯罪行為です。必ず許可された演習環境でのみ実践してく [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img src="https://cybermemo.blog/wp-content/uploads/2025/10/コマンド用アイキャッチ.jpg" class="webfeedsFeaturedVisual" /></p>
<h2 class="wp-block-heading">はじめに</h2>



<p>Nmapで実際にポートスキャンをしてみた。<br>検証環境は TryHackMe の Nmap ルーム。</p>


<div class="swell-block-postLink">			<div class="p-blogCard -external" data-type="type3" data-onclick="clickLink">
				<div class="p-blogCard__inner">
					<span class="p-blogCard__caption">TryHackMe</span>
					<div class="p-blogCard__thumb c-postThumb"><figure class="c-postThumb__figure"><img decoding="async" src="https://tryhackme-images.s3.amazonaws.com/room-icons/5d653d7a4e8a1a6d98379168cfc30ac0.png" alt="" class="c-postThumb__img u-obf-cover" width="320" height="180"></figure></div>					<div class="p-blogCard__body">
						<a class="p-blogCard__title" href="https://tryhackme.com/room/furthernmap" target="_blank" rel="noopener noreferrer">Nmap</a>
						<span class="p-blogCard__excerpt">An in depth look at scanning with Nmap, a powerful network scanning tool.</span>					</div>
				</div>
			</div>
		</div>


<p class="is-style-icon_info"><strong>本記事の内容は教育目的のみに記載しています。実環境での悪用は犯罪行為です。必ず許可された演習環境でのみ実践してください。</strong></p>



<h2 class="wp-block-heading">TCPスキャン</h2>



<p>使用頻度上位 100 ポートのみ（&#8211;top-ports 100）、スキャン中の詳細を表示（-vv）、pingをスキップ（-Pn）して<br>TCPスキャン（-sT）。</p>



<pre class="wp-block-code"><code>$ sudo nmap -sT --top-ports 100 -vv -Pn target ip</code></pre>



<p>openポートを発見。</p>



<pre class="wp-block-code"><code>Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-23 23:57 JST
Initiating Parallel DNS resolution of 1 host. at 23:57
Completed Parallel DNS resolution of 1 host. at 23:57, 0.00s elapsed
Initiating Connect Scan at 23:57
Scanning target ip &#91;100 ports]
Discovered open port 3389/tcp on target ip
Discovered open port 135/tcp on target ip
Discovered open port 80/tcp on target ip
Discovered open port 21/tcp on target ip
Discovered open port 53/tcp on target ip
Completed Connect Scan at 23:57, 7.02s elapsed (100 total ports)
Nmap scan report for target ip
Host is up, received user-set (0.37s latency).
Scanned at 2025-10-23 23:57:10 JST for 7s
Not shown: 95 filtered tcp ports (no-response)
PORT     STATE SERVICE       REASON
<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-swl-deep-01-color">21/tcp   open  ftp           syn-ack
53/tcp   open  domain        syn-ack
80/tcp   open  http          syn-ack
135/tcp  open  msrpc         syn-ack
3389/tcp open  ms-wbt-server syn-ack</mark></strong>

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 7.03 seconds</code></pre>



<p>tshark でログを取っていたので確認してみる。</p>



<pre class="wp-block-code"><code># tshark の結果を sT_result.txt へ出力
$ sudo tshark -i tun0 > sT_result.txt 
Running as user "root" and group "root". This could be dangerous.
Capturing on 'tun0'
237 ^C</code></pre>



<pre class="wp-block-code"><code># cat で全体のログを確認
$ cat sT_result.txt             
    1 0.000000000   host ip → target ip TCP 60 34450 → 111 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    2 0.000013296   host ip → target ip TCP 60 47774 → 113 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    3 0.000018708   host ip → target ip TCP 60 38474 → 135 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    4 0.000025294   host ip → target ip TCP 60 55670 → 5900 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    5 0.000030624   host ip → target ip TCP 60 46124 → 25 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    6 0.000035786   host ip → target ip TCP 60 59490 → 554 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    7 0.000041544   host ip → target ip TCP 60 38960 → 3306 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    8 0.000048233   host ip → target ip TCP 60 57882 → 110 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
    9 0.000052118   host ip → target ip TCP 60 42396 → 3389 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
   10 0.000059820   host ip → target ip TCP 60 37896 → 8888 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245774735 TSecr=0 WS=128
   11 0.377319586 target ip → host ip   TCP 52 135 → 38474 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   12 0.377390839   host ip → target ip TCP 40 38474 → 135 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
   13 0.378715797   host ip → target ip TCP 40 38474 → 135 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0
   14 0.378932212   host ip → target ip TCP 60 47616 → 23 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245775114 TSecr=0 WS=128
   15 0.378957703   host ip → target ip TCP 60 43838 → 995 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245775114 TSecr=0 WS=128
   16 1.027607473   host ip → target ip TCP 60 &#91;TCP Retransmission] 37896 → 8888 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245775763 TSecr=0 WS=128
（省略）</code></pre>



<p>ログを絞って確認。</p>



<pre class="wp-block-code"><code># SYN 以外のログで絞ってみる
$ cat sT_result.txt | grep -v -F "&#91;SYN]"
   11 0.377319586 target ip → host ip   TCP 52 135 → 38474 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   12 0.377390839   host ip → target ip TCP 40 38474 → 135 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
   13 0.378715797   host ip → target ip TCP 40 38474 → 135 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0
   28 2.268681269 target ip → host ip   TCP 52 135 → 38490 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   29 2.268724628   host ip → target ip TCP 40 38490 → 135 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
   30 2.268783378   host ip → target ip TCP 40 38490 → 135 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0
   61 3.272603426 target ip → host ip   TCP 52 21 → 43260 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   62 3.272698420   host ip → target ip TCP 40 43260 → 21 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
   63 3.273334678 target ip → host ip   TCP 52 53 → 58022 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   64 3.273357934   host ip → target ip TCP 40 58022 → 53 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
   65 3.273693028   host ip → target ip TCP 40 43260 → 21 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0
   66 3.274013386   host ip → target ip TCP 40 58022 → 53 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0
   77 3.274796974 target ip → host ip   TCP 52 80 → 49068 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   78 3.274865411   host ip → target ip TCP 40 49068 → 80 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
   79 3.274951087   host ip → target ip TCP 40 49068 → 80 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0
   84 3.387604406 target ip → host ip   TCP 52 3389 → 42396 &#91;SYN, ACK] Seq=0 Ack=1 Win=64000 Len=0 MSS=1288 WS=1 SACK_PERM
   85 3.387628199   host ip → target ip TCP 40 42396 → 3389 &#91;RST] Seq=1 Win=0 Len=0
  150 4.998246831 target ip → host ip   TCP 52 135 → 38502 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
  151 4.998329872   host ip → target ip TCP 40 38502 → 135 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
  152 4.998587904   host ip → target ip TCP 40 38502 → 135 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0
  232 6.277318520 target ip → host ip   TCP 52 3389 → 42398 &#91;SYN, ACK] Seq=0 Ack=1 Win=64000 Len=0 MSS=1288 WS=1 SACK_PERM
  233 6.277337412   host ip → target ip TCP 40 42398 → 3389 &#91;RST] Seq=1 Win=0 Len=0
  235 6.857444881 target ip → host ip   TCP 52 135 → 38504 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
  236 6.857524021   host ip → target ip TCP 40 38504 → 135 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
  237 6.858089282   host ip → target ip TCP 40 38504 → 135 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0

# SYN/ACK（open）で絞ってみる
$ cat sT_result.txt | grep -F "&#91;SYN, ACK]"
   11 0.377319586 target ip → host ip   TCP 52 135 → 38474 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   28 2.268681269 target ip → host ip   TCP 52 135 → 38490 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   61 3.272603426 target ip → host ip   TCP 52 21 → 43260 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   63 3.273334678 target ip → host ip   TCP 52 53 → 58022 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   77 3.274796974 target ip → host ip   TCP 52 80 → 49068 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   84 3.387604406 target ip → host ip   TCP 52 3389 → 42396 &#91;SYN, ACK] Seq=0 Ack=1 Win=64000 Len=0 MSS=1288 WS=1 SACK_PERM
  150 4.998246831 target ip → host ip   TCP 52 135 → 38502 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
  232 6.277318520 target ip → host ip   TCP 52 3389 → 42398 &#91;SYN, ACK] Seq=0 Ack=1 Win=64000 Len=0 MSS=1288 WS=1 SACK_PERM
  235 6.857444881 target ip → host ip   TCP 52 135 → 38504 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM

# openポートの確認
$ cat sT_result.txt | grep -F "&#91;SYN, ACK]" | awk '{print $8}' | sort -n -u
21
53
80
135
3389</code></pre>



<p>SYN/ACK を返しているポートが open と判定されており、nmap のスキャン結果と tshark のログが一致していることが確認できた。</p>



<p>最後に、awk を使って TCP ハンドシェイク（SYN → SYN/ACK → ACK）が実際に成立しているかを確認してみる。</p>



<pre class="wp-block-code"><code>$ awk '    
  # 行中の「&lt;num> → &lt;num>」を1組だけ抜き出す
  match($0, /&#91;&#91;:space:]](&#91;0-9]+)&#91;&#91;:space:]]*→&#91;&#91;:space:]]*(&#91;0-9]+)&#91;&#91;:space:]]/, m) {
    if (m&#91;1]==21 || m&#91;2]==21) print  
  }      
' sT_result.txt
   52 2.896504834   host ip → target ip TCP 60 43260 → 21 &#91;SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM TSval=245777632 TSecr=0 WS=128
   61 3.272603426 target ip → host ip   TCP 52 21 → 43260 &#91;SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1288 WS=256 SACK_PERM
   62 3.272698420   host ip → target ip TCP 40 43260 → 21 &#91;ACK] Seq=1 Ack=1 Win=64256 Len=0
   65 3.273693028   host ip → target ip TCP 40 43260 → 21 &#91;RST, ACK] Seq=1 Ack=1 Win=64256 Len=0</code></pre>



<p>TCP ハンドシェイクが成立していることが分かる。</p>



<h2 class="wp-block-heading">SYNスキャン（ハーフオープンスキャン）</h2>



<p>使用頻度上位 100 ポートのみ（&#8211;top-ports 100）、スキャン中の詳細を表示（-vv）、pingをスキップ（-Pn）して<br>SYNスキャン（-sS）。</p>



<pre class="wp-block-code"><code>$ sudo nmap -sS --top-ports 100 -vv -Pn target ip</code></pre>



<p>openポートを発見。</p>



<pre class="wp-block-code"><code>Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-26 13:06 JST
Initiating Parallel DNS resolution of 1 host. at 13:06
Completed Parallel DNS resolution of 1 host. at 13:06, 0.00s elapsed
Initiating SYN Stealth Scan at 13:06
Scanning target ip &#91;100 ports]
Discovered open port 80/tcp on target ip
Discovered open port 21/tcp on target ip
Discovered open port 3389/tcp on target ip
Discovered open port 135/tcp on target ip
Discovered open port 53/tcp on target ip
Completed SYN Stealth Scan at 13:06, 6.14s elapsed (100 total ports)
Nmap scan report for target ip
Host is up, received user-set (0.34s latency).
Scanned at 2025-10-26 13:06:36 JST for 7s
Not shown: 95 filtered tcp ports (no-response)
PORT     STATE SERVICE       REASON
<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-swl-deep-01-color">21/tcp   open  ftp           syn-ack ttl 124
53/tcp   open  domain        syn-ack ttl 124
80/tcp   open  http          syn-ack ttl 124
135/tcp  open  msrpc         syn-ack ttl 124
3389/tcp open  ms-wbt-server syn-ack ttl 124</mark></strong>

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 6.20 seconds
           Raw packets sent: 197 (8.668KB) | Rcvd: 7 (308B)</code></pre>



<p>今度は pcap でログを取ってみる。</p>



<pre class="wp-block-code"><code>$ sudo tshark -i tun0 -w /tmp/Ss_result.pcap                                 
Running as user "root" and group "root". This could be dangerous.
Capturing on 'tun0'
211 ^C</code></pre>



<pre class="wp-block-code"><code># tshark で全体のログを確認
$ sudo tshark -r Ss_result.pcap                     
Running as user "root" and group "root". This could be dangerous.
    1 0.000000000   host ip → target ip TCP 44 63626 → 993 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    2 0.000010601   host ip → target ip TCP 44 63626 → 445 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    3 0.000011875   host ip → target ip TCP 44 63626 → 110 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    4 0.000012902   host ip → target ip TCP 44 63626 → 23 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    5 0.000013856   host ip → target ip TCP 44 63626 → 111 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    6 0.000014615   host ip → target ip TCP 44 63626 → 80 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    7 0.000015329   host ip → target ip TCP 44 63626 → 3389 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    8 0.000016047   host ip → target ip TCP 44 63626 → 113 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
    9 0.000016757   host ip → target ip TCP 44 63626 → 21 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
   10 0.000017461   host ip → target ip TCP 44 63626 → 587 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
   11 0.338039856 target ip → host ip   TCP 44 80 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   12 0.338076236   host ip → target ip TCP 40 63626 → 80 &#91;RST] Seq=1 Win=0 Len=0
   13 0.338747181 target ip → host ip   TCP 44 21 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   14 0.338809373   host ip → target ip TCP 40 63626 → 21 &#91;RST] Seq=1 Win=0 Len=0
   15 0.339557912 target ip → host ip   TCP 44 3389 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64000 Len=0 MSS=1288
   16 0.339571791   host ip → target ip TCP 40 63626 → 3389 &#91;RST] Seq=1 Win=0 Len=0
(省略)</code></pre>



<p>ログを絞って確認。</p>



<pre class="wp-block-code"><code># SYN 以外のログで絞ってみる
$ sudo tshark -r sS_result.pcap -Y "not (tcp.flags.syn==1 &amp;&amp; tcp.flags.ack==0)"
Running as user "root" and group "root". This could be dangerous.
   11 0.338039856 target ip8 → host ip   TCP 44 80 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   12 0.338076236   host ip → target ip8 TCP 40 63626 → 80 &#91;RST] Seq=1 Win=0 Len=0
   13 0.338747181 target ip8 → host ip   TCP 44 21 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   14 0.338809373   host ip → target ip8 TCP 40 63626 → 21 &#91;RST] Seq=1 Win=0 Len=0
   15 0.339557912 target ip8 → host ip   TCP 44 3389 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64000 Len=0 MSS=1288
   16 0.339571791   host ip → target ip8 TCP 40 63626 → 3389 &#91;RST] Seq=1 Win=0 Len=0
   23 0.677269837 target ip8 → host ip   TCP 44 135 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   24 0.677332313   host ip → target ip8 TCP 40 63626 → 135 &#91;RST] Seq=1 Win=0 Len=0
   55 3.165016037 target ip8 → host ip   TCP 44 53 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   56 3.165076706   host ip → target ip8 TCP 40 63626 → 53 &#91;RST] Seq=1 Win=0 Len=0
   57 3.165703655 target ip8 → host ip   TCP 44 80 → 63631 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   58 3.165753573   host ip → target ip8 TCP 40 63631 → 80 &#91;RST] Seq=1 Win=0 Len=0
  173 4.863356730 target ip8 → host ip   TCP 44 80 → 63633 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
  174 4.863426175   host ip → target ip8 TCP 40 63633 → 80 &#91;RST] Seq=1 Win=0 Len=0

# SYN/ACK（open）で絞ってみる
$ sudo tshark -r sS_result.pcap -Y "tcp.flags.syn==1 &amp;&amp; tcp.flags.ack==1"
Running as user "root" and group "root". This could be dangerous.
   11 0.338039856 target ip8 → host ip   TCP 44 80 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   13 0.338747181 target ip8 → host ip   TCP 44 21 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   15 0.339557912 target ip8 → host ip   TCP 44 3389 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64000 Len=0 MSS=1288
   23 0.677269837 target ip8 → host ip   TCP 44 135 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   55 3.165016037 target ip8 → host ip   TCP 44 53 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   57 3.165703655 target ip8 → host ip   TCP 44 80 → 63631 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
  173 4.863356730 target ip8 → host ip   TCP 44 80 → 63633 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288

# openポートの確認
$ sudo tshark -r sS_result.pcap -Y "tcp.flags.syn==1 &amp;&amp; tcp.flags.ack==1" -T fields -e tcp.srcport | sort -n -u
Running as user "root" and group "root". This could be dangerous.
21
53
80
135
3389</code></pre>



<p>SYN/ACK を返しているポートが open になっているので、nmap の結果と tshark のログは一致している。</p>



<p>ハーフオープンスキャン（SYN→SYN/ACK→RST）を本当にしているか確認してみる。</p>



<pre class="wp-block-code"><code>$ sudo tshark -r sS_result.pcap -Y "tcp.port == 21"                            
Running as user "root" and group "root". This could be dangerous.
    9 0.000016757   host ip → target ip TCP 44 63626 → 21 &#91;SYN] Seq=0 Win=1024 Len=0 MSS=1460
   13 0.338747181 target ip → host ip   TCP 44 21 → 63626 &#91;SYN, ACK] Seq=0 Ack=1 Win=64400 Len=0 MSS=1288
   14 0.338809373   host ip → target ip TCP 40 63626 → 21 &#91;RST] Seq=1 Win=0 Len=0</code></pre>



<p>SYN/ACK に対して RST で切断しているため、ハーフオープンスキャンの挙動。</p>



<h2 class="wp-block-heading">UDPスキャン</h2>



<p>使用頻度上位 100 ポートのみ（&#8211;top-ports 100）、スキャン中の詳細を表示（-vv）、pingをスキップ（-Pn）して<br>UDPスキャン（-sU）。</p>



<pre class="wp-block-code"><code>$ sudo nmap -sU --top-ports 100 -vv -Pn target ip</code></pre>



<p>openポートを発見。</p>



<pre class="wp-block-code"><code>Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-26 14:03 JST
Initiating Parallel DNS resolution of 1 host. at 14:03
Completed Parallel DNS resolution of 1 host. at 14:03, 0.00s elapsed
Initiating UDP Scan at 14:03
Scanning target ip &#91;100 ports]
Discovered open port 53/udp on target ip
Completed UDP Scan at 14:03, 12.09s elapsed (100 total ports)
Nmap scan report for target ip
Host is up, received user-set (0.36s latency).
Scanned at 2025-10-26 14:03:17 JST for 11s
Not shown: 99 open|filtered udp ports (no-response)
PORT   STATE SERVICE REASON
<strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-swl-deep-01-color">53/udp open  domain  udp-response ttl 124</mark></strong>

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 12.15 seconds
           Raw packets sent: 261 (16.044KB) | Rcvd: 4 (262B)</code></pre>



<p>pcap でログを取ってみる。</p>



<pre class="wp-block-code"><code>$ sudo tshark -i tun0 -w /tmp/sU_result.pcap                                            
Running as user "root" and group "root". This could be dangerous.
Capturing on 'tun0'
273 ^C</code></pre>



<p>今回は Wireshar でログを確認してみる。</p>



<pre class="wp-block-code"><code>$ sudo wireshark sU_result.pcap  </code></pre>



<p>ip.src == target ip で応答のあったものだけ絞る。</p>



<pre class="wp-block-code"><code>ip.src == target ip &amp;&amp; not icmp</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="85" src="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark-1024x85.png" alt="Wireshark UDPスキャンの画像" class="wp-image-548" srcset="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark-1024x85.png 1024w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark-300x25.png 300w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark-768x64.png 768w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark-1536x128.png 1536w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark.png 1564w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>DNS のみ表示されたので、nmap の結果と一致。<br></p>



<h2 class="wp-block-heading">特殊スキャン（NULL／FIN／Xmas）</h2>



<p>検証環境でopenポートが見つからなかったので、今回はフラグだけ確認。</p>



<h3 class="wp-block-heading">NULLスキャン</h3>



<pre class="wp-block-code"><code># NULLスキャン
$ sudo nmap -sN --top-ports 100 -vv -Pn target ip

Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-26 14:57 JST
Initiating Parallel DNS resolution of 1 host. at 14:57
Completed Parallel DNS resolution of 1 host. at 14:57, 0.00s elapsed
Initiating NULL Scan at 14:57
Scanning target ip &#91;100 ports]
Completed NULL Scan at 14:57, 21.11s elapsed (100 total ports)
Nmap scan report for target ip
Host is up, received user-set.
Scanned at 2025-10-26 14:57:12 JST for 22s
All 100 scanned ports on target ip are in ignored states.
Not shown: 100 open|filtered tcp ports (no-response)

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 21.15 seconds
           Raw packets sent: 200 (8.000KB) | Rcvd: 0 (0B)</code></pre>



<p>フラグはすべて0。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="502" height="204" src="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_NULL.png" alt="Wireshark NULLスキャンのフラグ画像" class="wp-image-550" srcset="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_NULL.png 502w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_NULL-300x122.png 300w" sizes="(max-width: 502px) 100vw, 502px" /></figure>



<h3 class="wp-block-heading">FINスキャン</h3>



<pre class="wp-block-code"><code># FINスキャン
$ sudo nmap -sF --top-ports 100 -vv -Pn target ip

Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-26 14:52 JST
Initiating Parallel DNS resolution of 1 host. at 14:52
Completed Parallel DNS resolution of 1 host. at 14:52, 0.00s elapsed
Initiating FIN Scan at 14:52
Scanning target ip &#91;100 ports]
Completed FIN Scan at 14:52, 21.09s elapsed (100 total ports)
Nmap scan report for target ip
Host is up, received user-set.
Scanned at 2025-10-26 14:52:08 JST for 21s
All 100 scanned ports on target ip are in ignored states.
Not shown: 100 open|filtered tcp ports (no-response)

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 21.18 seconds
           Raw packets sent: 200 (8.000KB) | Rcvd: 0 (0B)</code></pre>



<p>FIN = 1。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="510" height="193" src="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_FIN.png" alt="Wireshark FINスキャンのフラグ画像" class="wp-image-551" srcset="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_FIN.png 510w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_FIN-300x114.png 300w" sizes="(max-width: 510px) 100vw, 510px" /></figure>



<h3 class="wp-block-heading">Xmasスキャン</h3>



<pre class="wp-block-code"><code># Xmasスキャン
$ sudo nmap -sX --top-ports 100 -vv -Pn target ip

Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times may be slower.
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-26 14:52 JST
Initiating Parallel DNS resolution of 1 host. at 14:52
Completed Parallel DNS resolution of 1 host. at 14:52, 0.01s elapsed
Initiating XMAS Scan at 14:52
Scanning target ip &#91;100 ports]
Completed XMAS Scan at 14:53, 21.09s elapsed (100 total ports)
Nmap scan report for target ip
Host is up, received user-set.
Scanned at 2025-10-26 14:52:53 JST for 21s
All 100 scanned ports on target ip are in ignored states.
Not shown: 100 open|filtered tcp ports (no-response)

Read data files from: /usr/share/nmap
Nmap done: 1 IP address (1 host up) scanned in 21.16 seconds
           Raw packets sent: 200 (8.000KB) | Rcvd: 0 (0B)</code></pre>



<p>FIN = 1、PSH = 1、URG = 1。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="558" height="206" src="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_Xmas.png" alt="Wireshark Xmasスキャンのフラグ画像" class="wp-image-552" srcset="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_Xmas.png 558w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_Xmas-300x111.png 300w" sizes="(max-width: 558px) 100vw, 558px" /></figure>



<h2 class="wp-block-heading">おまけ</h2>



<p>UDPスキャンでホストIPとターゲットIP以外に 239.255.255.250（SSDP<sup data-fn="674d942b-b510-49bd-81d1-861c1e2af7cc" class="fn"><a href="#674d942b-b510-49bd-81d1-861c1e2af7cc" id="674d942b-b510-49bd-81d1-861c1e2af7cc-link">1</a></sup>用マルチキャストアドレス）への通信を発見。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="870" height="69" src="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_SSDP.png" alt="Wireshark 239.255.255.250充ての画像" class="wp-image-554" srcset="https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_SSDP.png 870w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_SSDP-300x24.png 300w, https://cybermemo.blog/wp-content/uploads/2025/10/Wireshark_SSDP-768x61.png 768w" sizes="(max-width: 870px) 100vw, 870px" /></figure>



<p>nmapはスキャン中に「このネットワーク内にUPnP<sup data-fn="01fd85ef-44fd-43bb-bb2c-5c1cd3b01ee1" class="fn"><a href="#01fd85ef-44fd-43bb-bb2c-5c1cd3b01ee1" id="01fd85ef-44fd-43bb-bb2c-5c1cd3b01ee1-link">2</a></sup>デバイスがいるか？」を自動的にチェックすることがあり、その時にこの宛先へ M-SEARCH * HTTP/1.1 パケットを送信するそう。</p>


<ol class="wp-block-footnotes"><li id="674d942b-b510-49bd-81d1-861c1e2af7cc">家庭内ネットワークなどで機器同士が自動的に見つけ合うための通信プロトコル。UPnPの一部として定義されており、主にUDPの1900番ポートを使う。 <a href="#674d942b-b510-49bd-81d1-861c1e2af7cc-link" aria-label="脚注参照1にジャンプ">↩︎</a></li><li id="01fd85ef-44fd-43bb-bb2c-5c1cd3b01ee1">Universal Plug and Play。家庭やオフィス内のネットワーク機器が自動的に見つけ合い、設定なしで通信できるようにする仕組み。 <a href="#01fd85ef-44fd-43bb-bb2c-5c1cd3b01ee1-link" aria-label="脚注参照2にジャンプ">↩︎</a></li></ol>]]></content:encoded>
					
					<wfw:commentRss>https://cybermemo.blog/nmap-port-scan/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
