Sniffing network requests
Asked Answered
P

1

5

I am looking for a way to sniff the network traffic my Android app is generating. The reason is I want to check and send statistics of the traffic generated by a third party tracking library I am using in my app.

Because of this, I cannot use any tPacketCapture or similars.

I have no access to the http client of this tracking library, so I cannot intercept any request.

I already took a look to VpnService, but I cannot force the user to connect to a VPN every time he is using my app of course.

So I am looking for any advice on how to do this in Android, if it is possible.

I found that there is this library, NetworkEye, which is doing exactly what I would like to do... but for iOS.

Pappus answered 16/2, 2016 at 17:42 Comment(6)
not sure that you can do that if your device is not rooted. Also DDMS could be useful: developer.android.com/tools/debugging/ddms.html#networkPointless
can you pass your tracking library a custom http client? (btw, which tracking lib is it?) in which case Stetho might work for youShishko
@Shishko no I cannot. It's called Adjust. You can find it on github too.Pappus
since the lib is open-source, yes you can. here: github.com/adjust/android_sdk/blob/master/Adjust/adjust/src/… you can inject stetho sniffing. (or whatever other sniffing you want ot use)Shishko
I am not really fan of code injection, but anyway, what if I am using also GTM? which is not open sourcePappus
Btw, by injecting code you mean writing a gradle script which inject code into that point when compiling right? In that case, I need to download the source code of Adjust, loosing the chance to get any update coming from maven. Am I correct?Pappus
N
0

As far I know, to achieve 'global' packet sniffing in Android OS you have to run on a rooted device. For the library,I would go through the NDK and libpcap for Android

Neanderthal answered 16/2, 2016 at 18:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.