小目次

目次にもどる
ープログラム
ー実行結果

課題5:ポートスキャンの実験

自分の実験環境(端末)の使用/未使用ポート(ウェルノウンポートのみでok)を確認するポートスキャンプログラムを作成せよ。さらに、任意のリモート端末の使用/未使用ポートを確認するように改良せよ(加点ポイント)。なお、スクリプトを使って内部で'netstat -l'コマンドを実行し、その結果を利用するのは不可とする(ソケットプログラムを作成すること)。
(注意) リモート端末へのポートスキャンは、重要なサーバに対しては決して行わないこと!。


プログラム

scan_port.cのソースコード(別ウィンドウ)
使われている関数については関数メモを参照
上にもどる
目次にもどる

実行結果

ローカルホストに実行(127.0.0.1)

%scan_port 127.0.0.1
Address = "127.0.0.1" Portscan started..
Port no.   22 is open
Port no.  139 is open
Port no.  427 is open
Port no.  445 is open
Port no.  548 is open
Port no.  631 is open
Portscan find them.

リモート端末に実行(自宅のルータ)

%./scan_port 192.168.1.1
Address = "192.168.1.1" Portscan started..
Port no.   80 is open
Port no.  515 is open
Portscan find them.

未使用ポートの表示(a オプション)

%./scan_port 127.0.0.1 a
(前略)
Port no. 9224 is closed
Port no. 9234 is closed
Port no. 9244 is closed
Port no. 9254 is closed
Port no. 9264 is closed
Port no. 9274 is closed
Port no. 9284 is closed
Port no. 9294 is closed
(後略)
上にもどる
目次にもどる