Today I tried to compile & install excellent libpcap python extension "pcapy" on my Windows XP note pc. - Pcapy .:: CORE SECURITY TECHNOLOGIES ::. -- http://oss.coresecurity.com/projects/pcapy.html Pcapy official page serves exe installer for Python 2.5, WinPcap 4.0.x. I'm using Python 2.5, but unfortunately, WinPcap-4.1.2 was installed on my note pc. Hmm... it's time to download pcapy source code, compile, build, and install it. My NotePC Environments: OS : Windows XP SP3 Japanese CPU : Intel PentiumM (Centrino) 1.2GHz RAM : 1GB Python : Python 2.5 (installed from MSI installer) Install Directory : C:\Python25 Requirements for this article, compiling pcapy: Microsoft Visual Studio, C++ MyVersion : Visual C++ 2008 Express Edition SP1 #more|| ---- * obtaining WinPcap headers and libraries 1st, you must download WinPcap runtime installer, and install it. - WinPcap runtime installer for Windows: -- http://www.winpcap.org/install/default.htm 2nd, downlaod WinPcap Developer Resources (.zip archive), and extract it to your favorite directory. - WinPcap Developer Resources -- http://www.winpcap.org/devel.htm (these url links are valid at 2010-11-2, and may be changed at future) I expaneded it to "C:\work\misc\WpdPack_4_1_2". C:\work\WpdPack_4_1_2\ Include\ Lib\ ... * get pcapy source code, and build it !! Download pcapy-0.10.5 source code from pcapy homepage, and expand it. I expanded it to "C:\work\misc\pcapy-0.10.5". C:\work\misc\pcapy-0.10.5\ setup.py README ... Open command prompt, setup Visual C++ Envorinment (ex: vcvars32.bat), and add following environments. set DISTUTILS_USE_SDK=1 set MSSdk=1 If you've not read [[13]] , read it and modify "distutils\msvccompiler.py" in your Python Library tree. Let's setup.py, with "--include-dir" and "--library-dirs" options: > cd C:\work\misc\pcapy-0.10.5 > setup.py build_ext \ --include-dirs C:\work\misc\WpdPack_4_1_2\Include \ --library-dirs C:\work\misc\WpdPack_4_1_2\Lib (compiling...) If compile success, "build\lib.win32-2.5\pcapy.pyd" should be created. Check dependents: > dumpbin /dependents C:\work\misc\pcapy-0.10.5\build\lib.win32-2.5\pcapy.pyd ... File Type: DLL Image has the following dependencies: wpcap.dll WS2_32.dll python25.dll KERNEL32.dll Dependency seems good. Then, try to install: #pre||> > setup.py install running install running build running build_ext running install_lib copying build\lib.win32-2.5\pcapy.pyd -> C:\Python25\Lib\site-packages running install_data creating C:\Python25\share creating C:\Python25\share\doc creating C:\Python25\share\doc\pcapy copying README -> C:\Python25\share\doc\pcapy copying LICENSE -> C:\Python25\share\doc\pcapy copying pcapy.html -> C:\Python25\share\doc\pcapy running install_egg_info Writing C:\Python25\Lib\site-packages\pcapy-0.10.5-py2.5.egg-info ||< import checks: #pre||> > C:\Python25\python.exe Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import pcapy >>> help(pcapy) Help on module pcapy: NAME pcapy - A wrapper for the Packet Capture (PCAP) library FILE c:\python25\lib\site-packages\pcapy.pyd CLASSES exceptions.Exception(exceptions.BaseException) PcapError class PcapError(exceptions.Exception) | Method resolution order: ... ||< All-Right!! Now we can use WinPcap through Python. Enjoy!!