block some www sites

An area specifically for port forwarding, firewalls and other (on-line) security related issues.
Post Reply
baraozemo
Novice
Novice
Posts: 11
Joined: Thu Dec 27, 2012 7:15 pm

block some www sites

Post by baraozemo » Sun Feb 10, 2013 3:12 pm

Hi,

I have the 2.97 firmware installed in my DSL 2640T

I need help to understand how block of some websites using the routertech firmware.

for example: I want to block
http://www.facebook.*
http://www.orkut.*
http://www.twitter.*


tks
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12066
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: block some www sites

Post by thechief » Sun Feb 10, 2013 4:38 pm

Try this, from telnet/ssh login prompt

Code: Select all

block.sh facebook.com
block.sh orkut.com
block.sh twitter.com
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.
baraozemo
Novice
Novice
Posts: 11
Joined: Thu Dec 27, 2012 7:15 pm

Re: block some www sites

Post by baraozemo » Sun Feb 10, 2013 5:24 pm

tks...

Code: Select all

/var # block.sh
Syntax=block.sh <host> [NEW_IP]
Examples:
block.sh site1.com               [redirects site1.com to default IP (127.0.0.1)]
block.sh site2.com 128.128.128.0 [redirects site2.com to 128.128.128.0]


/var # unblock.sh
-sh: unblock.sh: not found
and what is the command to "revert" (unblock) ?

tks
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12066
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: block some www sites

Post by thechief » Sun Feb 10, 2013 6:20 pm

baraozemo wrote:and what is the command to "revert" (unblock) ?

Code: Select all

rm /var/tmp/dns.d/block_user.conf
killall dproxy
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.
duke
Regular
Regular
Posts: 61
Joined: Mon Nov 26, 2012 7:03 pm

Re: block some www sites

Post by duke » Mon Feb 11, 2013 6:23 am

thechief wrote:Try this, from telnet/ssh login prompt

Code: Select all

block.sh facebook.com
block.sh orkut.com
block.sh twitter.com
i tried that it did not work
even after a router restart

then logged in with winscp and went to the etc\hosts file and added the entry manually after a restart it was wiped clean
i'm now doing it again and will see if "save all" (saving all settings to flash) will keep settings between reboots

questions
1 . if the block.sh script had worked then do you need to run it each time via cron or some routine each time the router reboots ?
2. is there an easy way to block ip ranges ? or filter traffic using mime types
i'm looking to block
  • *facebook.com/ajax/chat*
    *facebook.com/images/chat*
    *facebook.com/ajax/presence*
    *.channel*.facebook.com/x/*/false/p_*
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12066
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: block some www sites

Post by thechief » Mon Feb 11, 2013 6:40 pm

Well, it should work. Did you clear your browser cache, etc., etc.?
duke wrote:1 . if the block.sh script had worked then do you need to run it each time via cron or some routine each time the router reboots ?
Yes.
duke wrote:2. is there an easy way to block ip ranges ? or filter traffic using mime types
No idea.
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.
baraozemo
Novice
Novice
Posts: 11
Joined: Thu Dec 27, 2012 7:15 pm

Re: block some www sites

Post by baraozemo » Tue Feb 12, 2013 1:22 am

what is the correct step to block sites.

for example:
block.sh facebook.com
after, is necessary to save/reboot the modem ?

or only "save" ?
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12066
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: block some www sites

Post by thechief » Tue Feb 12, 2013 9:12 am

baraozemo wrote: block.sh facebook.com
after, is necessary to save/reboot the modem ?
No. The command should take effect immediately.
baraozemo wrote:or only "save" ?
No, you cannot "save" it. The changes will be lost on reboot, unless you run the command on every boot-up (e.g., via the autoexec functions).
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.
baraozemo
Novice
Novice
Posts: 11
Joined: Thu Dec 27, 2012 7:15 pm

Re: block some www sites

Post by baraozemo » Wed Feb 13, 2013 2:43 pm

ok, is this the correctly way ?

(to install the filter in the boot / allways use it)
setenv autoexec.sh "block.sh facebook.com"
setenv autoexec.sh "block.sh orkut.com.*"
setenv autoexec.sh "block.sh twitter.com"

(to uninstall the filter)
unsetenv autoexec.sh "block.sh facebook.com"
unsetenv autoexec.sh "block.sh orkut.com.*"
unsetenv autoexec.sh "block.sh twitter.com"
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12066
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: block some www sites

Post by thechief » Wed Feb 13, 2013 4:57 pm

baraozemo wrote: setenv autoexec.sh "block.sh facebook.com"
setenv autoexec.sh "block.sh orkut.com.*"
setenv autoexec.sh "block.sh twitter.com"
Wrong. You are simply overwriting the environment variable with different values. Only the last one will count. If you are going to block a lot of sites, you should create a script, and upload it to a minix partition on the router. If you can it "startup.sh", it will be executed automatically during bootup. If you are only going to block a few sites, you can do something like

Code: Select all

setenv autoexec.sh "block.sh facebook.com && block.sh twitter.com && block.sh orkut.com"
setenv autoexec1.sh "block.sh blah_blah && block.sh bloo_bloo && block.sh blee_blee"
You can have up to autoexec7.sh
baraozemo wrote:(to uninstall the filter)
unsetenv autoexec.sh "block.sh facebook.com"
unsetenv autoexec.sh "block.sh orkut.com.*"
unsetenv autoexec.sh "block.sh twitter.com"
Unsetenv takes only one parameter - and, the second and third commands are doing nothing, since you have already unset the single variable.
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.
Post Reply