Ubuntu 22.04 LTSにポートスキャンツール「Nmap」をインストールする
環境
OSバージョンを確認します
# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"
操作方法
1.システムパッケージのアップデートを行います
# sudo apt update && sudo apt upgrade -y
2.nmapをインストールします
# sudo apt install nmap -y
3.バージョンを確認します
# nmap --version Nmap version 7.80 ( https://nmap.org ) Platform: x86_64-pc-linux-gnu Compiled with: liblua-5.3.6 openssl-3.0.0 nmap-libssh2-1.8.2 libz-1.2.11 libpcre-8.39 libpcap-1.10.1 nmap-libdnet-1.12 ipv6 Compiled without: Available nsock engines: epoll poll select
4.使い方
書式
nmap [IP address] or [website address]
操作例
# nmap localhost Starting Nmap 7.80 ( https://nmap.org ) at 2022-10-22 08:27 JST Nmap scan report for localhost (127.0.0.1) Host is up (0.000025s latency). Not shown: 988 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 111/tcp open rpcbind 631/tcp open ipp 2049/tcp open nfs 5000/tcp open upnp 7800/tcp open asr 8000/tcp open http-alt 8080/tcp open http-proxy 9000/tcp open cslistener 9009/tcp open pichat 10000/tcp open snet-sensor-mgmt Nmap done: 1 IP address (1 host up) scanned in 0.45 seconds
5.helpコマンドの確認
# nmap --help Nmap 7.80 ( https://nmap.org ) Usage: nmap [Scan Type(s)] [Options] {target specification} TARGET SPECIFICATION: Can pass hostnames, IP addresses, networks, etc. Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254 -iL <inputfilename>: Input from list of hosts/networks -iR <num hosts>: Choose random targets --exclude <host1[,host2][,host3],...>: Exclude hosts/networks --excludefile <exclude_file>: Exclude list from file HOST DISCOVERY: -sL: List Scan - simply list targets to scan -sn: Ping Scan - disable port scan -Pn: Treat all hosts as online -- skip host discovery -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes -PO[protocol list]: IP Protocol Ping -n/-R: Never do DNS resolution/Always resolve [default: sometimes] --dns-servers <serv1[,serv2],...>: Specify custom DNS servers --system-dns: Use OS's DNS resolver --traceroute: Trace hop path to each host SCAN TECHNIQUES: -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans -sU: UDP Scan -sN/sF/sX: TCP Null, FIN, and Xmas scans --scanflags <flags>: Customize TCP scan flags -sI <zombie host[:probeport]>: Idle scan -sY/sZ: SCTP INIT/COOKIE-ECHO scans -sO: IP protocol scan -b <FTP relay host>: FTP bounce scan 略