概述
http://mathieu.carbou.free.fr/wiki/index.php?title=How_to_compile_Libnet_under_Cygwin
Contents[hide]
|
Resources
- Libnet official website
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.
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
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.
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.
Using MinGW
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
Libnet 1.1.2.1
binaries
Binaries for Windows x86 here
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
Libnet 1.1.3
binaries
Binaries for Windows x86 here
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
最后
以上就是迷你时光为你收集整理的Libnet for Win32 Resources Using Cygwin (but I highly suggest to use MinGW) Using MinGW的全部内容,希望文章能够帮你解决Libnet for Win32 Resources Using Cygwin (but I highly suggest to use MinGW) Using MinGW所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复