Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,808,448 Members 40,734 Now Online
XDA Developers Android and Mobile Development Forum

[MOD][Xposed][4.3+] hosts Enabler (v1.0) - re-enables use of hosts file

Tip us?
 
DavisNT
Old
#1  
DavisNT's Avatar
Recognized Developer - OP
Thanks Meter 461
Posts: 352
Join Date: Aug 2011
Location: Riga

 
DONATE TO ME
Default [MOD][Xposed][4.3+] hosts Enabler (v1.0) - re-enables use of hosts file

This mod allows to use /system/etc/hosts file on configurations/ROMs (mostly symlinked hosts file on Android 4.4+) where it is ignored.
Hosts file usually gets ignored on some ROMs due to SELinux restrictions if it is a symlink to file on different partition.

Technically it works by attaching to all packages/apps and hooking DNS resolution API. On first name resolution API call hosts file is read and stored in memory (in HPPC OpenHashMap structure).

Additional features of hosts file:
  • use of IP address 127.0.0.0 allows to fail name resolution of associated hosts
  • use of DNS names instead of IP addresses (these DNS names are passed directly to DNS resolver - they are not looked up in hosts file recursively)

Known limitations:
  • JNI libraries are not affected (some applications may still ignore hosts file)
  • hosts file is read in memory of each application when it makes first DNS query (time and memory used depends on size of hosts file; time is logged in logcat with tag "hostsEnabler")

hosts Enabler uses HPPC: High Performance Primitive Collections for Java library which is distributed under Apache License 2.0.

This mod requires Xposed framework to be set up and hosts Enabler enabled as Xposed module.
Disclaimer: I am not responsible for anything that may happen as a result of using this mod.


Xposed Module Repository page:
http://repo.xposed.info/module/lv.id.dm.hostsenabler

For changelog see next post, for download links see downloads section.

XDA:DevDB Information
hosts Enabler, Xposed for all devices (see above for details)

Contributors
DavisNT
Xposed Package Name: lv.id.dm.hostsenabler

Version Information
Status: Stable
Current Stable Version: 1.0
Stable Release Date: 2014-08-30

Created 2014-08-30
Last Updated 2014-08-31
The Following 2 Users Say Thank You to DavisNT For This Useful Post: [ Click to Expand ]
 
DavisNT
Old
(Last edited by DavisNT; 30th August 2014 at 10:44 PM.)
#2  
DavisNT's Avatar
Recognized Developer - OP
Thanks Meter 461
Posts: 352
Join Date: Aug 2011
Location: Riga

 
DONATE TO ME
Changelog:
v 1.0
* Initial release.
The Following User Says Thank You to DavisNT For This Useful Post: [ Click to Expand ]
 
defim
Old
#3  
Senior Member
Thanks Meter 801
Posts: 1,556
Join Date: Feb 2012
@DavisNT: Seems you missed UnbelovedHosts ...
Motorola Defy+ aka MB526 Android 4.4.4 Cyanogen Mod
Samsung S4a aka GT-i9295 Android 4.2.2 Google Edition
My Android apps / Xposed modules: show Threads
 
DavisNT
Old
(Last edited by DavisNT; 31st August 2014 at 12:14 AM.)
#4  
DavisNT's Avatar
Recognized Developer - OP
Thanks Meter 461
Posts: 352
Join Date: Aug 2011
Location: Riga

 
DONATE TO ME
Quote:
Originally Posted by defim View Post
@DavisNT: Seems you missed UnbelovedHosts ...
Actually I was aware of that module, but I wanted to restore full functionality of hosts file (name resolution, use with third party updater tools etc.) with main focus on name resolution.
If you like my post, press Thanks on that post. If you like my thread, rate that thread. Thanks!

My Latest App: Jelly Bean 4.x Airplane Mode Helper

Phone: Samsung Galaxy S3 I9300
Baseband: I9300XXEMC2
ROM: CyanogenMod 11 nightlies
Mods: Pictures2SD

Ex Phone: Samsung Galaxy S2 I9100; I9100BVLPE baseband; CM 10.1; Mods: Swap SDcards mod for SGS2 CM10
Ex Phone: LG Optimus One P500; New Baseband; CyanogenMod 7.2.0; candied kernel by DJNoXD (2.4-caveman-vsync version); Move to sd-ext
 
defim
Old
#5  
Senior Member
Thanks Meter 801
Posts: 1,556
Join Date: Feb 2012
Quote:
Originally Posted by DavisNT View Post
Actually I was aware of that module, but I wanted to restore full functionality of hosts file (name resolution, use with third party updater tools etc.) with main focus on name resolution.
Both seem technically more or less the same: Reading an file with blocked hosts and answer name resolution requests with its contents. Btw with some devices (like Nexus 7) there is the issue that the /etc/hosts file is sometime reverted at reboot, what was the cause for me to use Xposed
Motorola Defy+ aka MB526 Android 4.4.4 Cyanogen Mod
Samsung S4a aka GT-i9295 Android 4.2.2 Google Edition
My Android apps / Xposed modules: show Threads
 
DavisNT
Old
#6  
DavisNT's Avatar
Recognized Developer - OP
Thanks Meter 461
Posts: 352
Join Date: Aug 2011
Location: Riga

 
DONATE TO ME
Quote:
Originally Posted by defim View Post
Both seem technically more or less the same: Reading an file with blocked hosts and answer name resolution requests with its contents. Btw with some devices (like Nexus 7) there is the issue that the /etc/hosts file is sometime reverted at reboot, what was the cause for me to use Xposed
I won't say they are the same:
  • UnbelovedHosts: full featured ad blocking solution
  • hosts Enabler: enables use of /system/etc/hosts file (for manually added name resolution entries (home PC etc.) or, if you wish, with any 3rd party updater software)
If you like my post, press Thanks on that post. If you like my thread, rate that thread. Thanks!

My Latest App: Jelly Bean 4.x Airplane Mode Helper

Phone: Samsung Galaxy S3 I9300
Baseband: I9300XXEMC2
ROM: CyanogenMod 11 nightlies
Mods: Pictures2SD

Ex Phone: Samsung Galaxy S2 I9100; I9100BVLPE baseband; CM 10.1; Mods: Swap SDcards mod for SGS2 CM10
Ex Phone: LG Optimus One P500; New Baseband; CyanogenMod 7.2.0; candied kernel by DJNoXD (2.4-caveman-vsync version); Move to sd-ext
 
Rom
Old
#7  
Rom's Avatar
Senior Member
Thanks Meter 38
Posts: 380
Join Date: Jul 2013
Location: Lyon
I will test it thanks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes