programing

iPad의 호스트 파일을 편집 할 수 있습니까?

nasanasas 2020. 9. 16. 07:47
반응형

iPad의 호스트 파일을 편집 할 수 있습니까?


광범위한 탈옥 없이는 이것이 가능할지 의심 스럽지만, iPad (또는 모든 iOS 기기)의 호스트 파일을 편집 할 수 있습니까?


아니요. 앱은 자체 샌드 박스 내에서 문서 디렉토리 내의 파일 만 수정할 수 있습니다. 이는 보안 및 설치 / 제거의 용이성을위한 것입니다. 따라서 탈옥 된 장치에서만이 작업을 수행 할 수 있습니다.


이전 답변은 맞지만, 원하는 효과가 도메인에 대한 HTTP 트래픽을 다른 IP로 리디렉션하는 것이라면 방법이 있습니다.

기술적으로 귀하의 질문에 대한 답변이 아니기 때문에 여기에서 질문하고 답변했습니다.

iPad에서 만든 HTTP 요청을 어떻게 리디렉션 할 수 있습니까?


아니요, 탈옥없이 iPad의 호스트 파일을 변경할 수는 없지만 해결할 수 있습니다.

내 시나리오는 다음과 같습니다.

  • IP가있는 Mac OS X, 192.168.2.1웹 앱 실행
  • 웹 앱을 테스트하려는 장치 인 iPad
  • Charles (Mac 용), iPad 용 HTTP 프록시 활성화

iPad를 통해 Mac에서 실행되는 웹 앱을 테스트하려고하는데 직접 액세스 할 수 없습니다.

솔루션이 저에게 효과적입니다.

  • 먼저 서버와 iPad가 동일한 로컬 네트워크에 있는지 확인하십시오.
  • 그런 다음 "프록시> 프록시 설정 ..."메뉴에서 Charles 프록시를 설정하고 Port(대부분 8888) 입력하고 전환 Enable transparent HTTP proxying합니다.

여기에 이미지 설명 입력


  • iPad에서 프록시 설정을 설정합니다.

여기에 이미지 설명 입력

이제 iPad에서 웹 앱을 방문 할 수 있습니다.

물론 Linux의 Squid 또는 Varnish 또는 Wondows의 fiddler 와 같은 다른 프록시 도구를 사용할 수 있습니다 .


The easiest way to do this is to run an iPad simulator using XCode and then add an entry in the hosts file (/etc/hosts) on the host system to point to your test site.


I would imagine you could do it by setting up a transparent proxy, using something like charles and re-direct traffic that way


Yes, you can edit the iPad hosts file, but you need to be jailbroken. Once you've done that, download Cydia (app market), and get iFile. The hosts file is located within "/etc/hosts".


I needed the same functionality, and doing jailbreak is no-no. One solution is to host yourself DNS server (MaraDNS), go to your wifi settings in ipad/phone, and add your custom DNS server there.

The whole process took me only 10 minutes, and it works!

1) Download MaraDNS

2) Run mkSecretTxt.exe as administrator

3) Modify mararc file, mine is:

ipv4_bind_addresses = "put your public IP Here"
timestamp_type = 2
random_seed_file = "secret.txt"

csv2 = {}
csv2["Simple.Example.com."] = "example.configuration"

Add file called "example.configuration" into the same folder where run_maradns.bat is.

4) Edit your example.configuration file:

Simple.Example.com. 10.10.13.13 ~

5) Disable all Firewalls (convenience)

6) Run file "run_maradns.bat"

7) There should be no errors.

8) Add your DNS server to list, as shown here: http://www.iphonehacks.com/2014/08/change-dns-iphone-ipad.html

9) Works!


I know it's been a while this has been posted, but with iOS 7.1, a few things have changed.

So far, if you are developing an App, you MUST have a valid SSL certificate recognized by Apple, otherwise you will get an error message on you iDevice. No more self-signed certificates. See here a list:

http://support.apple.com/kb/ht5012

Additionally, if you are here, it means that you are trying to make you iDevice resolve a name (to your https server), on a test or development environment.

Instead of using squid, which is a great application, you could simply run a very basic DNS server like dnsmasq. It will use your hosts file as a first line of name resolution, so, you can basically fool your iDevice there, saying that www.blah.com is 192.168.10.10.

The configuration file is as simple as 3 to 4 lines, and you can even configure its internal DHCP server if you want.

Here is mine:

listen-address=192.168.10.35

domain-needed

bogus-priv

no-dhcp-interface=eth0

local=/localnet/

Of course you have to configure networking on your iDevice to use that DNS (192.168.10.35 in my case), or just start using DHCP from that server anyway, after properly configured.

Additionally, if dnsmasq cannot resolve the name internally, it uses your regular DNS server (like 8.8.8.8) to resolve it for you. VERY simple, elegant, and solved my problems with iDevice App installation in-house.

By the way, solves many name resolution problems with regular macs (OS X) as well.

Now, my rant: bloody Apple. Making a device safe should not include castrating the operating system or the developers.


If you have the freedom to choose the hostname, then you can just add your host to a dynanmic DNS service, like dyndns.org. Then you can rely on the iPad's normal resolution mechanisms to resolve the address.


Workarond I use for development purposes:

  1. Create your own proxy server (One option would be: Squid on Linux).
  2. Set your hosts file with your domains.
  3. Set the proxy server on the IPAD/IPHONE and you can use with your hosts.

iPhone Mobile 프록시 생성기를 사용하여 모바일 인터넷 (3G)을 통해 iPhone 또는 iPade에서 프록시 서버를 사용할 수도 있습니다.

http://iphonesettings.net/mobileproxygenerator.php

이동 통신사의 apn (필요한 경우 apn 사용자 이름 / 암호 사용)과 통과하려는 프록시 서버를 입력하고 생성을 탭하기 만하면됩니다.


액세스 권한이 필요합니다 /private/etc/. 당신은 할 수 없습니다.


베스트 답변 : 브라우저에 http 또는 https, IP 주소, 콜론 및 포트 번호를 추가하기 만하면됩니다. 예 : https://123.23.145.67:80

참고 URL : https://stackoverflow.com/questions/4783923/can-i-edit-an-ipads-host-file

반응형