您的位置:首页 > 其它

Libnet for Win32

2013-07-21 08:11 936 查看
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 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

First install MinGW
Setup Winpcap. This can be easily done using this article: How
to install Winpcap / Libpcap under Cygwin
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

Download libnet-mingw-1.1.2.1.zip
Unpack
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

Download libnet-mingw-1.1.3.zip
Unpack
See the readme file or execute:

./autogen.sh
./configure
make
make install
./clean-generated.sh
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: