WinPcapを試す
id:Hossy:20051130で知ったWinPcapを試してみました。
WinPcap, The Packet Capture and Network Monitoring Library for Windows
http://www.winpcap.org/
インストール
WinPcapはネットワーク系のアプリケーションでよく利用されているのでドライバ・DLLと開発用パックの2つが配布されています。
- WinPcap auto-installer (driver +DLLs)
- インストーラの指示に従いインストール
- Developer's pack
- ヘッダやlibファイル、aファイルなど。適当な場所に展開。
今回は開発を行うので両方インストールします。
cygwin でサンプルプログラムを試す
WinPcap: Obtaining the device listで紹介されている、サンプルプログラムをcygwinでビルドします。
こんな感じでビルド。
gcc main.c -I . -L../Lib/ -lwpcap
実行結果。デバイスリストが出力されます。
1. \Device\NPF_GenericDialupAdapter (Generic dialup adapter) 2. \Device\NPF_{} (11a/b/g Wireless LAN Mini PCI Adapter II (Microsoft's Packet Scheduler) ) 3. \Device\NPF_{} (TAP-Win32 Adapter V8 (coLinux) (Microsoft's Packet Scheduler) ) 4. \Device\NPF_{} (Intel(R) PRO/1000 MT Mobile Connection (Microsoft's Packet Scheduler) )
たぶん続きます。
追記
WinPcapの開発キットについてくる、basic_dumpを試してみたが
coLinuxで使っている、Tap-Win32アダプタは、パケットダンプできる
無線LANアダプタはずっと listen 状態のままとまるという感じ。
環境は
Windows XP SP2, WinPcap 3.0/3.1, WindowsファイアーウォールON/OFF両方試した。
アダプタはこんな感じ
\basic_dump>ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : xxxx Primary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : setup Ethernet adapter ワイヤレス ネットワーク接続: Connection-specific DNS Suffix . : setup Description . . . . . . . . . . . : 11a/b/g Wireless LAN Mini PCI Ad r II Physical Address. . . . . . . . . : xxxx Dhcp Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IP Address. . . . . . . . . . . . : 192.168.11.2 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.11.1 DHCP Server . . . . . . . . . . . : 192.168.11.1 DNS Servers . . . . . . . . . . . : 192.168.11.1 Lease Obtained. . . . . . . . . . : 2005年12月7日 0:09:37 Lease Expires . . . . . . . . . . : 2005年12月9日 0:09:37 Ethernet adapter ローカル エリア接続: Media State . . . . . . . . . . . : Media disconnected Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Mobile Conn on Physical Address. . . . . . . . . : xxxx Ethernet adapter ローカル エリア接続 5: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : TAP-Win32 Adapter V8 (coLinux) Physical Address. . . . . . . . . : xxxxxx Dhcp Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.168.100.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . :
TAPが干渉している気がしなくもないんだよなぁ。どうだろうか・・・
マスタリングTCP/IP 入門編
posted with amazlet on 06.04.30