暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

静态编译tcpdump

原创 zayki 2022-12-27
1302

为了方便抓包,不在目标机器上进行多余的软件安装,想到使用静态编译的方法编译tcpdump
在网上找到的方法如下:

FROM alpine:3.9.2 RUN sed -i "s|http://dl-cdn.alpinelinux.org|https://mirrors.aliyun.com|g" /etc/apk/repositories && apk add gcc g++ make automake libpcap-dev #ADD tcpdump-4.9.2.tar.gz /opt WORKDIR /opt RUN wget http://www.tcpdump.org/release/tcpdump-4.9.2.tar.gz && tar -xvf tcpdump-4.9.2.tar.gz RUN cd tcpdump-4.9.2 && CFLAGS=-static ./configure --without-crypto && make RUN mv tcpdump-4.9.2/tcpdump /static-tcpdump && rm -rf tcpdump-4.9.2 tcpdump-4.9.2.tar.gz

我是在centos7上编译的,过程如下:

yum install -y gcc g++ make automake libpcap-devel glibc-static wget https://www.tcpdump.org/release/libpcap-1.10.1.tar.gz tar xvf libpcap-1.10.1.tar.gz && cd libpcap-1.10.1 ./configure 之后修改Makefile,如下一行添加-static,保存之后运行make && make install CFLAGS = -g -O2 -static ${CROSSFLAGS} wget http://www.tcpdump.org/release/tcpdump-4.9.3.tar.gz tcpdump-4.9.3 && ./configure --without-crypto 同样修改Makefile,编译参数CFLAGS加入-static。 保存之后运行make && make install即可
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论