willpowerforever
willpowerforever

Reputation: 319

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.

Upvotes: 1

Views: 3934

Answers (2)

clawoo
clawoo

Reputation: 791

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).

Upvotes: 0

jnic
jnic

Reputation: 8785

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).

Upvotes: 2

Related Questions