Hossein Kurd
Hossein Kurd

Reputation: 4585

Make PPTP VPN Connection Programmatically And Capture Packets

I use this Tutorial to Make PPTP VPN Connection Programmatically And Capture Packets But Some thing is wrong, i think problem is when i want cature pockets in while loop

when i Connect to vpn by app and try to open site in browser it shows : You are offline ... Send And received always is 0 bytes / 0 pockets also i need to disconnect connection in app

how i can fix them ?

Upvotes: 4

Views: 3861

Answers (1)

Dmitry
Dmitry

Reputation: 1208

The tutorial you used is not about PPTP or another specific VPN kind, it's about packet capturing. You should implement PPTP client side by yourself and after that interconnect you packet capture code (while loop) and PPTP client code.

If you can show your source code it would be easier to show what's wrong.

UPD1:

so how i can use PPTP connection, connect and disconnect it ?

This is a big and complex task. There is no fast solution. When I did the same I've spent about a year for it. You can do something like the following:

  1. Import existing 3rd party PPTP client into your project (for example, http://pptpclient.sourceforge.net/)
  2. Improve imported code to make it able to interact with your main code (C/C++ code you can use as native library via JNI or as external executable and interact with it via IPC)
  3. Link your code with imported code (read IP datagrams from VPN service socket, write them into PPTP client socket, and vice versa)

UPD2:

I saw two applications which implement VpnService.

The first one is StrongSwan. VpnService extended here, native part (real vpn service implementation) starts here.

The second is OpenVpn port ics-openvpn. It starts standalone openvpn process here, and manages it via standard openvpn management interface (unix socket) here.

Upvotes: 3

Related Questions