Author |
Message |
sc0ttman

Joined: 16 Sep 2009 Posts: 2572 Location: UK
|
Posted: Sat 28 Aug 2010, 12:41 Post subject:
Advert-Blocker 0.5 Subject description: easy GUI to remove online ads |
|
Pup-Advert-Blocker
block many online ads in any browser
This tool will download a list of known advertising servers and add them to your "/etc/hosts" file - blocking them from you.
Then you can browse the web without seeing or downloading a large number of popular and very annoying online ads
This tool is very simple, but does the trick nicely, I think.
Using all services currently blocks around 30,300 ad servers (Aug 2010)
Suggestions and improvements still welcome.
Changelog:
version 0.5
- added a fix I accidentally un-added!
- changed detection of empty list
- cleaned the code a tiny little bit
- added a timeout to wget (avoids endless pausing)
version 0.4
- added (only some of) Barry Ks bugfixes (whoops! fixed in v0.5)
version 0.3
- fixed duplicate removal (using dos2unix to convert carriage returns)
- updated help GUI
version 0.2
- added more servers
- servers can be combined or chosen separately
- ads can be disabled by not selecting any servers
- (duplicates are still found in the final built list!)
(Thanks to this thread) (thx 2 lguleder etc)
 |
Description |
|
Filesize |
40.7 KB |
Viewed |
6714 Time(s) |

|
Description |
version 0.5
|

Download |
Filename |
pup-advert-blocker.pet |
Filesize |
3.13 KB |
Downloaded |
3156 Time(s) |
Description |
version 0.4
|

Download |
Filename |
pup-advert-blocker.pet |
Filesize |
3.15 KB |
Downloaded |
1416 Time(s) |
Description |
version 0.3
|

Download |
Filename |
pup-advert-blocker.pet |
Filesize |
2.99 KB |
Downloaded |
1395 Time(s) |
Description |
version 0.2
|

Download |
Filename |
pup-advert-blocker.pet |
Filesize |
3.03 KB |
Downloaded |
1311 Time(s) |
Description |
version 0.1
|

Download |
Filename |
pup-advert-blocker.pet |
Filesize |
2.74 KB |
Downloaded |
1329 Time(s) |
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
Last edited by sc0ttman on Thu 02 Sep 2010, 01:34; edited 16 times in total
|
Back to top
|
|
 |
Iguleder

Joined: 11 Aug 2009 Posts: 2031 Location: Israel, somewhere in the beautiful desert
|
Posted: Sat 28 Aug 2010, 12:44 Post subject:
|
|
Once of those moments when I wonder why the forums don't have a "like" button
Goo'job!
_________________ My homepage
My GitHub profile
|
Back to top
|
|
 |
chrismt

Joined: 21 Apr 2010 Posts: 255
|
Posted: Sat 28 Aug 2010, 13:10 Post subject:
|
|
@ Scottman
Thanks!
This is what I was asking someone to make
You can learn a lot of things from Hostsman, a windows Hosts Manager that blocks ads and malware
Here
http://www.abelhadigital.com/hostsman
This PET. is my favorite!
You can also add more adblock hosts providers like MVPS etc
You not only block ads but also malware sites in Windows with Hostsman because it has got many hosts providers as default.
You can even update all the hosts providers automatically and delete duplicates
Check it out!
Regards
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4787 Location: Kingwood, TX
|
Posted: Sat 28 Aug 2010, 17:08 Post subject:
|
|
I made a simple command line script that will integrate both lists and sort the duplicates out (the commented out line also removes some know adult content)
Code: | #!/bin/sh
wget -c -O hosts1 http://sysctl.org/cameleon/hosts
wget -c -O hosts2 http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext
#wget -c -O hosts3 http://www.mvps.org/winhelp2002/hosts.txt #removes adult content
cat /etc/hosts hosts1 hosts2 hosts3 |grep ^[1-9] |sed "s/\t//g"|sort |uniq >/etc/hosts
#rm -f hosts1 hosts2 |
other possible host lists:
http://my.opera.com/Tamil/blog/ad-block
http://code.google.com/p/fanboy-adblock-list/source/browse/
http://www.technobeta.com/download/urlfilter.ini
http://my.opera.com/Ghostshaw/blog/
http://www.technobeta.com/download/urlfilter.ini
here is the link for adblock plus, but it will require some manipulation to make it work
https://easylist-downloads.adblockplus.org/easylist.txt
https://easylist-downloads.adblockplus.org/easyprivacy.txt
more here: http://adblockplus.org/en/subscriptions and here:
http://easylist.adblockplus.org/
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2572 Location: UK
|
Posted: Sun 29 Aug 2010, 13:32 Post subject:
|
|
version 0.2 released - see main post.
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4787 Location: Kingwood, TX
|
Posted: Sun 29 Aug 2010, 14:17 Post subject:
|
|
Nice work!
Bugfix#1 Code: | cat /tmp/adlist1 /tmp/adlist2 /tmp/adlist3 /tmp/adlist4 |grep ^[1-9] |sed "s/\t//g"|sort |uniq -u | leave off the -u from uniq otherwise you will miss anything that is on more than one list
Bugreport
in order for lines to be seen as true duplicates, the formatting has to be exactly the same (uniq compares the entire line as a string), so you may need to pass it through sed a couple of times to replace combinations of tabs/spaces/etc... with a single space in all entries and no trailing tabs/spaces possibly leading tabs/spaces as well
sed 's/[ \t]*/ /' #replace combinations of tabs/spaces with a space
sed 's/[ \t]*$//' #remove trailing spaces/tabs
sed 's/[^ \t]*//' #remove leading spaces/tabs
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2572 Location: UK
|
Posted: Sun 29 Aug 2010, 19:02 Post subject:
|
|
updated to 0.3
all duplicates now removed from hosts file automatically
I personally think this (or similar) should be included in Puppy, not because I made it of course, but because it makes browsing soooooo much faster and less annoying!
thanks for the help guys
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
BarryK
Puppy Master

Joined: 09 May 2005 Posts: 8529 Location: Perth, Western Australia
|
Posted: Sun 29 Aug 2010, 20:59 Post subject:
|
|
Hi, great app, I posted a bug fix for 0.3:
http://bkhome.org/blog/?viewDetailed=01777
_________________ http://bkhome.org/news/
|
Back to top
|
|
 |
jemimah

Joined: 26 Aug 2009 Posts: 4309 Location: Tampa, FL
|
Posted: Sun 29 Aug 2010, 23:28 Post subject:
|
|
Nice. I've added it to Puppeee and Fluppy.
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2572 Location: UK
|
Posted: Mon 30 Aug 2010, 01:42 Post subject:
|
|
version 0.4 is out..
Added Barry Ks bugfixes.. but removed hard-coding of app title.
Thanks for the help!
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4787 Location: Kingwood, TX
|
Posted: Mon 30 Aug 2010, 04:14 Post subject:
|
|
I adapted it for standard dialog for the minimalist puppies using PupnGo. This will work with dialog on the command line or Xdialog (gtk1 or gtk2) in X, but not as pretty either way (I removed any non-essentials to work with dialog) Code: | #!/bin/sh
[ -z $DISPLAY ] && DIALOG=dialog || DIALOG=Xdialog
for x in `$DIALOG --stdout --checklist "Choose your ad blocking service(s)" 0 0 4 1 "mvps.org" ON 2 "systcl.org" ON 3 "technobeta.com" ON 4 "yoyo.org" ON |tr "/" " " |tr '\"' ' '`; do
case $x in
1)wget -c -4 -t 0 -O /tmp/adlist1 'http://www.mvps.org/winhelp2002/hosts.txt';;
2)wget -c -4 -t 0 -O /tmp/adlist2 'http://sysctl.org/cameleon/hosts';;
3)wget -c -4 -t 0 -O /tmp/adlist3 'http://www.technobeta.com/download/urlfilter.ini';;
4)wget -c -4 -t 0 -O /tmp/adlist4 'http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext';;
*)echo $x;;
esac
done
touch /tmp/adlist{1,2,3,4}
cat /etc/hosts /tmp/adlist{1,2,3,4} |grep ^[1-9] |sed '/^$/d' |sed "s/\t/ /g"|sed '/^#/d' |sed 's/ / /g' |dos2unix -u |sort |uniq > /etc/hosts
rm -f /tmp/adlist{1,2,3,4} |
Edit: this one should work better
Code: | #!/bin/sh
[ -z $DISPLAY ] && DIALOG=dialog || DIALOG=Xdialog
[ ! -f /etc/hosts.usr ] && touch /etc/hosts && cp -f /etc/hosts /etc/hosts.usr #echo 127.0.0.1 localhost puppypc >/etc/hosts #r1 maybe user added others
for x in `$DIALOG --stdout --checklist "Choose your ad blocking service(s)" 0 0 5 1 "mvps.org" ON 2 "systcl.org" ON 3 "technobeta.com" ON 4 "yoyo.org" ON 5 "turn off adblocking" off |tr "/" " " |tr '\"' ' '`; do
case $x in
1)wget -c -4 -t 0 -O /tmp/adlist1 'http://www.mvps.org/winhelp2002/hosts.txt';;
2)wget -c -4 -t 0 -O /tmp/adlist2 'http://sysctl.org/cameleon/hosts';;
3)wget -c -4 -t 0 -O /tmp/adlist3 'http://www.technobeta.com/download/urlfilter.ini';;
4)wget -c -4 -t 0 -O /tmp/adlist4 'http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext';;
5)ln -sf /etc/hosts.usr /etc/hosts && exit;;
*)echo $x;;
esac
done
touch /tmp/adlist{1,2,3,4}
cat /etc/hosts.usr /tmp/adlist{1,2,3,4} |sed 's/^[ \t]*//' |sed 's/\t/ /g' |sed 's/ / /g' |grep ^[1-9] |dos2unix -u |sort |uniq > /etc/hosts.adblock
ln -sf /etc/hosts.adblock /etc/hosts |
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
Last edited by technosaurus on Mon 30 Aug 2010, 22:03; edited 4 times in total
|
Back to top
|
|
 |
abushcrafter

Joined: 30 Oct 2009 Posts: 1438 Location: England
|
Posted: Mon 30 Aug 2010, 08:16 Post subject:
|
|
Could you add the option to disable ad blocking please. So when one is on sites like lastfm there services like there player works.
_________________ adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2572 Location: UK
|
Posted: Mon 30 Aug 2010, 08:38 Post subject:
|
|
abushcrafter wrote: | Could you add the option to disable ad blocking please. So when one is on sites like lastfm there services like there player works. |
My GUI already has that feature. Just don't select any lists and click Start'.
You just need to restart your browser, I think..
The code above, by techonosaurus, probably just needs the '/etc/hosts' part removed from the 'cat' command, in order to enable the removal of all ad lists (I think - correct me if I am wrong!)
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
abushcrafter

Joined: 30 Oct 2009 Posts: 1438 Location: England
|
Posted: Mon 30 Aug 2010, 08:51 Post subject:
|
|
sc0ttman wrote: | abushcrafter wrote: | Could you add the option to disable ad blocking please. So when one is on sites like lastfm there services like there player works. |
My GUI already has that feature. Just don't select any lists and click Start'.
You just need to restart your browser, I think..
The code above, by techonosaurus, probably just needs the '/etc/hosts' part removed from the 'cat' command, in order to enable the removal of all ad lists (I think - correct me if I am wrong!) | Great!
_________________ adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
|
Back to top
|
|
 |
sc0ttman

Joined: 16 Sep 2009 Posts: 2572 Location: UK
|
Posted: Mon 30 Aug 2010, 09:22 Post subject:
|
|
Not so great.. I'm dumb.. Removing the /etc/hosts from technosaurus' code will just break it and do weird things..
But you can do it in mine, that was correct at least..
_________________ Akita Linux, VLC-GTK, Pup Search, Pup File Search
|
Back to top
|
|
 |
|