简体   繁体   English

TCPDUMP传入流量捕获

[英]TCPDUMP incoming traffic capturing

I am using TCPDUMP-arm because I'd like to capture TCP packets arriving on my tablet. 我正在使用TCPDUMP臂,因为我想捕获到达平板电脑的TCP数据包。 The problem is that I want to get rid of the results about the outgoing packets. 问题是我想摆脱有关传出数据包的结果。

When I execute: 当我执行时:

./tcpdump-arm tcp -qt -l > /sdcard/res.txt

I get results like: 我得到如下结果:

IP 172.17.***.***.49890 > 74.125.***.***.5228: tcp 139
IP 172.17.***.***.56869 > 173.194.***.***.80: tcp 0
IP 173.194.***.***.80 > 172.17.***.***.56869: tcp 0

Where the IP starting with 172.17. 凡IP以172.17开头。 is mine. 是我的。

So, is there a way to adjust TCPDUMP to show me only the last result (the one where my IP is destination) 因此,有没有一种方法可以将TCPDUMP调整为仅向我显示最后一个结果(我的IP为目标位置的结果)

Not sure about tcpdump-arm (never used it), but assuming that the pcap-filter expression is the same as tcpdump's (which is quite likely, I'd think), then to see tcp traffic and leave out packets where your IP address is the source, your expression should be: 不确定tcpdump-arm(从未使用过),但是假设pcap-filter表达式与tcpdump的表达式相同(我想这很可能),然后查看tcp流量并在IP地址不包含数据包的地方是源,您的表达应为:

tcp and src host not 172.17.xx tcp和src主机不是172.17.xx

Can't try it out now to be 100% sure, but I'll leave that to you. 现在不能尝试100%确定,但我会留给您。

I've managed to deal with the problem :) 我已经设法解决了这个问题:)

Also , I created one ToggleButton in my app , in order to Start/Stop TCPDUMP. 另外,我在应用程序中创建了一个ToggleButton,以启动/停止TCPDUMP。 Now I want to be able to read the text file which is generated, while the program is still executing , and make decisions based on the data from the file. 现在,我希望能够在程序仍在执行的同时读取生成的文本文件,并根据文件中的数据进行决策。

The problem is that I want to read only the latest results , and so far I can just read the whole file from begging to the end. 问题是我只想读取最新结果,到目前为止,我只能读取从乞求到结束的整个文件。 My other option is somehow to read the output from TCPDUMP directly/live in my app , without making a text file , but I have no idea how to achieve that. 我的另一种选择是以某种方式直接/实时地从我的应用程序中读取TCPDUMP的输出,而不创建文本文件,但是我不知道如何实现。

I am looking forward for your replies. 我期待着您的答复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM