yashsingh1/xdaforums huggingface dataset:
[Windows 10, 8, 7, XP etc.] Makorus:
Never heard of such an issue and never experienced this issue myself. What exactly happens when you have apply a modified hosts file? Do you get blank pages or do you get a message like "page not found"?

Huh, I didn't know YouTube videos get marked as viewed at all, haha! :p

I'd recommend the following steps:

Disable your modified hosts file and load the default/empty hosts file

Flush your DNS cache (cmd --> ipconfig /flushdns)

Download and execute the following tool: http://www.nirsoft.net/utils/dns_query_sniffer.html

Go to youtube.com and watch a video

Now check the output from the DNS sniffer tool and whitelist those hostnames you see there
[Windows 10, 8, 7, XP etc.] gothicVI:
So it was the following that belongs to the white-list:

s.youtube.com
[Windows 10, 8, 7, XP etc.] Makorus:
Great, thank you for your reply! I'll add that line to the default whitelist file so everyone can profit from it. :)
[Windows 10, 8, 7, XP etc.] gothicVI:
You're welcome.

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] Makorus:
Do you guys have any feature requests? :P
[Windows 10, 8, 7, XP etc.] gothicVI:
Maybe automatic replacement of the host file after creating a backup of the existing one.

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] Makorus:
Great idea, I'll add this feature and release a new version very soon (maybe within one week). Thank you for your suggestion! :)
[Windows 10, 8, 7, XP etc.] Makorus:
Hi everyone!

Couldn't wait to work on a new version, so I worked on version 1.6.0. I just released it, go check it out!

Oh and I tried to create a new logo instead of the default PowerShell icon. I know it looks ridiculous, I've never been good at art and all that stuff. Any feedback is appreciated. :P
[Windows 10, 8, 7, XP etc.] gothicVI:
You might want to update the change log [emoji6]

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] Makorus:
Hi there!

It's already updated, check it out: http://xdaforums.com/showpost.php?p=60616286&postcount=2
[Windows 10, 8, 7, XP etc.] gothicVI:
I'm sorry sir. Looked in the past releases change log! My bad!

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] Makorus:
Absolutely no problem. I hope you enjoy the new release. :)
[Windows 10, 8, 7, XP etc.] the-light:
Hi

first of, many thx for your efforts and sharing your knowledge and work

i love android adaway and was pleased to find it for windows, but, it is probably me, after running the ps adblock and restarting pc, on my browser , ads still popup(when disabling adblock)im on firefox browser. am i doing something wrong? would you considered put an install notes for this?

thank you
[Windows 10, 8, 7, XP etc.] gothicVI:
Did you check if your system's hosts file got replaced properly?

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] the-light:
solved. run with administrator permission. awesome, no more "pls dont adblock" banners
[Windows 10, 8, 7, XP etc.] the-light:
Hi. Unfortunately there are some important pages I cannot reach since I've updated with adaway, I even cannot log to this forum.... Im quite a noob with host files and such. Will you explain how am I white listing hosts and where, and, is there a way to uninstall if things not working out for me. Many thx
[Windows 10, 8, 7, XP etc.] gothicVI:
What sources are you using?

To solve:

Aktivate logging in adawy. Visit blocked sites. Go to log and long press the corresponding entry to add it to white list. Refresh, aktivate and reboot.

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] the-light:
Hi gothicVI

thx for your prompt reply

pages wont load randomly, not necessarily with log options. after i restart pc , some of them are loading.

is there a way to uninstall adaway?

it usually works great, but i have no shell knowledge:confused:
[Windows 10, 8, 7, XP etc.] kongwong82:
Thanks! It works perfectly fine.

If I would like to unblock all ads, what should i do?
[Windows 10, 8, 7, XP etc.] gothicVI:
Now I'm confused. Do you have problems to get it working on a PC or on android? This here is for windows os PCs, yet you mentioned adaway which is for android. Please clarify.

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] the-light:
Hi. windows pc.

some pages like news with payment wall which im subscribed to, wont load. but i must say this is random.sometimes it does load, i had no issues with this kind of behavior before running adaway, that's why i want to try and uninstall, and see if problems persist. i had to send previous msg here with my android, for i had trouble login xda with pc, but now it works. thank you for your patience and help.
[Windows 10, 8, 7, XP etc.] gothicVI:
So it's working now? That's good to hear [emoji106]

Gesendet von meinem Moto G 2014 LTE mit Tapatalk
[Windows 10, 8, 7, XP etc.] Makorus:
Sorry guys, I've been very busy these days.

I just released version 1.6.1 of psAdBlock. It contains a very small change, I forgot to update the version number which lead to wrong version outputs in the log files. :p

I'll be busy for the next month as well, but I plan to start working on version 1.7.0 (maybe in June).

I just had an amazing PowerShell class where I could learn a lot. I want to rework version 1.7.0 as much as possible with my new PowerShell-knowledge. I'm sure this will be a lot of fun. :D

Are you guys experiencing any issues with this script? Are there any feature requests?
[Windows 10, 8, 7, XP etc.] SirRasor:
hosts file so small

Hello there!

I'm just wondering about something.

I just used your script to generate hosts files. It became ~1 MB

At the same time I generated one with adaway, and it is almost 2 MBs.

:insert BUT WHY gif: :D

First I tought maybe adaway left a lot of duplicates when merging the files, but with a brief search I did not found any, so I'm clueless.

---------- Post added at 07:54 PM ---------- Previous post was at 07:49 PM ----------

To unblock all ads delete everything from hosts file and put in these two lines:

127.0.0.1 localhost

::1 localhost
[Windows 10, 8, 7, XP etc.] Makorus:
Hi there

Are you sure you're using the same "hosts"-list sources? I just checked and my file being created on Windows is 2.5 MB. On my Android device, using the same "hosts"-sources I get (almost) exactly the same file. :)
[Windows 10, 8, 7, XP etc.] SirRasor:
On Android, I didn't bothered any setting so it's all on default...hmm..I checked now, and it is only listed four links. That's one error.

But with this script (1.6.1) I didn't change anything, so it checks 6 links.

Now I'm more confused than before :D

Why isn't there ONE big hosts file host? :rolleyes:
[Windows 10, 8, 7, XP etc.] Makorus:
Try to compare the amount of lines and the amount of total characters. I assume the default AdAway list contains one "hosts"-sourcelist which is very big.

Or try to enable 2 lists on your Android device and enable the same lists on your Windows device and then compare again.
[Windows 10, 8, 7, XP etc.] Makorus:
Hi everyone

Sorry, I've been very busy these days. I'm trying to continue my work on this script and provide even more features.

Meanwhile, I've moved my script repository to GitHub. Updates coming soon... :)

https://github.com/makorus/psadblock
[Windows 10, 8, 7, XP etc.] Navuhodonosor:
Thank you for this. This is great little tool.

---------- Post added at 12:28 PM ---------- Previous post was at 11:50 AM ----------

@Makorus Hi, me again. You could use your .bat file to check for admin rights automatically. Like many users, I initially clicked on file without elevated privilegies.

Here is piece of code you can put at the top of the _run_script.bat ;)

@echo off
:: BatchGotAdmin (Run as Admin code starts)
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
:: BatchGotAdmin (Run as Admin code ends)
:: Your codes should start from the following line

It is not my brainstorming, I use it for few years without any issues. All credit goes to Evan Greene.

Good thing is that antivirus will not flag it as false positive so you could make a beta version to get some feedback.

Kudos, great stuff, keep it alive please.:good:
[Windows 10, 8, 7, XP etc.] Pipsname:
Removing http://hostsfile.org/Downloads/hosts.txt from hostslist.ini helps with *cought* porn sites not working.
[Windows 10, 8, 7, XP etc.] DepressedDead:
Damn man, many thanks for having created this. This and uBlock origin = killer combination on those sites that request you to disable the adblocker. By the way, does PSAdblock include Adaway's lists?
[Windows 10, 8, 7, XP etc.] bobbleheadhobo:
Hi, im kinda new to this and i was having some trouble trying to white list a website. Also how can i disable the ad blocking. Thanks.
[Windows 10, 8, 7, XP etc.] ashatter:
Great work!

I would like to know is it possible to add an option to run every time windows boots in background and replace hosts automatically?
[Windows 10, 8, 7, XP etc.] xquuicksilv3rgx:
Hi, How do I uninstall and/or completely remove PS Adblock and have ads again? some of the website I visit requires it and/or jobs I apply for...please help!
[Windows 10, 8, 7, XP etc.] Makorus:
Hi everyone, sorry for my very delayed reply! I've been very busy these days. I'll reply to you guys tomorrow as I'm travelling now.

To uninstall, simply delete your existing "hosts" file and rename "hosts.bak" to "hosts", reboot your PC afterwards. Let me know if it works.

Kind regards

- Makorus
[Windows 10, 8, 7, XP etc.] xquuicksilv3rgx:
Thank you!!!
[Windows 10, 8, 7, XP etc.] Makorus:
[MENTION=7985068]xquuicksilv3rgx[/MENTION]: You're welcome. :)

[MENTION=4890995]ashatter[/MENTION]: Hmm, I don't know if this is really necessary. It would slow up your boot time for some more seconds I guess, and I'm pretty sure this is not what you want. Also, I guess it is a big deal to run an application or a script with administrative privileges automatically.

[MENTION=7930003]bobbleheadhobo[/MENTION]: To whitelist a website you just have to add the domain to the existing "whitelist.ini" file, re-run the script and give it a try.

[MENTION=7136072]Pipsname[/MENTION]: Yeah and by the way: You could also whitelist those sites. :P

[MENTION=6763926]Navuhodonosor[/MENTION]: Thank you for your great input, I'll add this to the batch file.

To everyone: I'll update the code by the next week. Next update will include:

_run_script.bat administrative privileges

Error-handling for offline hosts sources (currently, the script just quits with an error)

Thank you for your patience and see you next week!
[Windows 10, 8, 7, XP etc.] BossToroech:
I would like to uninstall, but I deleted all those files and don't have this .bak. Is there an another way to unistall this?
[Windows 10, 8, 7, XP etc.] Makorus:
Hi there,

Yes of course. Remove the existing "hosts" files and copy this one from here (see attachment). Rename it to "hosts" and reboot your computer.
[Windows 10, 8, 7, XP etc.] BossToroech:
thanks for quick reply! can you tell me the localization of those existing hosts files?
[Windows 10, 8, 7, XP etc.] Makorus:
They should be located in C:\Windows\System32\drivers\etc

Kind regards

- Makorus
[Windows 10, 8, 7, XP etc.] araxhiel:
Hi!

First: thanks you for this amazing script/utility, is just awesome!

Now: I'm having a little issue/detail while executing the script as Powershell throws this message

***************************************************************************************************
Checking whether the script is being executed with administrator privileges...
Administrator privileges found!
Checking automatic 'hosts' backup routine...
Automatic 'hosts' backup is enabled!
Saving original 'hosts'-file...
Copy-Item : Cannot find path 'D:\Downloads\Applications\PS_AdBlock_V1.6.1\hosts.original' because it does not exist.
At C:\Users\<username>\AppData\Local\Temp\Quest Software\PowerGUI\8d4dea56-fd38-4199-b3dd-2979e489fa8a\PS_AdBlock_V1.6.1.ps1:696 char:8
+ Copy-Item -Path $OriginalHostsSource -Destination $Original ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (D:\Downloads\Ap...\hosts.original:String) [Copy-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

Saved original 'hosts'-file: C:\WINDOWS\system32\drivers\etc\hosts.original
Creating backup of current 'hosts'-file...

This appears regardless if I execute the EXE or the PS1 (both as administrator) and it doesn't create a backup of the original hosts file, just copy and overwrite it. Fortunately I had a backup of the hosts file so it's not a big deal, but I felt that is was worth to report.

My system:

OS Name Microsoft Windows 10 Home Single Language
Version 10.0.14393 Build 14393
System Type x64-based PC

$host.version

Major Minor Build Revision
----- ----- ----- --------
5 1 14393 953

Thanks in advance!

Best regards!
[Windows 10, 8, 7, XP etc.] kmorendha:
Thank you! Works like a charm on my Windows 7 PC! :laugh:
[Windows 10, 8, 7, XP etc.] Makorus:
Hi everyone

Wow, time passes so quickly - the last release was one year ago. I had to change that today. :P

I'm really sorry, I have been so preoccupied lately.

Anyway, new version 1.6.2 is online. There are some changes, go ahead and check out the change log.

[MENTION=8117731]araxhiel[/MENTION] thanks for reporting that, the script now handles this error case. :)
[Windows 10, 8, 7, XP etc.] saa1618:
AWESOME

Hi,

Thank you for this, I have been using Adaway with Android since Lollipop and always wished for a Windows version of Adaway!

Love,

Syed :D
[Windows 10, 8, 7, XP etc.] Makorus:
You're absolutely welcome! :)

We share the same history; I also started using AdAway first and I always missed a similar solution for my Windows PC. :cool:
[Windows 10, 8, 7, XP etc.] mika2507:
Hi, may i ask how to uninstall this on my pc.. Thanks..
[Windows 10, 8, 7, XP etc.] Makorus:
Hi there, yes of course. I wrote about the uninstall process in the FAQs.
[Windows 10, 8, 7, XP etc.] law.tout@gmail.com:
sorry if i missed this but how is the mal-list in the hosts file updated to include new offenders?
[Windows 10, 8, 7, XP etc.] Makorus:
Hi there

Well basically the hosts list isn't updated automatically, so you have to manually re-run the script. Everytime you run this script the hosts files from your chosen source list (hostslist.ini) are being re-downloaded and merged again.

If you want to add an own source, simply add it to the previously mentioned file.

If you want to block a specific site, simply create a new .txt file in your DL_Cache folder and put the sites in that file. Run the script again and you should be fine.

I hope I was able to help. Otherwise just let me know again, I'm happy to help.

Kind regards

- Makorus
[Windows 10, 8, 7, XP etc.] law.tout@gmail.com:
Thats great thx.

Am i right in saying a web browser will 'open' any of the blocked sites with the following message :

"This site can’t be reached

server DNS address could not be found.

Search Google for onlinewebfind

ERR_NAME_NOT_RESOLVED"
[Windows 10, 8, 7, XP etc.] Makorus:
Absolutely, you're being redirected to localhost. As there's no http service running on your local computer, you face that error message, which is perfectly fine.

Kind regards

- Makorus
[Windows 10, 8, 7, XP etc.] Makorus:
A late happy new year to everyone! :)

I just released version 1.6.3 with a few small changes.

I'm gradually moving this project completely to GitHub, therefore there's no need for an additional VirusTotal scan. Downloads will be moved to GitHub from now on. Contribution to this project is now even easier. :)
[Windows 10, 8, 7, XP etc.] criza:
Awesome! :):o:D
[Windows 10, 8, 7, XP etc.] patrickdrd:
I run the script twice and it got stuck both times in "applying",

the first time it created the file, on the second no,

Checking whether the script is being executed with administrator privileges...
Administrator privileges found!
Checking automatic 'hosts' backup routine...
Automatic 'hosts' backup is enabled!
Original 'hosts'-file already found!
Creating backup of current 'hosts'-file...
Saved current 'hosts'-file: C:\Windows\system32\drivers\etc\hosts.old
Checking automatic 'hosts' apply routine...
Automatic 'hosts' apply is enabled!
Applying new 'hosts'-file...

edit: my bad, I was testing hozz at the same time and I think it was blocking your script

edit2: still doesn't finish, powershell reaches around 800mb in memory,

the hosts file (5mb) is created, but powershell is stuck there

edit3: ok, I'll be running the user script and I'll be doing the "distribution" myself

Finished the PowerShell AdBlock script!
Elapsed time: 329.9136152 seconds
Press any key to continue . . .
[Windows 10, 8, 7, XP etc.] araxhiel:
I experienced a similar behavior when I started to use the script, and it was because a process was using the hosts file and _somehow_ the whole process went into a deadlock condition. IIRC it was an Skype associated process (on Windows 10).

But, despite that it seems that you've probably solved the issue (or done a workaround) have you reviewed the log file to see if there was any additional information about what went wrong? That could help to improve the script.
[Windows 10, 8, 7, XP etc.] patrickdrd:
yes,I agree, it should be something running in the background, anyway, I checked the log file, error wasn't recorded
[Windows 10, 8, 7, XP etc.] araxhiel:
Huh? That's weird... Well, I guess it was that kind of scenarios where the phrase "blink and you miss" applies :/

Thanks anyway!

Best regards!
[Windows 10, 8, 7, XP etc.] patrickdrd:
I would change the script a bit though,

i.e. why do I need the output sorted?

I don't see how this is necessary, the same goes to trimming,

are there any options/flags to disable this functionality?
[Windows 10, 8, 7, XP etc.] araxhiel:
As for the trimming, my best guess is that during the removal of the comments that are present on the sources, there are left some white spaces that are useless. So, in order to reduce the size of the file (how much depends on how many white spaces are left after the removal, and how many white spaces are present in the original source) is necessary to apply that.

But, with the sorting... Well, I can't give a proper answer as I'm somewhat biased about this, as I prefer having the information/content sorted... I guess that OP have a similar preference.

Currently, there aren't options/flags to disable both behaviors, and although I think that implement such functionality could be doable (AFAIR the code), it need to be reviewed by OP...
[Windows 10, 8, 7, XP etc.] patrickdrd:
hostsman I was using before is way faster and sorry but I'm going back to it
[Windows 10, 8, 7, XP etc.] androcraze:
Trimming whitespace (blanks and tabs), removing comments/non-essential data, and sorting the final consolidated lines are to prepare for the big finale: the uniq/unique command.

The uniq command removes all of the duplicate entries, and it can't do that without a "sort" occurring before its execution.

https://docs.microsoft.com/en-us/po...wershell.utility/get-unique?view=powershell-6

"The Get-Unique cmdlet compares each item in a sorted list to the next item, eliminates duplicates, and returns only one instance of each item. The list must be sorted for the cmdlet to work properly."

https://www.lifewire.com/learn-the-linuxunix-command-uniq-4092623

uniq - remove duplicate lines from a sorted file

Keeping the comments in place and trying to remove duplicates would be impossible.... How is the command/tool -- used to remove the duplicate entries -- supposed to determine what comments belong with what servers?

If I had 100 server entries in a hosts file, I'd comment like crazy; when you're dealing with anywhere from 10,000 to 50,000 or more, it would be foolish to try.
[Windows 10, 8, 7, XP etc.] Makorus:
Sorry for my late reply guys, I somehow totally missed all these notifications.

[MENTION=5061138]androcraze[/MENTION] is absolutely right.

Sorting is required so I can use the "Get-Unique" command to remove duplicate entries. Of course, there are other approaches which don't require a sort function first. But I already tried them and I found them to be waaaaay slower than this approach - and they're not as accurate as the "Get-Unique" command.

In my opinion, removing the comments is also necessary, although not mandatory. Just like [MENTION=5061138]androcraze[/MENTION] mentioned, there's no point in keeping the comments as the entries are being sorted anyway. Sorting and keeping all the comments is almost impossible. Same goes for trimming white spaces; By doing so, you'll save a few MB. The bigger the file, the slower might be your computer in the end.

Anyway, you still have all the comments in the original files which can be found within the "DL_Cache" folder. Go have a look to that if you need to find a specific comment.

[MENTION=6532336]patrickdrd[/MENTION] if you'd like, I could assist you in debugging that issue on your computer. I've never experienced that before, so I can just make assumptions, but right now I don't have an idea what it could possibly be. Just let me know if you decide to give it another try, glad to help here.
[Windows 10, 8, 7, XP etc.] Makorus:
Quick and short update: I added two more hosts source lists. I highly recommend using them:

- https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt

- https://raw.githubusercontent.com/greatis/Anti-WebMiner/master/hosts

These providers collect cryptominer host addresses to block them easily without getting affected at all. Highly recommended!

One more thing: I moved the entire "version history" section from the main PowerShell script to the README.md file so you can instantly see the change log by visiting my GitHub repository.
[Windows 10, 8, 7, XP etc.] araxhiel:
Nice! Thanks for the update!
[Windows 10, 8, 7, XP etc.] Makorus:
My pleasure!

By the way, I'm trying to reproduce [MENTION=6532336]patrickdrd[/MENTION]'s error. I've got an idea.

EDIT: [MENTION=6532336]patrickdrd[/MENTION] can you try this?

Grab the most recent files from my GitHub repository, then change the following lines (line #16 and #19):

#Automatic 'hosts' backup routine, set to "$false" to disable
New-Variable "HostsBackup" -Option "Constant" -Value "$true"

#Automatic 'hosts' apply routine, set to "$false" to disable
New-Variable "HostsAutoApply" -Option "Constant" -Value "$true"

#Automatic 'hosts' backup routine, set to "$false" to disable
New-Variable "HostsBackup" -Option "Constant" [B][COLOR="Red"]-Value "$false"[/COLOR][/B]

#Automatic 'hosts' apply routine, set to "$false" to disable
New-Variable "HostsAutoApply" -Option "Constant" [B][COLOR="Red"]-Value "$false"[/COLOR][/B]
[Windows 10, 8, 7, XP etc.] patrickdrd:
I had two issues: the first was the fail to save the hosts file to the system32/etc folder and

the second was the delay (and the huge resources used),

which is this change related? I guess the first?

anyway, I can't do that now, because I'm at work, maybe later
[Windows 10, 8, 7, XP etc.] Makorus:
Great news guys: Version 1.6.5 is available on GitHub. I fixed a very silly (but not critical) issue, which lead to a semi-wrong patch table replacement (see change log on GitHub for further information).

For some reason I'm not getting any notifications from XDA anymore. I totally missed your message and just saw it as I was about to announce a new version.

I'm just wondering whether disabling these features solves the issues on your system. I guess you have a software running on your system which is interfering. However, can you try using the newest version 1.6.5 and disable the features as previously mentioned?