How to use adblock.sh

Support forum for routers of all shapes and sizes. As long as it's router based and doesn't fall into the other categories, this is the place to ask your questions.
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

How to use adblock.sh

Post by scgf » Tue Jun 01, 2010 4:11 pm

I want to block a website and in the absence of any parental controls I thought I could do it with adblock.sh

I read through the docs and entered adblock.sh after telneting into the router. I am running 2.93, btw.

The syntax help is confusing me. What exactly to I need to enter if I want to block a site without letting on to the user that I have blocked it? Ideally I would like to redirect the site to another innocuous site.

My old Thomson modem had parental control built in and it was so easy to enter the site I wanted to redirect and the site I wanted to redirect to.

Many thanks.
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Tue Jun 01, 2010 4:34 pm

I ran adblock.sh small and apparently a small dnsmasq.conf file is downloaded to the router. I assumed I could edit that file and add the url i wanted to redirect. Unfortunately I can't find it. If I edit /etc/dnsmasq.conf I can't see any of the lines I see if I download the file manually from pgl.yoyo.org
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Re: How to use adblock.sh

Post by mstombs » Tue Jun 01, 2010 8:47 pm

did you look in /var/tmp/dns.d/ ?
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Tue Jun 01, 2010 9:32 pm

There is only one file in /var/tmp/dns.d - extra servers.conf - and only contains a few lines, none of which have anything to do with the dmasq.con downloaded from pgl.yoyo.org.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: How to use adblock.sh

Post by thechief » Tue Jun 01, 2010 9:39 pm

scgf wrote:There is only one file in /var/tmp/dns.d - extra servers.conf - and only contains a few lines, none of which have anything to do with the dmasq.con downloaded from pgl.yoyo.org.
You obviously haven't run adblock.sh correctly (or adblock_multi.sh). In any case, what you want is easily done - e.g.,

Code: Select all

echo "address=/badsite.com/66.102.9.106" >> /var/tmp/dns.d/bad1.conf
killall dproxy
This is all you need to redirect "www.badsite.com" to google.com. This is just an example (Google might not appreciate their site being used in this way). Of course you can redirect to any other IP address - e.g., 127.0.0.1, as the adblock scripts do by default.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Tue Jun 01, 2010 10:22 pm

I ran "adblock.sh small" again and now there is an adblock.sh.conf file in /var/tmp/dns.d/

I did what you suggested and it seems to make no difference - I can still access the site. I edited adblock.sh.conf to add the site, but again, no difference.

Does it matter that I use the the extra_dns environment variable?
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Tue Jun 01, 2010 10:30 pm

Do I need to add anything to make the router do the adblocking?
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Tue Jun 01, 2010 10:43 pm

I have just rebooted the router, and in spite of doing 'Save All' the adblock.sh.conf file has disappeared. Do I have to set it up every time the router reboots?
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Tue Jun 01, 2010 11:38 pm

It took a few attempts but I have it working now.

All I need to do now is make it stick between reboots!

Thanks for your help.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: How to use adblock.sh

Post by thechief » Wed Jun 02, 2010 8:16 pm

Search the docs for "autoexec", "RT_init" and "RT_cmd".
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Wed Jun 02, 2010 8:32 pm

Do I get the router to execute 'adblock.sh small' each time it boots up? Then the commands to add my website redirection?

Cheers.
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Wed Jun 02, 2010 8:39 pm

Since 'adblock.sh small' requires an internet connection to download the adblock.conf file, will a connection be active when the command is executed in RC_cmd? If not, won't it just fail and not try again when a connection has been established? Is there a way to ensure an internet connection is available before issuing the command?
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: How to use adblock.sh

Post by thechief » Wed Jun 02, 2010 10:13 pm

The example I gave does not require adblock to be run at all. The secret is the conf file that is created in /var/tmp/dns.d/, and then killing dproxy (which will restart automatically, loading the new conf file).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
scgf
Regular
Regular
Posts: 52
Joined: Wed Oct 28, 2009 7:40 pm

Re: How to use adblock.sh

Post by scgf » Wed Jun 02, 2010 10:43 pm

Is this a riddle? Why a secret? All I need to know is what to do to keep the adblock.conf file over a reboot.

I am a teacher and am exasperated with the way hackers and Linux gurus hide their knowledge behind riddles and 'read this' and 'read that'. I have run a Linux box for some years and have learned a lot but sometimes it is just too difficult. When my students at school ask for help I give the help which is suitable for that individual - I don't respond with a riddle.

Why is it so difficult to just tell me what to do?

Please search my username 'scgf' and you will see how much help I have given to the Linux, OS/2 and Mac communities over a few years. I never respond with a riddle.

Sorry to rant when you are just trying to help. I do appreciate your efforts, really!
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Re: How to use adblock.sh

Post by mstombs » Thu Jun 03, 2010 12:33 am

the adblock.sh.conf is stored on the ram disk, it needs to be recreated if you reboot the router. There is a special env var to automate this on every boot - it runs adblock.sh only after the WAN is connected
# e.g., setenv adblock "small medium large"
To make custom additions you need to use the RT_cmd_x variables as above, dnsmasq (pretending to be dproxy in this firmware) will honour any conf files it finds in /dns.d/ when it is started.

If you have your own webserver on lan or wan you could auto download your custom version on every boot or on first wan connection (autoexec,sh).

You could store the conf file on a minix nvram partition..

Too many ways, all a bit fiddly...
Post Reply