简体   繁体   English

android-监视WiFi流量和数据包

[英]android - monitoring WiFi traffic and packets

I need to write an app which is going to connect to a specific WiFi network (given an IP address/name) and "listen" (monitor) to the network packets under that WiFi. 我需要编写一个应用程序,该应用程序将连接到特定的WiFi网络(给定IP地址/名称),并“监听”(监视)该WiFi下的网络数据包。

Eventually, I should be able to detect specific packets and act accordingly. 最终,我应该能够检测到特定的数据包并采取相应的措施。

I want to write the app myself, so what tools/libraries are out there to monitor traffic? 我想自己编写应用程序,那么有哪些工具/库可以监视流量? (stuff like PCAP.net in C#). (类似于C#中的PCAP.net)。

and one more question, is it possible for me to detect all the packets under that network? 还有一个问题,我可以检测到该网络下的所有数据包吗? or just the ones that I send/receive? 还是我发送/接收的?

thanks! 谢谢! just trying to see what libraries are out there and to hear from people with some experience... 只是想看看那里有什么图书馆,并从有经验的人那里听到...

You can use Android's TrafficStats class to monitor traffic. 您可以使用Android的TrafficStats类监视流量。

From Android Developer's about TrafficStats: 来自Android开发者的 TrafficStats:

Class that provides network traffic statistics. 提供网络流量统计信息的类。 These statistics include bytes transmitted and received and network packets transmitted and received, over all interfaces, over the mobile interface, and on a per-UID basis. 这些统计信息包括在所有接口上,在移动接口上以及在每个UID的基础上发送和接收的字节以及网络包的发送和接收。

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

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