我是靠谱客的博主 迷你时光,最近开发中收集的这篇文章主要介绍Libnet for Win32 Resources Using Cygwin (but I highly suggest to use MinGW) Using MinGW,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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

  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

最后

以上就是迷你时光为你收集整理的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所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(34)

评论列表共有 0 条评论

立即
投稿
返回
顶部