0

I need to do it for security testing purpose of an app. I have a rooted emulator which runs 7.1.1, It is rooted, I changed hosts file by using echo command, root file explorer, adb push and every else way I could. But it doesn't reflect in my chrome or any other browser. I looked into chrome's local DNS cache, I cleared it, still doesn't work. I added new entry like

xx.yy.zz.aa facebook.com

(one space and new line at end)

But after entering facebook.com, I don't get website of xx.yy.zz.aa instead I get genuine one. I have tried all the previous answers but it doesn't work, surprisingly what works is when I put 127.0.0.1 i.e localhost instead of any other websites in place of ip. Then it routes to localhost. I very much need to route genuine website to ip I choose for testing my security jars works or not.

Is there any way to achieve this, if not in chrome any other browser. Or is there any way to disable global DNS and use local DNS only.

Help appreciated very much.

PS : hosts file gets changed successfully. Old answers don't work anymore

  • 1
    Have you cleared the Chrome internal DNS cache? Enter the url chrome://net-internals/#dns into the address bar. – Robert May 1 at 17:16
  • Yea already did that. Doesn't work. But when i enter site from hosts file say for eg here faceboom.com it's there with ip i modified in hosts. Still redirects too original facebook. – minigeek May 1 at 17:21
  • @Robert any other way? – minigeek May 1 at 17:59
  • @minigeek did you try clearing DNS resolver cache (ndc resolver clearnetdns <interface>) or restarting device? Can you please share what IP address you are trying to reach? Try pinging first from a terminal emulator instead of using a browser. – Irfan Latif May 1 at 18:32
  • @IrfanLatif no I didn't try that. Is that command supposed to typed in adb shell. And any ip address I am talking about other than localhost. I will try pinging or traceroute with busybox. I can't restart device because after that it looses root access since it's an emulator and not an device. Also what's interface? – minigeek May 1 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.