Step 1: download the relevant source code
Pycap: http://code.google.com/p/pypcap/
Sendpkt: http://code.google.com/p/sendpkt/
Dpkt: http://code.google.com/p/dpkt/
WDP http://www.winpcap.org/install/bin/WpdPack_4_0_2.zip
Mingw: http://www.mingw.org/
Step 2: Compile
1. decompress the two files in pycap and WDP to the same directory. Note:
2. Create a setup. cfg file in the decompressed pycap folder with the following content:
[Build]
Compiler = mingw32
3. Start Compilation
C: \ Users \ linuxany \ Desktop \ pypcap-1.1> Python setup. PY build
running build
running build_ext
building 'pcap 'extension
creating build \ Temp. win32-2.6
creating build \ temp. win32-2.6 \ release
D: \ mingw \ bin \ gcc.exe-MnO-cygwin-mdll-o-wall-I .. \ wpdpack \ include-ID: \ Python \ python2.6 \ include-ID: \ Python \ python2.6 \ PC-C pcapc-o build \ Temp. win32-2.6 \ release \ pcap. o-dwin32-dwpcap
writing build \ temp. win32-2.6 \ release \ pcap. def
creating build \ Lib. win32-2.6
D: \ mingw \ bin \ gcc.exe-MnO-cygwin-shared-s build \ Temp. win32-2.6 \ retries \ pcap. o build \ temp. win32-2.6 \ release \ pcap_ex.o build \ temp. win32-2.6 \ release \ pcap. def-l .. \ wpdpack \ Lib-ld: \ Python \ python2.6 \ libs-ld: \ pythoh \ python2.6 \ pcbuild-lwpcap-liphlpapi-lpython26-lmsvcr90-o build \ Lib. win32-2.6 \ pcap. PYD
C: \ Users \ linuxany \ Desktop \ pypcap-1.1>Python setup. py install
4. Install sendpkt in the same way
Step 3: test whether the compilation and installation are successful
C: \ Users \ linuxany> Python
Python 2.6 (R26: 66721, Oct 2 2008, 11:35:03)
>>> Import pcap, sendpkt, dpkt
>>>