android - 交叉编译 - 用于 x86 的 tcpdump

标签 android binary tcpdump android-x86

我需要 tcpdump 用于 android-x86 的二进制文件。 这是我所做的:

sudo apt-get install gcc-i686-linux-android
sudo apt-get install byacc
sudo apt-get install flex

wget http://www.tcpdump.org/release/tcpdump-4.9.0.tar.gz
wget http://www.tcpdump.org/release/libpcap-1.8.1.tar.gz

tar zxvf tcpdump-4.9.0.tar.gz
tar zxvf libpcap-1.8.1.tar.gz

cd libpcap-1.8.1
export CC=gcc
./configure --host=i686-pc-linux-gnu --with-pcap=linux
make
cd .. 

cd tcpdump-4.9.0
export ac_cv_linux_vers=3
export CFLAGS=-static
export CPPFLAGS=-static
export LDFLAGS=-static
./configure --host=i686-pc-linux-gnu --disable-ipv6

但是当我运行最后一条命令时,出现以下错误:

configure: WARNING: unrecognized options: --disable-ipv6
checking build system type... x86_64-unknown-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for i686-pc-linux-gnu-gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether the compiler supports the -ffloat-store option... yes
checking for inline... inline
checking for __attribute__... yes
checking whether __attribute__((unused)) can be used without warnings... yes
checking whether __attribute__((noreturn)) can be applied to function pointers without warnings... yes
checking whether __attribute__((format)) can be used without warnings... yes
checking whether __attribute__((format)) can be applied to function pointers... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking rpc/rpc.h usability... yes
checking rpc/rpc.h presence... yes
checking for rpc/rpc.h... yes
checking rpc/rpcent.h usability... no
checking rpc/rpcent.h presence... no
checking for rpc/rpcent.h... no
checking netdnet/dnetdb.h usability... no
checking netdnet/dnetdb.h presence... no
checking for netdnet/dnetdb.h... no
checking for net/pfvar.h... no
checking for netinet/if_ether.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking smi.h usability... no
checking smi.h presence... no
checking for smi.h... no
checking whether to enable the possibly-buggy SMB printer... yes
configure: WARNING: The SMB printer may have exploitable buffer overflows!!!
checking whether to drop root privileges by default... no
checking whether to chroot... no
checking for cap_enter... no
checking for cap_rights_limit... no
checking for cap_ioctls_limit... no
checking for openat... yes
checking whether to sandbox using capsicum... no
checking for library containing gethostbyname... none required
checking for library containing socket... none required
checking for library containing putmsg... none required
checking whether the operating system supports IPv6... yes
checking ipv6 stack type... linux-glibc
checking for dnet_htoa declaration in netdnet/dnetdb.h... no
checking for vfprintf... yes
checking for strlcat... no
checking for strlcpy... no
checking for strdup... yes
checking for strsep... yes
checking for getopt_long... yes
checking for fork... yes
checking for vfork... yes
checking for strftime... yes
checking for setlinebuf... yes
checking for alarm... yes
checking for vsnprintf... yes
checking for snprintf... yes
checking return type of signal handlers... void
checking for sigaction... yes
checking for library containing dnet_htoa... no
checking for main in -lrpc... no
checking for library containing getrpcbynumber... none required
checking for local pcap library... ../libpcap-1.8.1/libpcap.a
checking for pcap-config... ../libpcap-1.8.1/pcap-config
checking for pcap_loop... no
configure: error: Report this to tcpdump-workers@lists.tcpdump.org, and include the config.log file in your report.  If you have downloaded libpcap from
tcpdump.org, and built it yourself, please also include the config.log
file from the libpcap source directory, the Makefile from the libpcap
source directory, and the output of the make process for libpcap, as
this could be a problem with the libpcap that was built, and we will
not be able to determine why this is happening, and thus will not be
able to fix it, without that information, as we have not been able to
reproduce this problem ourselves.

有人可以帮我为 android-x86 创建 tcpdump 二进制文件吗。

最佳答案

或者,您可以使用此脚本使用 NDK 构建 tcpdump build-android-tcpdump .

步骤:

  1. 安装 NDK:NDK download

  2. 下载build-android-tcpdump并简单地运行:

    sh build-android-tcpdump -n "/PATH/TO/NDK"-t 4.9.0 -l 1.8.1

就是这样,默认情况下它将为所有 Android 架构构建 tcpdump,包括 x86。

root@generic_x86:/data/local/tmp # uname -srm                                  
Linux 3.10.0+ i686

root@generic_x86:/data/local/tmp # ./tcpdump  -h                               
tcpdump version 4.9.0
libpcap version 1.8.1
Usage: tcpdump [-aAbdDefhHIJKlLnNOpqStuUvxX#] [ -B size ] [ -c count ]
        [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
        [ -i interface ] [ -j tstamptype ] [ -M secret ] [ --number ]
        [ -Q in|out|inout ]
        [ -r file ] [ -s snaplen ] [ --time-stamp-precision precision ]
        [ --immediate-mode ] [ -T type ] [ --version ] [ -V file ]
        [ -w file ] [ -W filecount ] [ -y datalinktype ] [ -z postrotate-command ]
        [ -Z user ] [ expression ]

关于android - 交叉编译 - 用于 x86 的 tcpdump,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44439997/

相关文章:

android - 阻止 USSD 对话并读取 USSD 响应?

java - 许多 drawBitmap 后图像质量变差

android - 回收空间 ItemDecoration 在滚动过程中不断增加

linux - shell 脚本中的 tcpdump 没有捕获任何内容

linux - 来自远程主机的 2 个 tcpdump

java - 由于 SetOnClickListener NullPointerException (Android Studio),应用程序崩溃

python - 获取 1 位在 python Long 对象中的位置

c# - 当值 > 127 时 BinaryWriter.Write(byte value) 问题

linux - 同时捕获两个不同端口上的网络流量

c# - 将所有低位设置为 0,直到剩下两个 1(对于存储为字节数组的数字)