Android Shark(tcpdump)创建无效的pcap

时间:2015-08-13 13:11:03

标签: android wireshark scapy tcpdump packet-capture

我出于某些目的运行Shark,一个用于Android的tcpdump工具。我在两个Android设备上运行它,抓取捕获文件,然后打算在其上运行一些统计数据。一个平板电脑和一部手机。 他们分别运行Android 4.2.2和4.3。使用标志-vv -s 0运行两个设备的捕获。我当然尝试重新安装。

查看Wireshark中的数据,来自手机的数据很好,但平板电脑的数据无法正确读取(不会识别任何协议或任何内容。)

我试图在文件上使用pcapfix,但是pcapfix说文件没问题。但我无法用scapy读取它,dpkt(用于读取网络流量的python库,只会将每个数据包丢入“其他”,被读作“Raw”)或wireshark。

任何人都知道我做错了什么,或者如何修复文件?

Capture file for phone (working)
capture file for tablet (broken)

数据来自移动流量(无wifi)。该手机采用LTE / WCDMA / GSM,而平板电脑采用WCDMA / GSM。我将尝试看看是否会导致它,但直到明天才会这样。

1 个答案:

答案 0 :(得分:2)

引用libpcap中的提交注释,试图解决这个特定的****:

For various annoying reasons having to do with DHCP software, some
versions of Android give the mobile-phone-network interface an ARPHRD_ 
value of ARPHRD_ETHER, even though the packet supplied by that interface
have no link-layer header, and begin with an IP header, so that the
ARPHRD_ value should be ARPHRD_NONE.

这意味着这些捕获的pcap文件具有错误的链接层标头类型。

如果你有Wireshark,你有editcap;做

editcap -T rawip -F pcap shark_dump_tablet.pcap shark_dump_tablet_fixed.pcap

这将读取shark_dump_tablet.pcap的所有数据包并将其写入名为shark_dump_tablet_fixed.pcap的新pcap文件,但链接层标题类型为" Raw IP",而不是"以太网",在文件的标题中。您应该能够读取生成的文件。