Advert-Blocker 0.5

Browsers, email, chat, etc.
Message
Author
User avatar
chrismt
Posts: 255
Joined: Wed 21 Apr 2010, 04:37

#16 Post by chrismt »

version 0.4 is giving me an error

I selected all the list and I tried to update

After some time, a dialog box popped up showing that none has been selected

And, after some seconds when I closed the first box, another dialog popped up saying, all are updated

But when I checked the Hosts, I find that nothing is updated

fyujj
Posts: 102
Joined: Sat 04 Apr 2009, 17:40

#17 Post by fyujj »

technosaurus, sc0ttman or whoever, could you adapt the script to use yad?
I'm using Debian and wouldn't like to install gtkdialog or xdialog since they're considered deprecated.

User avatar
sinc
Posts: 545
Joined: Wed 22 Jul 2009, 20:35
Location: Tampa, FL USA

#18 Post by sinc »

chrismt wrote:version 0.4 is giving me an error
same error here. v.4 not working right.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#19 Post by technosaurus »

Yad pet is here:
http://www.murga-linux.com/puppy/viewtopic.php?t=58306
for my version all you need to do is have yad output to stdout any combination of ...
1 2 3 4 5

and place it into
`Xdialog ... ...`

zenity/yad break compatibility with the standard dialog formats that dialog, cdialog, xdialog, whiptail and kdialog all basically share in common ... so it would need to be recoded ... but you can always use the dialog version from a terminal (just get rid of the checking for DISPLAY and set DIALOG to dialog)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

fyujj
Posts: 102
Joined: Sat 04 Apr 2009, 17:40

#20 Post by fyujj »

Thank you technosaurus, that's even better (using just the terminal). I don't know bash (or whatever scripting language). I left it like this:

Code: Select all

#!/bin/sh
DIALOG=dialog || DIALOG=dialog
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}
and it showed the dialog fine in the terminal, downloaded and created fine /tmp/adlist1 to /tmp/adlist4 but then just left a blank /etc/hosts and also didn't delete those temporary files.
I have safely backed up my original hosts file so no worry regarding this. I have dos2unix installed too.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#21 Post by sc0ttman »

sinc wrote:
chrismt wrote:version 0.4 is giving me an error
same error here. v.4 not working right.
What version of Puppy are you using? Did you run in from the terminal and read its errors?
Did previous versions work?
Cos 0.4 works fine for me - I can't actually get it to fail on Puppy 4.2.1 ... :roll:
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#22 Post by BarryK »

sc0ttman,
You have not full applied my fixes.

The problem is that a line like this can break things:

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

You need to do it like this:

ETCHOSTS="`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`"
echo "$ETCHOSTS" > /etc/hosts
[url]https://bkhome.org/news/[/url]

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#23 Post by technosaurus »

sorry, that was my bad - you can't (or at least shouldn't) pipe a file back to itself (possible endless loop) - ... switched to using an original backup instead - fix posted below original code
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#24 Post by sc0ttman »

BarryK wrote:sc0ttman,
You have not full applied my fixes.
Whoops.. Updated to 0.5, all fixes added (i think!)

0.5 should work fine again now.
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
chrismt
Posts: 255
Joined: Wed 21 Apr 2010, 04:37

#25 Post by chrismt »

sc0ttman wrote:
sinc wrote:
chrismt wrote:version 0.4 is giving me an error
same error here. v.4 not working right.
What version of Puppy are you using? Did you run in from the terminal and read its errors?
Did previous versions work?
Cos 0.4 works fine for me - I can't actually get it to fail on Puppy 4.2.1 ... :roll:
I was testing this on Puppy 5.1

Version 5 is working but I am not sure if it downloaded all the 4 ticked lists because when i click the EDIT button, I can only see a few blocked address

I think, just think, it is only downloading a single list not every lists

I wish someone verified this

Thanks anyway for this cool Pet

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#26 Post by sc0ttman »

chrismt wrote:[Version 5 is working but I am not sure if it downloaded all the 4 ticked lists because when i click the EDIT button, I can only see a few blocked address

I think, just think, it is only downloading a single list not every lists

I wish someone verified this

Thanks anyway for this cool Pet
Perhaps you could download each list separately, copy the lists each time to a new text file and compare the results.

Technobeta has around 2,000 results, as does Yoyo, while the others have more like 20,000 entries..
After selecting and downloading all fours lists, I get a total of around 30,300 entries.

Or you could comment out the line in the 'cleanup' function, to see each downloaded list. (The line to comment out starts with the 'rm' command, followed by a list of the 4 downloaded ad list files).
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

Logo for Advert-Blocker

#27 Post by vovchik »

Dear scottman et al.,

Here is a nice logo for the gtkdialog script that you might consider using :)

With kind regards,
vovchik

PS. Thanks for the app.
Attachments
noplace3.png
(17.67 KiB) Downloaded 1608 times

User avatar
chrismt
Posts: 255
Joined: Wed 21 Apr 2010, 04:37

#28 Post by chrismt »

I am not a designer or anything and I am not sure if modifying an icon is pirating

I am impressed with both these icons of Adblock and AdThwart

You must think about making a logo similar in nature, like red color because the color red has become to symbolize ad-blocking for some time

If it is not pirating, then modifying these icons with Puppy logo can do good.
Attachments
logo.png
(4.44 KiB) Downloaded 1587 times
face-devilish-48.png
(3.06 KiB) Downloaded 1585 times

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#29 Post by sc0ttman »

Nice icons, good stuff... Barry K also made one, which is in Woof, I wonder what that looks like..
Would need them all to compare.. :)

Also, is 0.5 working for everyone?

I'm not entirely sure I fixed it right, although as I said earlier, it seems to always work in 4.2 :roll:
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

User avatar
chrismt
Posts: 255
Joined: Wed 21 Apr 2010, 04:37

#30 Post by chrismt »

sc0ttman wrote:
Also, is 0.5 working for everyone?

I'm not entirely sure I fixed it right, although as I said earlier, it seems to always work in 4.2 :roll:
My problem with Puppy AdStopper in Puppy 5.1 seems to have fixed :D

I updated all the list and I counted the number of blocked lines and it is around 29452

I guess, this is what you will get if you update all the lists

Thanks!

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#31 Post by sc0ttman »

chrismt wrote:
sc0ttman wrote:
Also, is 0.5 working for everyone?

I'm not entirely sure I fixed it right, although as I said earlier, it seems to always work in 4.2 :roll:
My problem with Puppy AdStopper in Puppy 5.1 seems to have fixed :D

I updated all the list and I counted the number of blocked lines and it is around 29452

I guess, this is what you will get if you update all the lists

Thanks!
Yep, thats very close indeed to what I got last time I updated...
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

fyujj
Posts: 102
Joined: Sat 04 Apr 2009, 17:40

#32 Post by fyujj »

Hope not to be hacking this forum thread, but I'm interested in technosaurus' version because it can be run even from the cli. The latest version still didn't work, it creates a /tmp/adlist{1,2,3,4} but it's empty and so its links too.

Code: Select all

root@debian:/tmp# ls -l
total 1460
-rw-r--r-- 1 root root 618540 Ago 18 14:45 adlist1
-rw-r--r-- 1 root root      0 Set  3 18:35 adlist{1,2,3,4}
-rw-r--r-- 1 root root 733138 Ago 31 06:56 adlist2
-rw-r--r-- 1 root root  54885 Fev 12  2008 adlist3
-rw-r--r-- 1 root root  72249 Ago 19 22:01 adlist4

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#33 Post by technosaurus »

fyujj wrote:

Code: Select all

root@[b]debian[/b]:/tmp# ls -l
-rw-r--r-- 1 root root      0 Set  3 18:35 adlist{1,2,3,4}
that is odd - could it be that your /bin/sh is pointing to dash?
I thought it was standard behavior to expand adlist{1,2,3,4} to adlist1 adlist2....
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

fyujj
Posts: 102
Joined: Sat 04 Apr 2009, 17:40

#34 Post by fyujj »

technosaurus wrote:that is odd - could it be that your /bin/sh is pointing to dash?
Yes, I'm in Debian.
I have bash installed too and it's the default interactive shell as set in /etc/adduser.conf (I saw that in Debian's wiki and confirmed here).
Also, just for information, /bin/sh.distrib links to bash:

Code: Select all

lrwxrwxrwx 1 root root      4 Ago 13 21:48 sh -> dash
lrwxrwxrwx 1 root root      4 Jul 28 23:03 sh.distrib -> bash
I'm just saying, as dash is the default shell in Debian but maybe I could call the app in a different way (like /bin/bash script) and then it would work.

-edit: I tried both scripts (the first one and the second one that has the extra option to disable adblock) with /bin/bash. They both created empty files in /etc/hosts (the first directly and the second by linking to an empty /etc/hosts.adblock). The difference to when using dash is that the script this time deleted the downloaded files in /tmp while with dash they were kept there.

fyujj
Posts: 102
Joined: Sat 04 Apr 2009, 17:40

#35 Post by fyujj »

I left the script like this:

Code: Select all

#!/bin/bash
DIALOG=dialog || DIALOG=dialog
[ ! -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
and it doesn't create anymore /tmp/adlist{1,2,3,4}. The four files are in /tmp

Code: Select all

root@debian:/tmp# ls -l
total 1460
-rw-r--r-- 1 root root 618540 Set  4 12:34 adlist1
-rw-r--r-- 1 root root 733138 Set  4 12:34 adlist2
-rw-r--r-- 1 root root  54885 Set  4 12:34 adlist3
-rw-r--r-- 1 root root  72249 Set  4 12:34 adlist4
but /etc/hosts.adblock and /etc/hosts are blank.

Post Reply