Build your own pcap for python2.6

Source: Internet
Author: User

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
>>>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.