Your warranty is now void I take no responsibility for any adverse effects to your phone or you love life Do not apply / use this mod if you don;t understand it, or there is any risk for damage top your device or well being YOU are responsible for what YOU do with YOUR own device, the personal information you share, and the processes you follow in regards to any suggestions, mods, or shortcuts offered here on Xda. Please be aware of the potential security and loss of privacy issues sharing information like this can produce.
Requirements (for running on android)
rootHow to use.
busybox (I have only tested with stericsons busybox
NB: This script can be used on the device OR on LinuxTo run from AndroidFlash the install ZIP (or for Advanced users, extract the containing zip to your desired location, and change the config in "shared_constants.inc")
Open a terminal and type
copy the /data/local/DiamondJohnHostManager/hosts file to /system/etc/hostsCode:su; sh /data/local/DiamondJohnHostManager/download_hosts.sh;
alternatively, I personally have actually symlinked the hosts file so I do not need to flip my system partition between r/w and r/o every time I wish to update my hosts file. (yes, I understand the risks of having a system file on a write-able partition)
FINAL_DEST=/data/local/DiamondJohnHostManager/hosts; LINK=$(ls -l /system/etc/hosts | grep "-> $FINAL_DEST"); if [ "$LINK" == "" ]; then $bb mount -o rw,remount /system; if [ ! -f $FINAL_DEST ]; then $bb echo "127.0.0.1 localhost" > $FINAL_DEST; fi; $bb ln -sf $FINAL_DEST /system/etc/hosts; $bb mount -o ro,remount /system; fi;
To run on Linux
Create the directorySome of the features:
mkdir -p ~/android/DiamondJohnHostManager;
expand the containing zip into the folder
open a terminal
1. combines multiple hosts files. see/edit the contents of the file: /data/local/DiamondJohnHostManager/hosts-sources.txtSome FYI:
2. You can edit which (see point 1)
3. On linux, I had 110 host sources, and it generated a 98MB hosts file with over 3.4M lines/domains, in <8min
4. It allows "fallback" host sources. ie mirrors in case the original source fails. Separate each mirror with a "|". NB: They don't actually have to be a "mirror", but can simply be an "alternative" if the previous one fails.
5. You can have multiple mirrors/fallbacks
6. If all the mirrors fail for a line item, it will then fallback to the last known successful downloaded host for that line
7. handles multiple formats. Some of which:
8. You can modify the whitelist and blacklist. NB: They are explicit hosts, not regex patterns ie no "*" in the domains.. Multiple files for each are supported; so you can logically group them.Code:0.0.0.0 www.domainname1.com 127.0.0.1 www.domainname2.com www.domainname3.com
9. if a host is "wrongfully" blocked, you can check which source is the culprit. see the "previous" directory, and note the numbers relate to the host_sources.tct file, and start as the first line being 0 (commented lines are not counted)
10. A log is provided in previous/DiamondJohnHostDownload_log.txt the top section is comma seperated and can be pasted into excel and converted to columns, The following section provides details on each individual download / source
11. If you make ANY changes to the host_sources.txt file, all the previous become invalidated.
I Run with the default 5 hosts sources in the install zip, and it takes 100-120 seconds to updateThe following script is flashed from within recovery. You could also simply manually expand the zip contents to your desired location and edit the "shared_constants.inc" file appropriately
To monitor the end results/output, you can also use my other app TeMeFI https://forum.xda-developers.com/and...ation-t3806260
you can find the method under: Various Ungrouped Extras>Hosts File Check
Download: 201901251428 DiamondJohn host download script installer.zip
DiamondJohn Host Builder Script, Tool/Utility for all devices (see above for details)
Current Stable Version: 201811281200
Stable Release Date: 2018-11-28
Last Updated 2019-09-17