yashsingh1/xdaforums huggingface dataset:
[Magisk] Didgeridoohan:
Yes, an empty file named "whitelist" (no extension) that you add your whitelisted addresses to. And, just to make sure, sdcard is your internal storage, not an external sdcard.
[Magisk] spectkiller:
now i understand the wholle story ,,,, thank sir for your great patience ?
[Magisk] Manish Raja 345:
help ,,,,, i got huge battery drain from unified host adblock as seen in my battery consumption option in phone setting
[Magisk] litemaster:
As per instructions, enable "Systemless hosts" in Magisk and reboot.

It tries to write somewhere not allowed, my guess is /system.
[Magisk] TCoreXxx:
I've now managed to turn off after deactivation and nune. Although it is active, but the homepages that are built into the filter, I can still open what am I doing wrong? Please help. because I can access various sex sites etc although actively marked.
[Magisk] Didgeridoohan:
You've enabled Systemless Hosts in the Manager settings and then either used the app or run the hosts commands in terminal? If the result still is the same, please run the mount command I posted and return with the output.
[Magisk] TCoreXxx:
Hope this helps
[Magisk] Didgeridoohan:
Nope, it didn't unfortunately... Everything is as it should be. Honestly I wasn't expecting it to be anything else, since you've managed to install the module, but hey, it was worth a shot.

So, I'm assuming that it's the same story when you're trying to apply the hosts file? You get an error in the app and the terminal command tells you it's read-only?

Could you provide your Magisk log? Upload it somewhere, or attach it to your post. Don't post a screenshot or paste it...
[Magisk] TCoreXxx:
View attachment magisk_log_20180321_200635.log

It's just really strange hmm: /Maybe you can find something out of the log
[Magisk] Didgeridoohan:
Could you try with Core Only Mode enabled (enable in the Manager settings and reboot). Be warned that this will disable all your modules (of which you have quite a few), so all your systemised apps, mounted folders, etc will revert to normal until you disable Core Only Mode again. This is to ensure that it isn't one of your installed modules that is causing issues.
[Magisk] TCoreXxx:
I have now activated only the core function and lo and behold, the blocking works The question is what bothers me? Bzw which module, thank you for the help so far :) after renewed deactivation of Kernmodul runs now the whole blocker with the other modules un no idea why this time worked now, anyway, I can finally use it, thank you :)
[Magisk] Zackptg5:
Not sure for sure which module it'd be except that it's not v4a or ubdr or initd injector. Try removing universalhide and see what happens. Also, what device do you have?
[Magisk] Didgeridoohan:
My guess would be either the Universal SafetyNet fix (it messes with Magisk's internals, I don't recommend it), or the Folder Binder module (there are reports of it breaking things).
[Magisk] SysWiz:
I see how to block or allow specific ad domains, but how do I allow all ads on specific pages? For example, apkmirror.com.
[Magisk] guest4711:
No chance with any host based ad blocker.
[Magisk] Dezqo:
The blacklist feature simply doesn't seem to work for me...

After adding lines to it (without "0.0.0.0") and applying it I checked out the hosts file and there is nothing under "#blacklist"; seems like it just didn't add the lines!

For now I've added the domains I want to block myself directly in the "/etc/hosts" file but I hope you guys can fix this bug.
[Magisk] jenslody:
Did you reboot your device?

It works on my phone, but the changes need a reboot to be visible in the mounted hosts-file.
[Magisk] Dezqo:
Oh yeah, that did the trick!

Thank you :)
[Magisk] Dezqo:
This might be a stupid question now (still pretty new to Android) but how is this module "systemless"?

Doesn't it mess with the hosts file in "/system"?

The reason why I can't tamper with the system partition at all is because I have to install OTA updates every month.
[Magisk] Didgeridoohan:
It "messes" with the hosts file in /sbin/.core/img/.core, that Magisk systemlessly mounts over /system/etc/hosts when you have "Systemless hosts" enabled.
[Magisk] Mike Foxtrot:
just reporting........if i have hosts adblock enable with blocking fakenews gambling and social and if i newly install google play games for the first time play games will not be able to connect to the internet. this happens only when you have hosts adblock enable with above mentioned parameters blocked and you are NEWLY INSTALLING play games for the FIRST TIME .thanks
[Magisk] spectkiller:
is it safe to using this module with VPN?
[Magisk] guest4711:
It shouldn't harm. But if all pakets are routed through the vpn without trying to resolve any addresses first it will not block anything.

So give it a try. It may work and it should not harm...
[Magisk] zerlkung:
After install this safetynet show red but uninstall i got pass. how to fix it. i love this module.
[Magisk] pkWhistle:
I read earlier in this thread that it isn't possible to run this and adaway at the same time. Is this superior to Adaway or just preference at this point?
[Magisk] Didgeridoohan:
They both do the same thing... So pick one or the other. Personally I prefer this module, but there are some features in AdAway you can't get with the module (It's been mentioned previously, read back a bit).
[Magisk] Rj5676:
In previous versions this worked flawless for me but after updating to v16 , it's stopped working . I did a clean install still not working . I haven't tried it with terminal because earlier also I used it with the given application only . I am on OB23 with no other ad block installed . It could be helpful if direct download link for the hosts file is provided .
[Magisk] Didgeridoohan:
There's a link to Steven Black's Unified Hosts at the top of the OP. You can download whatever hosts file you use directly from there, if you want.

Also, providing a little more (a lot more) details than "it doesn't work" usually helps when asking for help/reporting issues...
[Magisk] jant90:
I love this module, thanks!

I'm wondering though, is there a convenient whitelist available for affiliate network urls (such as Zanox/Daisycon/ShareASale). I hate it when I click a link but I can't follow it because the urls are blocked in the hosts file.
[Magisk] Rj5676:
In the earlier versions I select whichever options I need and click on update button and then reboot the phone and it used to work . I do the same steps after updating to v16 , it says update successful but still the ads are displayed .
[Magisk] Didgeridoohan:
Have you tried the age old IT-support solution of turning it off and on again? Toggling Systemless Hosts off and on in the Manager settings, that is? :laugh: And then reapply the hosts file, of course.
[Magisk] jimger:
Guys, do u know if there is a way to add different ip for a site? For example add piratebay proxy to hosts? I don't know how to it with unified hosts...
[Magisk] cmohan0004:
does it slows down internet speed? i m setting very much decrease in speed
[Magisk] OldMid:
Not at all, all it does is block certain domains in your hosts file, doesn't affect connectivity or speed in anyway
[Magisk] cmohan0004:
hmm..., i disabled from magisk and rebooted and my net speed got ok like before... let me do some testing
[Magisk] birleytweet:
Sorry for the basic question. Those two zip files you've included on page 1. Are they meant to be flashed in Recovery? I ended up just enabling Systemless Hosts, then setting the categories in Unified Hosts and that seemed to work. Is that correct? I wasn't sure why the extra steps were needed. Thanks
[Magisk] Didgeridoohan:
You're doing it the right way.

The two zips attached to the OP are just the module zip and a profile for Automate, in case you want to have easy updates for the hosts file. It's not necessary...
[Magisk] birleytweet:
Ok thanks I've installed the module from Magisk. So does that mean it doesn't auto update? How do I actually get that auto update zip file to run is that via recovery? As I tried through Magisk and it said it wasn't supported. Thanks
[Magisk] Didgeridoohan:
The hosts file doesn't update automatically, no. It's quite easy to update though... Just use the bundled app.

If you want to have automatic updates, you can use the Automate profile from the OP together with Automate, or make a Tasker profile that runs the hosts command with the desired options. There's a link in the OP to one I made.
[Magisk] birleytweet:
Sorry so you mean make a task that runs the su hosts command each day or something like that? Can I just open it and hit install/update will that do the same thing?

I'd been using adaway which had been working great, but was adding several other host sources, then thought there must be a more efficient way. If those features, such as auto update and custom host lists could be added to this or even a count option to show how many times a block has occurred that would be awesome. Seems like a better option.

Others such as DNS66 and Blokada use vpn, which I think it is a bit too much
[Magisk] cmohan0004:
do i need to run su then hosts every time from terminal after turning on systemless hosts from magisk?... yesterday i turned off systemless hosts from magisk and rebooted and today i turned it on from magisk and rebooted but adblock wont work
[Magisk] Didgeridoohan:
The beauty of this module (IMHO) is it's simplicity. If you want bells and whistles, use AdAway. You can point it towards the hosts source this module uses (link in the OP).

Every time you turn off Systemless Hosts you'll have to rerun the hosts script. Toggling Systemless Hosts option deletes any modification you've done to the hosts file...

Why do you turn off Systemless Hosts?
[Magisk] cmohan0004:
don't know why my net speed got reduced after using this module and got ok like before when i disabled it....
[Magisk] Amos91:
Must be a new hosts update, but with the standard host file enabled I cannot access the Spotify home screen / search or radio sections.

Does anyone know what to whitelist?

Tried creating a a whitelist file with a wildcard .*spotify*. With no success
[Magisk] mrbun9l3:
i had got same problem. wildcard .*spotify.* helped.
[Magisk] cmohan0004:
so it won't block youtube ads?
[Magisk] Didgeridoohan:
For anyone interested, this is the line needed in the whitelist for Spotify (if you don't want to do the .*spotify.* regex for complete and total whitelisting):

0.0.0.0 spclient.wg.spotify.com

---------- Post added at 08:46 ---------- Previous post was at 08:44 ----------

No. Use YouTube Vanced for that.
[Magisk] cmohan0004:
is there any adblocker which also blocks youtube ads since i don't want to use other youtube app...
[Magisk] andrepgaspar:
Xposed module YouTube adway
[Magisk] themrmotivator:
Check this forum out

https://xdaforums.com/apps/magisk/magisk-iytbp-youtube-vanced-t3712097
[Magisk] Sneeuwtijger:
This is about a modified YouTube app, so not what he wants ;)
[Magisk] tirges:
Thanks, I was looking for that!

I figured it was the hosts file blocking something for spotify, but no idea what to whitelist exactly, and I never got the whitelist to work with regex .

I once tried to add s.youtube.com / s2.youtube.com (to get YT's history to work) by adding variations of s*.youtube.com or *s.youtube.com, etc, but no luck...

I now have

0.0.0.0 s.youtube.com
0.0.0.0 s2.youtube.com
0.0.0.0 spclient.wg.spotify.com

which works fine

(But I'd like to know how that should look in a regex whitelist file)

Does anyone know if you can actually mix regex and non-regex in the whitelist file ?
[Magisk] thedr34m13:
Have you gotten Twitter to work? Not really sure what domains to whitelist for it. My whitelist file currently looks like this:

0.0.0.0 s.youtube.com

0.0.0.0 s2.youtube.com

0.0.0.0 spclient.wg.spotify.com

0.0.0.0 mobile.twitter.com
[Magisk] Didgeridoohan:
[MENTION=6037748]Zackptg5[/MENTION]

Looking at the above, here's an idea: run both whitelist grep commands under the same case. Only run the regex option. That should take care of both removing completely matching lines and regex matching. That way you can mix regex and non-regex with the same command and get rid of the -wr option (although probably a good idea to keep it in the code for backwards compatibility).

Simplified example:

w|wr)	if [ ! -f $WHITELIST ]; then
echo "Applying Whitelist"
grep -vxf $WHITELIST $HOST > $TEMP
mv $TEMP $HOST
fi
;;

Edit: realised after posting the below you likely don't need the current -w option at all. Regex should cover all options. Edited the post to match...
[Magisk] Didgeridoohan:
Realised I was gonna answer this as well, but forgot...

Something like this should work for your case:

.*[^ad]s.*.youtube.com
0.0.0.0 spclient.wg.spotify.com

And then just use the regex option.
[Magisk] Zackptg5:
It's true that regex is all you need but I kept non-regex for any newer users not comfortable with regex and just want a straight list of domains (plus they may be copying and pasting it from somewhere)
[Magisk] Didgeridoohan:
I understand what you mean, but even with the regex option you can use the full lines from non-regex. The dots in "0.0.0.0" and the domain will just be interpreted as "any single character", in this case: dots. :D
[Magisk] Manu99:
I can't get regex or non-regex whitelist working. I would use it just for Spotify. However why block entirely Spotify if that stops the app functionality?

Update:

Ok forget that I get how to use regex and non-regex lines. However still remain my question on the motivation (just curious)
[Magisk] Didgeridoohan:
https://github.com/StevenBlack/hosts/issues/552
[Magisk] TheMDJ:
how to re-enable this app after disabling it I am not able enable it
[Magisk] guest4711:
MagiskManager -- (Hamburger menu --) Modules. Mark the module as active. Reboot (Three-Dots-Menu).
[Magisk] tirges:
Sorry, not a twitter user, I have no idea ;)

Thanks for the effort, but it doesn't seem to work.

Please never get rid of non-regex, as that is indeed the case ;)

I've tried to follow some guidelines from here https://www.icewarp.com/support/online_help/203030104.htm

but it only confuses me more ... :eek: ( "^s[0-9]?".youtube.com ) :confused:
[Magisk] jjakajonas:
Sorry for the drop in, in the mittle of something whit out research...

But what is the talk about getting twitter to work?

Is it a thing about using twitter while the social media filter is on?

Because that's a thing I have been working a bit on for some time a go and got a little stuck in the research.

I got the Twitter app to fully work but maybe also opened up for some kind of access for ads.

Not sure about the last part but yeah.. It works.
[Magisk] diavol90:
This modulo don't work anymore. Ads isn't block.
[Magisk] Didgeridoohan:
Uhm... Yes it does...

Have you by any chance toggled Systemless Hosts in the Manager settings? If so, you need to redo the hosts download.

But, that's just guessing on my part. You need to be more precise if you expect any better help.
[Magisk] raazarellian:
As of now, I'am using adaway with the additional host from StevenBlack, and some popup host and some other.

so, i've been wondering. Is it gonna work well if I use both adaway and this magisk module?

and, probably in the future, maybe adding the feature to add more custom host like adaway will be very helpful. Thanks
[Magisk] Zackptg5:
Heads up everyone, steven black removed the Spotify line that was causing issues for many users. Any hosts updates should have that fixed
[Magisk] Didgeridoohan:
They both do the same thing, edits the hosts file, so choose one or the other...

And Steven Black's hosts already includes Adaway.
[Magisk] Lasius_N:
fakenews? Wait, it blocks CNN? I have to try this.
[Magisk] Nevermindthelabel:
That makes no sense, but you can Uninstall through Magisk manager or disable systemless hosts in Magisk
[Magisk] htc-3333:
Heh, Magisk Manager doesn't start 'cause of the problem mentioned above.
[Magisk] Didgeridoohan:
In that case you can flash the Mount Magisk script in TWRP and manually remove the module from /magisk in the TWRP file manager. You'll find the script in the Collection of Magisk modules thread.
[Magisk] htc-3333:
All problems have gone after removing the folder unifiedhostsadblock in magisk.img

Will continue use regular hosts.

Good idea, but bad implementation of module.
[Magisk] MoHuToP:
My test devices is i9300 with latest 7.1.2 and M7 stock GPE 5.1.1 . On both devices, hosts working amazingly good!
[Magisk] Zackptg5:
Thats not a module issue. All it does is add 2 files to system/bin. What you're experiencing sounds like a typical magisk issue/bug that's resolved in 1 of 3 ways:

Disable magisk BusyBox

Disable magisk hide

Disable battery optimization for magisk manager
[Magisk] sftblaze:
Hi!

How would one go about removing stuff once installed? Turning it off nor uninstalling won't help. Do i really have to revert it manually?

The problem is, that i had no clue "social" would block one out of sites like Instagram or Twitter completely...

Edit; Can't even use discord invite links? Bit too harsh on the blocking?

Thanks
[Magisk] Zackptg5:
Just rerun the hosts script and it'll overwrite your old hosts file (read the op :) )
[Magisk] sftblaze:
So using the same parameter will remove? If so, i tried. Nothing. I've removed it through host entries remover.
[Magisk] Zackptg5:
If for example, you were using fgps and you no longer want to use social, then run the hosts script and enter the options: fgp and it'll overwrite the hosts file and eliminate social entries.

Alternatively, you can do some investigative work to find out which lines in the hosts file are blocking the stuff you want and add them to the whitelist file
[Magisk] sftblaze:
Didn't seem to do it for me, but will try fiddling with those options. I have it all running just the way i want currently after redoing. Impressive lists, great module. Appreciated :good:
[Magisk] Zackptg5:
What all did you do so far with hosts stuff?
[Magisk] MaFi0s0:
Is it possible to add the functionality of wildcards?

I know a lot of hosts such as the 207.net domains need it. I remember one hosts file has a domain with 1000 subdomains in it.

---------- Post added at 02:34 AM ---------- Previous post was at 02:30 AM ----------

Is it possible to add the functionality of wildcards?

I know a lot of hosts such as the 2o7.net domains need it. I remember one hosts file has a domain with 1000 subdomains in it.

I have also blocked 2o7.net domains that are not on https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts such as my banking app.

Otherwise its probably not a good idea to rely on the hosts file alone and also use AdGuard which supports wild cards.
[Magisk] Zackptg5:
It should be, I'll try to add that in the next release
[Magisk] rignfool:
So... I've been futzing... And I've noticed something...

When BusyBox ain't happy... Magisk ain't happy...

So I'm wondering aloud... Do we think that the issue with your module could be the fact that one of the 2 applets you push could be used mistakingly by the system on boot since you're pushing to the higher priority bin directory?

Would it be possible to have the applets pushed to another directory and then have your hosts script call them directly from the location that isn't in the PATH?
[Magisk] veez21:
He could put it at xbin which is lower than bin or he could put it anywhere in the module directory and just alias it in the script

[MENTION=6037748]Zackptg5[/MENTION]

alias wget="/path/to/wget"
[Magisk] Zackptg5:
That is quite possible and a good idea. I'll do that in the next version. Thanks guys :)
[Magisk] Zackptg5:
v2.0 released! See OP for changes. Hopefully this will fix some of the busybox related issues
[Magisk] MaFi0s0:
Thanks, that would be really great especially if you can really do it by next release.

A lot already allow *.host but I have also found use with the reverse such as subdomain.* and on my desktop block hosts such as *track* which helps sometimes.
[Magisk] Zackptg5:
Already did with v2.0. Just use 'wr' option and you can use wildcard stuff. The script uses grep for this so follow grep documentation for wildcards
[Magisk] luminoso:
Does this module block in-app ads? I keep seeing ads inside Sync.me and others
[Magisk] guest4711:
As discussed earlier (a lot of times) it blocks all advertising called using a domain address (e.g. https://bad.guy.com.tw/adv04.jpg), but not those called using an ip address (e.g. https://8.8.8.8/adv5.jpeg).
[Magisk] Jaymin.0.1910:
A good way for that is to run nslookup on each line and append all their servers to the original hosts file. I don't know about [MENTION=4470081]topjohnwu[/MENTION]'s, but [MENTION=1143630]osmosis[/MENTION]' BusyBox does have nslookup

EDIT: The hosts script might be updated to process the original hosts file after downloading it
[Magisk] TheMDJ:
I know it. it's on what I mean is that after toggling system less Host option it disabled and it wasn't getting on by doing same
[Magisk] suvamroy:
Its not working anymore. Using OnePlus 5t oos ob6.
[Magisk] aj38584:
Working for me atleast..i am on the same oos
[Magisk] Lasius_N:
I decided to try it since adaway didn't block YouTube ads even after the most recent update, but i got the same results with UAB - not blocking YouTube ads.
[Magisk] Didgeridoohan:
AdAway and this module do the same thing, so you won't see any difference in that regard.

Use YouTube Vanced.
[Magisk] Lasius_N:
Thanks. So what are the benefits of using this magisk module over adaway (besides additional filterlists obviously)?

Ps. I can't install that one through magisk. It only says processing..
[Magisk] Didgeridoohan:
I like the module over the app because it's simpler and very reliable. Everything you can do with this module can also be done with AdAway (and a few more things in the app). It's a matter of personal preference really...

About the YouTube module, let it sit on processing for a while. It's relatively large and it can take some time.
[Magisk] Lasius_N:
Will do, thanks!
[Magisk] laviniu_c:
anyone else having issues with whitelisting facebook? with social ticked i can't open it in browser (app and messenger seem to work) but i get the connection refused error :( in chrome

tried to whitelist

.*facebook.*

.*fb.*

.*fbcdn.*

.*tfbnw.*

.*fbsbx.*

.*akamaihd.*

... still didn't work
[Magisk] Seagold:
Same here. I have to remove it

---------- Post added at 12:19 AM ---------- Previous post was at 12:16 AM ----------

I'm yet to understand how it works
[Magisk] cognitivedissonance:
Hi there, I'm trying to determine whether to use this module or AdAway. I'm new to Magisk (used SuperSU on my Pixel 2 XL) but based on what I'm seeing, the modules remind me of the way Xposed worked.

I guess my main thing is which one is going to allow me to more effectively block ads, update the hosts lists automatically (and without a computer) and not trip Safety Net. I've used AdAway to do this for years, sometimes loading alternative lists that were well maintained. Occasionally I'd turn on that feature that would help me find and block an unlocked ad (forget the name right now.) Does this module have that feature?

Also, I saw stuff about using a command line (presumably adb?) in the OP, but then while looking around for how to setup AdAway in a way that wouldn't trip SN, I found a comment from a user who stated that the app now has a GUI and no longer relies on adb. Is that accurate?
[Magisk] Didgeridoohan:
You can point AdAway both towards the Magisk systemless hosts file (/sbin/.core/img/.core/hosts) and the hosts source used by this module. That way you can keep what you're used to, with automatic updates and so forth...

For the module you can use the provided app if you prefer a GUI, or the script (through a terminal emulator, no adb required). With the script you could set up automatic updates by using the options described in the OP and an automation app like Tasker or automate.

With both AdAway and the module you can create both a whitelist and a blacklist for removing or adding a block for a domain.

Personally, I very much prefer the module over AdAway.