悪用厳禁 nmapでポートスキャン


悪用厳禁 nmapでポートスキャン

ポートスキャンとは

ネットワークを通じてサーバに連続してアクセスし、保安上の弱点(セキュリティホール)を探す行為。e-wordsより

使い方

いいか、絶対悪用するなよ!!
絶対だからな!!

一番シンプルな使い方

$ nmap www.hogehoge.co.jp

Starting Nmap 6.47 ( http://nmap.org ) at 2015-04-23 17:46 JST
Nmap scan report for www.hogehoge.co.jp (xxx.xxx.xxx.xxx)
Host is up (0.030s latency).
Not shown: 998 filtered ports
PORT     STATE SERVICE
80/tcp   open  http
2222/tcp open  EtherNet/IP-1

Nmap done: 1 IP address (1 host up) scanned in 5.70 seconds

80番と2222番が開いているようですね。

もっと詳細なの

-A オプションをつける
ポートで使っているアプリとか色々わかったりするが、ログに記録される可能性あり

$ nmap -A www.hogehoge.co.jp

Starting Nmap 6.47 ( http://nmap.org ) at 2015-04-23 17:50 JST
Nmap scan report for www.hogehoge.co.jp (xxx.xxx.xxx.xxx)
Host is up (0.037s latency).
Not shown: 998 filtered ports
PORT     STATE SERVICE VERSION
80/tcp   open  http    Apache httpd 2.4.7 ((Ubuntu))
|_http-methods: No Allow or Public header in OPTIONS response (status code 200)
| http-robots.txt: 4 disallowed entries
|_/support/h24/ /support/denso/ /support/netsupo/ /*?
|_http-title: \xE9\x9B\xBB\xE5\xAD\x90\xE3\x82\xAB\xE3\x83\xAB\xE3\x83\x86\xE3\x83\xBB\xE4\xBB\x8B\xE8\xAD\xB7\xE3\x82\xBD\xE3\x83\x95\xE3\x83\x88\xE3\x81\xAE\xE9\x96\x8B\xE7\x99\xBA\xE3\x83\xBB\xE8\xB2\xA9\xE5\xA3\xB2 | \xE3\x83\xAF\xE3\x82\xA4\xE3\x82...
2222/tcp open  ssh     (protocol 2.0)
| ssh-hostkey:
|   1024 e4:b0:24:34:87:e7:2d:fc:aa:62:14:18:4c:fa:68:7a (DSA)
|   2048 97:10:a3:1b:f6:72:f7:ed:fc:06:3c:17:9e:dd:80:90 (RSA)
|_  256 7a:ae:51:33:80:df:4e:c4:f5:25:5a:86:3f:7f:12:3b (ECDSA)
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at http://www.insecure.org/cgi-bin/servicefp-submit.cgi :
SF-Port2222-TCP:V=6.47%I=7%D=4/23%Time=5538B254%P=x86_64-apple-darwin14.1.
SF:0%r(NULL,29,"SSH-2\.0-OpenSSH_6\.6\.1p1\x20Ubuntu-2ubuntu2\r\n");

Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 17.81 seconds

各内容解説

STATE 説明
open ポートが開いている
closed ポートが閉じられている
filtered そのポートに対しパケットフィルタが適用されている
unfiltered ポートへのアクセスは可能
open\ filtered
closed\ filtered

pオプション

-pをつけると普通は1-1024までのポートスキャンを別ポートでスキャンできる。

$ nmap xxx.xxx.xxx.xxx -p 1-10

Starting Nmap 6.47 ( http://nmap.org ) at 2015-04-23 18:35 JST
Nmap scan report for www.hogehoe.co.jp (xxx.xxx.xxx.xxx)
Host is up (0.029s latency).
PORT   STATE    SERVICE
1/tcp  filtered tcpmux
2/tcp  filtered compressnet
3/tcp  filtered compressnet
4/tcp  filtered unknown
5/tcp  filtered unknown
6/tcp  filtered unknown
7/tcp  filtered echo
8/tcp  filtered unknown
9/tcp  filtered discard
10/tcp filtered unknown

Nmap done: 1 IP address (1 host up) scanned in 2.70 seconds

最後に

これやると、サーバの方でFWのログに記録されたり、攻撃とみなされてアクセスできなくなる可能性があるのでやたらめったらに撃ちまくらないこと。