8

I want to intercept packets and get the IP/Port numbers, along with the PID/UID of the connection. Things I'm thinking about and what not below...

  • VpnService: When using the app tPacketCapture, you can clearly see that they start a VpnService. This is where I think I'll be able to do it. However, what would I search on Google/what do I need to look up about the VpnService so that it just acts as a channel for all the packets to go through so I can read what they contain? I've emailed the company that worked on tPacketCapture, but they've yet to get back to me. If anyone has any idea on this, please say what you know.
  • /proc/[pid] file system. This area of the OS has valuable information, most importantly, /proc/net/tcp and /proc/net/udp which are both of interest, but I'd rather not constantly read these files and build everything up myself. Hence the VPN solution above.
  • Their are minor other things, but ultimately, they won't work as well as the VpnService, so if anyone can help me with that and making it "local" only, or even what to search to find other examples in other languages, that'd be great.

So, ultimately, my question is, how do you make a VpnService to just reroute the packets to and from where they were originally going to/from.

Any help on this matter would be greatly appreciated.

Thanks!

Justin Warner
  • 849
  • 2
  • 10
  • 20
  • See http://stackoverflow.com/questions/9199553/possible-to-use-vpnservice-implementation-to-capture-and-send-packets/12486571 – plaisthos Jan 27 '13 at 11:15
  • I've been there several times, and as it gave me the idea to do this to begin with, it doesn't state how to make a VPN correctly. IE: Route and forwarding etc. of the VpnService. – Justin Warner Jan 27 '13 at 22:57
  • Hi, did any of you ever got this working? I am able to capture packets from the interface, but its been impossible to route them back to the destination IP address (I unwrap the IP and TCP headers). – Juan Acevedo Jul 29 '13 at 17:02
  • @JustinWarner: Were you finally able to solve the problem ? – thedarkpassenger Feb 21 '16 at 16:55
  • see this example http://www.thegeekstuff.com/2014/06/android-vpn-service/ – Gorio Mar 04 '16 at 20:00

0 Answers0