天天看點

編譯适用于Android-x86架構的tcpdump工具一、環境說明二、編譯TCPDUMP三、安裝和驗證四、後續

在谷歌和必應上搜尋的android-x86專用的tcpdump工具多半不能使用,它們基本上都是在arm架構的安卓手機上使用的,而且版本都較為老舊。由于android-x86的linux核心是通用的32位linux,那麼能否在常用的32位linux發行版上直接使用32位的gcc編譯tcpdump,然後拷貝至android-x86的模拟器中使用呢?答案是可以的!

linux虛拟主機:centos 6.6 i686

主控端os:windows 7 sp1

主控端ip:192.168.92.1

虛拟機軟體:vmware workstation 11.0

虛拟機系統:android-x86 4.4 r2

虛拟機cpu:單核

虛拟機記憶體:1 gb

虛拟機硬碟:8 gb

虛拟機聯網方式:host-only

虛拟機ip:192.168.92.128

虛拟機sshd軟體:sshdroid

虛拟機ssh連結:[email protected]:2222

tcpdump版本:4.7.4

libpcap版本:1.7.3

注意: 本文使用三台主機,配置如上文所述:

1、承載虛拟機的windows 7主控端,代号為host-1;

2、用于編譯的centos虛拟機,代号為host-2;

3、用于驗證使用的android-x86虛拟機,代号為host-3。

本章節中的操作都是在host-2上完成的,詳細步驟如下所示:

如果看到下圖中的結果輸出,則表明編譯成功:

編譯适用于Android-x86架構的tcpdump工具一、環境說明二、編譯TCPDUMP三、安裝和驗證四、後續

在host-1上,通過xshell和xftp連接配接至host-3(android-x86虛拟機),然後:

從host-2中,将前文編譯好的tcpdump可執行檔案拷貝至host-1中,然後通過xftp将tcpdump拷貝至host-3的/data/local目錄中,并且将tcpdump檔案的權限修改為777。

host-1的xshell已經連結至host-3,則在xshell中運作以下指令:

在host-1的指令行視窗中運作以下指令:

如果在xshell中能夠看到下圖中的輸出,則表明安裝成功:

編譯适用于Android-x86架構的tcpdump工具一、環境說明二、編譯TCPDUMP三、安裝和驗證四、後續

如果想要自行為基于arm的安卓手機或開發闆編譯tcpdump工具,則可以參考以下文章:

monitoring android network traffic part ii: cross compiling tcpdump | symantec connect community

<a href="http://www.symantec.com/connect/blogs/monitoring-android-network-traffic-part-ii-cross-compiling-tcpdump">http://www.symantec.com/connect/blogs/monitoring-android-network-traffic-part-ii-cross-compiling-tcpdump</a>

monitoring android network traffic part iii: installing &amp; executing tcpdump | symantec connect community

<a href="http://www.symantec.com/connect/blogs/monitoring-android-network-traffic-part-iii-installing-executing-tcpdump">http://www.symantec.com/connect/blogs/monitoring-android-network-traffic-part-iii-installing-executing-tcpdump</a>