やりたいこと
ネットワーク環境調査アプリ「Fing」のバイナリを取得し、手元のfedora 24 Serverで動作するようにしたい。
Fingは、ローカルネットワークを走査し、リンクアップしている機器のIPアドレス・MACアドレス・動作中のサービス情報を収集してくれるアプリ。
その他にもPingやWake on Lanのパケット送出が可能。
加えて、スマートフォン版であれば、スキャン結果をクラウド同期することも可能のようだ。
nmapのお手軽版のような感じ。
fing 本家 (イタリア?)
https://www.fing.io/
動作確認環境、使用ライブラリ等
- Fedora 24 (Server Edition) 64bit
- overlook fing 3.0
インストール
RPMパッケージも提供されているが、インストールする際に「filesystem」と競合するため
バイナリを直接コピーする方法でいく。
- ダウンロードページにて「Linux 64bit TGZ」のダウンロードリンクからファイルをゲットする。
- ZIP圧縮されているので、unzipする。
- tarballを解凍する。
- "usr"ディレクトリを/にコピーし、インストールを完了する。
- コマンドが使用できるか確認する。
# wget (fullpath)/overlook-fing-3.0.tgz_.zip
# unzip overlook-fing-3.0.tgz_.zip
Archive: overlook-fing-3.0.tgz_.zip
inflating: overlook-fing-3.0.tgz
creating: __MACOSX/
inflating: __MACOSX/._overlook-fing-3.0.tgz
# tar xfz overlook-fing-3.0.tgz
# ll
-rw-r-----. 1 root root 6829068 10月 24 20:09 overlook-fing-3.0.tgz
drwxr-xr-x. 4 root root 30 11月 1 2015 usr
# cp -R usr/ /
# fing -v
3.0
#
使い方
# fing --help
=== overlook fing 3.0 - www.overlooksoft.com ===
Command line options:
-h [ --help ] show this help message
-v [ --version ] show fing version
-i [ --info ] show network informations
-n [ --netdiscover ] arg run network discovery
-s [ --servicescan ] arg run service scan on host/network
-o [ --output ] arg use output setup for discovery/scan/ping
-P [ --profile ] arg use specific discovery/scan/ping profile
-d [ --rdns ] arg enable/disable reverse DNS lookups
-r [ --rounds ] arg number of rounds (network discovery)
--session arg use specific discovery session file
--silent force to silent mode
--interactive start the interactive mode
-p [ --ping ] arg run icmp ping on the hosts
--sentinel run Fingbox Sentinel
-w [ --wol ] arg send wake on lan on targets
引数なしで実行した場合は、自身のネットワークのディスカバリーが走る。
動作テスト
ネットワークディスカバリー
# fing -n 192.168.XXX.0/24 -r 1
20:29:11 > Discovery profile: Default discovery profile
20:29:11 > Discovery class: data-link (data-link layer)
20:29:11 > Discovery on: 192.168.XXX.XXX/24
20:29:11 > Discovery round starting.
20:29:11 > Host is up: 192.168.XXX.XXX
HW Address: 00:15:5D:XX:XX:XX (Microsoft)
Hostname: localhost.localdomain
(中略)
20:29:11 > Discovery progress 25%
(中略)
20:29:12 > Host is up: 192.168.XXX.XXX
HW Address: B0:C7:45:XX:XX:XX
20:29:13 > Discovery progress 50%
20:29:13 > Discovery progress 75%
-------------------------------------------------------------------------------
| State | Host | MAC Address | Last change |
|-----------------------------------------------------------------------------|
| UP | 192.168.1.XXX | 34:76:C5:XX:XX:XX | |
| UP | 192.168.1.XXX | E0:46:9A:XX:XX:XX | |
| UP | 192.168.1.XXX | 00:15:5D:XX:XX:XX | |
| UP | 192.168.1.XXX | B0:C7:45:XX:XX:XX | |
-------------------------------------------------------------------------------
20:29:15 > Discovery round completed in 4.747 seconds.
20:29:15 > Network 192.168.1.XXX/24 has 4/4 hosts up.
サービススキャン
# fing -s 192.168.1.XXX
21:19:45 > Service scan on: 192.168.1.XXX
21:19:45 > Service scan starting.
21:19:45 > Detected MAC address: E0:46:9A:XX:XX:XX
21:19:45 > Detected service: 80 (http)
21:19:45 > Detected service: 111 (rpcbind)
21:19:45 > Detected service: 139 (netbios-ssn)
21:19:45 > Detected service: 443 (https)
21:19:45 > Detected service: 445 (microsoft-ds)
21:19:45 > Detected service: 631 (ipp)
21:19:45 > Detected service: 5050 (mmcc)
21:19:45 > Service scan completed in 0.197 seconds.
-------------------------------------------------------------------------------
| Scan result for 192.168.1.XXX (E0:46:9A:XX:XX:XX) |
|-----------------------------------------------------------------------------|
| Port | Service | Description |
|-----------------------------------------------------------------------------|
| 80 | http | World Wide Web HTTP |
| 111 | rpcbind | portmapper, rpcbind |
| 139 | netbios-ssn | NETBIOS Session Service |
| 443 | https | Secure World Wide Web HTTP (SSL) |
| 445 | microsoft-ds | SMB directly over IP |
| 631 | ipp | Internet Printing Protocol -- for one implementat |
| 5050 | mmcc | multimedia conference control tool |
-------------------------------------------------------------------------------
Wake On Lan
# fing -w E0:46:9A:XX:XX:XX
21:22:57 > Sending Wake On Lan to: E0:46:9A:XX:XX:XX via 192.168.1.255:9
所感
きれいに整形して出力してくれるので、可読性は高い。
--output スイッチで出力形式をいろいろ選べる(plaintext, csv, xml, html, json, etc.)ので
整形する手間が省け、他のプログラムとの連携もしやすい。
ネットワーク周りを触るため、一般ユーザはsudoしないと実行できない。
fingはNOPASSWORDでsudoできるようにすると便利かも。
ただライセンス的にどうなんだ?というのはある。
個人で遊ぶ分には問題ないとは思うけど。。。