Install pcap and dpkt in Windows

Source: Internet
Author: User

Install pcap

First download http://www.winpcap.org/install/bin/WpdPack_4_0_2.zip
Download pypcap source code package pypcap-1.1, unzip
1) if mingw32 is not installed, download and install a hypothesis to c: \ wingw32.
2) set the environment variable Path = % PATH %; C: \ wingw32 \ bin
3) decompress the downloaded wpdpack (Winpcap development pack) to c: \ wpdpack.
4) enter the pypcap-1.1 extract directory, in turn to execute:

> Python. \ setup. py config -- With-pcap = "C: \ wpdpack"
> Python. \ setup. py build-cmingw32
> Python. \ setup. py install

 

Install dpkt, go to the project homepage, and download the binary installation package for Windows.

Test:

Import pcap
Import dpkt
A = pcap. pcap ()
A. setfilter ('Arp ') # It Can Be Used for filtering by 'tcp', 'udp ', 'port 80', etc.
For I, J in:
TEM = dpkt. Ethernet. Ethernet (j)
Print ("% S % x", I, TEM)

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.