iPhone VPN to track usage - ios

Hi StackOverflow community.
I am beginning a new project and was wondering if I could get some insight on VPNs and iPhones.
I want to create a VPN so that I can route all of my network traffic through it from my iPhone. I also hope to log each request that was routed through the VPN? (Similar to Hooked)
I am not sure where to start - any insight would be helpful!
Here is my initial plan:
1) Create a VPN (what should I use to create it?)
-How to accept iPhone request?
-How to route all requests to where they need to go?
2) Hook VPN up to iPhone and route all traffic through it

This is actually not a programming, but a network question. So you might rather post a question over at serverfault.
You need a VPN server that in best case, has a fixed IP. From your iPhone you connect to this VPN via the external IP. If you don't have a fixed one, you'd need to update the IP from time to time or use DynDNS or something similar, but they're not perfect, as far as I know.
You configure & connect the VPN within the iPhones Settings app (General → VPN)
Within the VPN your iPhone gets assigned an IP address within the IP range of your private network (e.g. 10.0.0.xxx).
All the devices traffic gets routed through the VPN. When you have extensive logging on the VPN sever, you should be able to get a log of these requests.
EDIT
This is all really broad and generalized. But as mentioned, this is mostly about VPN Sever configuration and, thus cannot be further discussed here on SO.

Related

How do I connect to a server on a dev machine?

I have a REST API on my dev machine. If an app is running on a real device, how do I connect?
At present, I am looking up the IP address of the machine on the local network and setting that as the domain in the app's Info.plist.
However, this is a nightmare because the IP address changes everywhere I go and sometimes it inexplicably won't connect.
Is there an easier way of doing this?
I've used OHHTTPStubs to deal fake data. At least now I can work on the UI without needing to be concerned with the network.

.local domain and iOS/OSX

Hello I'm working with an hardware team to a really nice device that we can connect through with an iOS application. Currently we are using an ip address to perform calls on this device and it is working perfectly. Since we read about the new ATS specifics by Apple, we are trying to move the connection to a .local domain instead of using an IP address, so that we can configure domains exceptions in the App Transport Security Settings. We are experiencing a lot of problems trying to connect to the .local domains from the App... it seems that the DNS is never resolved. Are there any known bug related to .local domain? I seen some very old bugs... but nothing related to iOS 10/9.
Note: Currently to connect to the device we have to put the device in Access Point mode and from iOS settings we choose it as "wi-fi" router.
You're looking for Zero configuration networking, specifically DNS Service Discovery, an industry standard that Apple markets as Bonjour. That's what allows a device to list its services for DNS discovery through the .local top-level domain.
"Publication: An Example" in Apple's Bonjour guide is a good place to start for understanding what you'd need to do to implement this as a hardware vendor.

Accessing remotely my web service

I have implemented a web service on my mac and I am able to access its functionalities through the url "http://localhost:8080/ServiceApp-war/resources/".
As I got satisfying results that I could see in the iPhone simulator in Xcode, I decided to connect my iPhone and test on it. But for this to work I think I need to change the "localhost" in my URL to the IP address of my mac.
I tried to replace it with my public IP address and I got a "could not connect to the server" error on my console. I also tried to replace "localhost" with the IP address I found in System Preferences-->Network-->Wi-Fi and I could see that it was working on the simulator but still nothing when I connect my iPhone and run the application on it.
Please provide a solution for accessing my web service remotely.
Thank you.
Create hotspot from your mac, connect to it with your iPhone and try again.
<lame solution>
Try some service for temporary domain, it will make your computer accessible from anywhere.
How do you "connect" your iPhone? USB connection does not create a network. Well, it does create if you turn on Personal Hotspot on your iPhone (maybe in some other cases, dunno). But the most simple way is to connect Mac and iPhone to the same WiFi network.
Once connected, you can use any of "ping" apps available on App Store. Just look for "ping" (some kind of "network reachability test" or so). You can check if your Mac is really reachable on the network.
If it's not reachable, check your network settings on both devices: do they belong to the same subnet, do they use the same gateway, etc.
If your Mac is reachable with ping, then you should deal with your web service. I setup the web server (which is already distributed within OS X): it already has all the settings to allow other devices to connect. But your web service may require some additional setup. It's two basic things: it should bind to your IP address (please check http://YOUR.IP:8080/ServiceApp-war/resources/ from your Mac!) and second, accept incoming connections from other agents, you should find it somewhere in its settings.
Ngrok was the perfect solution I was looking for.
https://ngrok.com
You could also try finch, which is similar to ngrok. It has a nice friendly GUI. https://meetfinch.com

Peer to Peer Communication without Server in iPhone

Is there any way to communicate between two devices or application with Browser of other devices without having Server in the middle?
If I explain, actually I want to share data between iPhone application and Browser of Desktop, I tried HTTPServer, & played with WebSocket too, but in these case this server plays an important role in between. So If somehow I exchange data between two peers like IP Address, Port number, Then Is it possible to communicate between those two devices using Wi-fi channel without having Server in Middle?
The Way, Right now I have implemented.
The way, I am looking for.
I recently came across http://www.freedomjs.org/ which is suppose to provide p2p functionality in the browser.

Examining TCP traffic from an iOS device

Is there an app or clever way to check TCP:IPv4 traffic for a host:port on iOS devices? Users will be connecting to a device with an iOS app, and if there is an existing way to sniff or otherwise log TCP (and any IP traffic) on an iPad that would be super useful. We could eventually add this into the app, but it seems like there has got to be a nice app for inspecting a network... e.g. some of the functionality of wireshark, socat, and nmap. I don't seem to be able to use the right search terms in the app store and I'm also wondering if there is a way to do this in the Safari browser?
I ended up using iTelnet and turning off all the login scripts. That will connect to any ip:port with TCP.

Resources