2026年7月14日 星期二

nmap 使用筆記

https://nmap.org/

公司實驗室的機器 IP有時候飄來飄去,這時候就可以靠 nmap來找到需要的機器。


掃描指定機器的常用埠

nmap 192.168.1.10
Starting Nmap 7.95 ( https://nmap.org ) at 2026-07-14 17:52 CST Nmap scan report for renegade-ThinkPad-L13 (192.168.1.10) Host is up (0.000069s latency). Not shown: 998 closed tcp ports (conn-refused) PORT STATE SERVICE 22/tcp open ssh 3389/tcp open ms-wbt-server Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds


掃描子網路 (192.168.1.0 to 192.168.1.255)

nmap 192.168.1.0/24


掃描指定的埠

nmap -p 22 192.168.1.10
Starting Nmap 7.95 ( https://nmap.org ) at 2026-07-14 17:53 CST Nmap scan report for renegade-ThinkPad-L13 (192.168.1.10) Host is up (0.000052s latency). PORT STATE SERVICE 22/tcp open ssh Nmap done: 1 IP address (1 host up) scanned in 0.03 seconds


偵測每個埠上運行的服務

nmap -sV 192.168.1.10
Nmap scan report for renegade-ThinkPad-L13 (192.168.1.10) Host is up (0.000069s latency). Not shown: 998 closed tcp ports (conn-refused) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 10.0p2 Ubuntu 5ubuntu5.4 (Ubuntu Linux; protocol 2.0) 3389/tcp open ms-wbt-server Microsoft Terminal Service Service Info: OSs: Linux, Windows; CPE: cpe:/o:linux:linux_kernel, cpe:/o:microsoft:windows Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 11.24 seconds


掃描子網路下所有 port 22的狀態為 open的機器

nmap -p 22 -T4 --open -oG - 192.168.1.10
# Nmap 7.95 scan initiated Tue Jul 14 18:16:59 2026 as: nmap -p 22 -T4 -oG - 192.168.1.0/24 Host: 172.31.97.112 (renegade-ThinkPad-L13) Status: Up Host: 172.31.97.112 (renegade-ThinkPad-L13) Ports: 22/open/tcp//ssh/// # Nmap done at Tue Jul 14 18:16:59 2026 -- 1 IP address (1 host up) scanned in 0.03 seconds
  • -T4 加速掃描速度
  • --open 只列出狀態為 open的 port
  • --oG - 輸出grepable的格式到console

沒有留言:

張貼留言