Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packet Level networking in Android

I know how to develop in Android and use the Apache HTTP lib, but I want to go lower, get hold of the wireless interface adapter and be able to send & receive packets wirelessly. I know its possible since there are sniffer apps in the android market. I have looked around and googled a lot, but can't seem to get any ideas on how to even start. Surprisingly nobody seems to have asked this question on SO before too.

I suppose there is no android API that does it for you. Please suggest a way of sending/receiving packets in android or post references to any such resources.

Thanks!

Note: I know java.net api can be used in android (though I haven't used it before) but that doesn't give me the kind of access I want.

like image 664
Rushil Paul Avatar asked Oct 09 '22 16:10

Rushil Paul


1 Answers

There is no way to do this with the standard SDK/NDK.

On a rooted device, you could possibly call into tcpdump, or another libpcap-based application. There is not a supported way to give Java applications the required privileges on a production Android device.

For example, this blog post describes how to use tcpdump to do a basic packet capture on Android.

like image 137
mpontillo Avatar answered Oct 13 '22 10:10

mpontillo