What is the iPhone equivalent to the \Windows\System32\Drivers\etc\hosts file? - iphone

I'm working on a web application and need to debug a problem occurring only on the iPhone.
I can reach the site on my dev box by typing its ip address into Safari (on my phone), but the domain is significant to the application, so I'm going to have to update my config in multiple places every time my IP changes.
What would be ideal is if I could configure the iPhone to always point to a specific IP when I enter a specific domain, just like the C:\Windows\System32\Drivers\etc\hosts file.
Is there a way to do that without jail breaking my phone?

You'd have to jailbreak your iPhone, another way would be to use a proxy. Hope I could help :)

If you have jailbroken, I think it's /etc/hosts (same as the Mac OS X setup)

I appended .local to the end of my computer name and it was able to resolve it.
It's not a perfect solution since I'll still have to adjust the settings in the app, but at least I won't have to keep changing it when my IP changes.
According to this answer on another SE site, it's Bonjour functionality.

Related

hood.ie setting a fixed URL instead of network address

I've made a hood.ie app, where I will be using 2 devices (a laptop from where i do hoodie start) and an iPad.
At the moment, on the iPad i need to get the network address from the laptop from where the app actually sits to enter it in Safari on the iPad (this can also change depending on whats connected to the wifi network).
Is there a more convenient way to do this as the app has be started and logged into daily?
Thanks.
I'm afraid not, it's also not really part of Hoodie's scope. If you want to expose your local sever with less hassle, you could:
Give it a fixed IP address and just bookmark that on the ipad
Use a service like https://ngrok.com/ or http://localtunnel.me/ (especially the former) to have nicer or even fixed urls that tunnel through to your local server
Hope that helps!

Get rid of proxy popup in ios simulator

I'm behind a corporate firewall and all network traffic goes thru the main proxy. In my iOS simulator, I get proxy popups a few times each time I run my app. The thing is, my app doesn't make any network calls (yet), and doesn't import any network frameworks. In fact, I can reproduce this by making a new project in XCode using one of the standard templates and run it straight away; it'll still prompt for the proxy credentials every time.
In my OSX network settings, I've obviously set my proxy credentials in all the different protocols (HTTP, HTTPS, FTP, Socks, RTSP, Gopher). I found that I needed to put the domain and backslash before my username to allow web access in any OSX browsers etc...so given that I did that and then the OSX proxy prompts went away and I was allowed access, I would have thought that the iOS simulator would just inherit those settings...?
Any ideas?
One more bit which may be unrelated: we haven't yet figured out how to get access to the App Store on this Mac; despite supposedly getting past the proxy, any use of the App Store just results in timeouts and we can't even see the "home page". I'm wondering if somehow the iOS simulator is making similar network calls using some other protocol that is like the App Store...? (I would have thought App Store would have been HTTPS but I don't know).
Any thoughts appreciated.
If you put *.apple.com in your proxy passthrough list, the simulator will stop whining about it.
Like you, I can't get the Apple Store to work through our corporate proxy either. I've worked around it by using a wireless network that doesn't use a proxy when I have to use the App Store.
I've found plenty of other things in the OS that don't work through our proxy.
I had the same issue and found another way without touching the proxy settings!
I'm working on a Mac with OSX-El Capitan so maybe in other versions these steps might be slightly different:
Go to System Preferences
Go to Network
Choose your connection (Wireless/Ethernet/Thunderbolt-Ethernet)
Click on Advanced Options
Go to the tab Proxies
The two boxes Automatically detect proxy (for the internet connection on your mac) and Web-Proxy (HTTP)
Insert your login credentials at Web-Proxy (HTTP).
This reduced the occurence of the Proxy-PopUp greatly on all the 3 macs I work with. (At least it doesn't appear periodically anymore when I start my app from xcode)

iPhone proximity detection using wifi

As my iPhone automatically joins my home network once I get home and press the main button, I thought this could be used as a trigger for some home automation ideas I have,
especially disarming the alarm system for example.
I could detect the iPhone by pinging the broadcast address with a script and then look for it's MAC address in the arp cache, but this would have to be done every 15 seconds or so
to be of any use. This really doesn't seem like the most elegant solution though.
Can anyone think of a better way to implement a check like this? I suppose one could assign an IP address dependent on my MAC address, then I would know what to ping, and could thereafter check the MAC address to keep things secure.
Just suppose I cannot assign a DHCP IP based on MAC address, as the problem
of being able to find the MAC address on the network is the part that really interests me.
Secondly I noticed with tcpdump that the iPhone seems to talk to itself all night, but only some sort of Ethernet frames:
23:59:59.740097 00:26:08:ae:ed:eb > 00:26:08:ae:ed:eb, 802.3, length 70: LLC, dsap Null (0x00) Individual, ssap Unknown (0x20) Command, ctrl 0x33: Unnumbered, 23, Flags [Poll], length 56
This happens every 2 minutes.
How could I monitor this traffic so that my "home" knows I am still there using a program? Could be good to automatically alarm the house when I am no longer there...
I think your router here should be the point of control... If you can log the devices that are logged on to the router you can disable your security based on that info.
If you have an openWrt compatible router http://wiki.openwrt.org/toh/start you can certainly extend to get the functionality you want.
Here is a link plugin for the indigo home automation server that does what you want to do bij logging the info from his router. http://www.perceptiveautomation.com/userforum/viewtopic.php?f=19&t=6876&sid=07a351fa04c2eadcd2d3813afc72ae5a
Note: it's really easy to spoof a mac address so might be interesting to have some other verification too :-)

How to modify /etc/hosts file in iphone program?

Is it possible to modify /etc/hosts file in iphone program?
How about for Jailbreaked iphone?
How to do that? Do I need to call specific API? or just use file operations API.
Thanks.
For a non-jailbroken app, the answer is no.
For a jailbroken app, you're no longer bound by Apple's sandbox, so you can interact with the system directly, for example via file operations (fopen and friends).
For a non-jailbroken phone the only way I managed to do this was to change the /etc/hosts file on the wireless router I was connecting to or use a custom DNS server that would in fact cause a DNS poisoning (this is illegal, afaik).

iPhone - see app documents folder using wifi?

The iPhone settings have an IP address for the device when it is connected to a wifi network. Is it possible to get this IP address and establish a connection between a desktop computer (on the same network) and the iPhone?
I want to be able to transfer files between the iPhone and the desktop computer. Some apps like the "Files" and "FourTrack" apps do this.
Can someone please guide me to where I can start?
Thanks a lot for any headsup
Google for SIOCGIFCONF and you'll find a bunch of example code in C for getting all your IP addresses. Once you've enumerated your devices, on iPhone they are always in the following order: Loopback, WiFi, WAN.
Once you have that, you can implement a web server with CocoaHttpServer pretty easily. You'll have to hack it to add directory listings and the like, but it's not too hard. It's not trivial, but it's not too bad.
I think you already answered your question... you have to download an app to do this. I use "Air Sharing" and it works fine.