Libnet for Win32

http://mathieu.carbou.free.fr/wiki/index.php?title=How_to_compile_Libnet_under_Cygwin


Contents

  [hide]

[ edit]

Resources

[ 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 to 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 to 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.c
gcc -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.c
gcc -g -Wall -mno-cygwin -o synflood.exe synflood.o -lnet -lwpcap -lpacket -lws2_32 -liphlpapi

All these modifications should have been included 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
./configure
make
make 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
./configure
make
make install
./clean-generated.sh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值