Libnet for Win32

Source: Internet
Author: User
Tags unpack windows x86

Http://mathieu.carbou.free.fr/wiki/index.php? Title = how_to_compile_libnet_under_cygwin


Contents

[Hide]

  • 1 resources
  • 2 using
    Cygwin (but I highly suggest to use mingw)

    • 2.1 Requirements
    • 2.2 compiling
      Libnet 1.1.2.1
    • 2.3 compiling
      Libnet 1.1.3
  • 3 using
    Mingw

    • 3.1 requirements
    • 3.2 Libnet
      1.1.2.1

      • 3.2.1 Binaries
      • 3.2.2 compiling
    • 3.3 Libnet
      1.1.3

      • 3.3.1 Binaries
      • 3.3.2 compiling

[Edit]

Resources
  • Libnet Official Website
[Edit]

Using cygwin (but I highly suggest to use mingw)

It compiles and link with the examples, and I also manage to use it for the arping port.

[Edit]

Requirements

First you need to setup Winpcap on cygwin. This can be easily done using this article: How
To install Winpcap/Libpcap under cygwin

Then you will have to download the version you want of Libnet

[Edit]

Compiling Libnet 1.1.2.1

You need this patch
Compile Libnet under cygwin. See readme file for more details.

You can also download compiled
Binaries.

[Edit]

Compiling Libnet 1.1.3

You need this patch
Compile Libnet under cygwin. See readme file for more details.

You can also download compiled
Binaries.

For example, here is my cygwin
Console output used to apply this patch and compile Libnet.

To compile a sample or a file alone (for example synflood. C [show]), I used:

gcc -g -Wall -mno-cygwin -DNO_SNPRINTF -D_LIBNETCYGWIN -I /usr/include/pcap -I /usr/include/libnet/win32 -c synflood.cgcc -g -Wall -mno-cygwin -o synflood.exe synflood.o -lnet -lwpcap -lpacket -lws2_32 -liphlpapi

!!! Warning !!!

Make install copies to/usr/include/the Win32 folder... you must move it into/usr/include/Libnet folder.

/usr/include/libnet¦   libnet-asn1.h¦   libnet-functions.h¦   libnet-headers.h¦   libnet-macros.h¦   libnet-structures.h¦   libnet-types.h¦+---win32        getopt.h        in_systm.h        libnet.h

Also, you can remove the-dno_snprintf in the compilation line for recent version of cygwin/mingw. Edit/usr/bin/Libnet-config and remove it here:

libnet_defines="-D_LIBNETCYGWIN"libnet_cflags="-mno-cygwin -I/usr/include/pcap -I /usr/include/libnet/win32"libnet_libs="-lws2_32 -liphlpapi -lnet"

The compilation line becomes:

gcc -g -Wall -mno-cygwin -D_LIBNETCYGWIN -I /usr/include/pcap -I /usr/include/libnet/win32 -c synflood.cgcc -g -Wall -mno-cygwin -o synflood.exe synflood.o -lnet -lwpcap -lpacket -lws2_32 -liphlpapi

All these modifications shocould have been authorized ded automatically through the configuration process but I did not have time to recheck all the diffs again.

[Edit]

Using mingw [edit]

Requirements
  1. First install mingw
  2. Setup Winpcap. This can be easily done using this article: How
    To install Winpcap/Libpcap under cygwin
  3. Download the version you want of Libnet
[Edit]

Libnet 1.1.2.1 [edit]

Binaries

Binaries for Windows x86 here

[Edit]

Compiling

I have ported Libnet so that it compiles well under mingw

  1. Download libnet-mingw-1.1.2.1.zip
  2. Unpack
  3. See the README file or execute:
./autogen.sh./configuremakemake install./clean-generated.sh
[Edit]

Libnet 1.1.3 [edit]

Binaries

Binaries for Windows x86 here

[Edit]

Compiling

I have ported Libnet so that it compiles well under mingw

  1. Download libnet-mingw-1.1.3.zip
  2. Unpack
  3. See the README file or execute:
./autogen.sh./configuremakemake install./clean-generated.sh

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.