找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 7431|回复: 12

让DD-WRT阻挡恶意网页 (依靠Hosts过滤)

[复制链接]
文章来自一篇繁体中文网页

当DD-WRT的内存32M或64M,可以把6万多条的恶意网站HOSTS列表COPY至DD-WRT中。
套句老话:会杀毒不如少中毒


<-----------------------复制以下脚本到Command Shell后点save startup------------------------->

logger WAN UP Script Executing
sleep 30
test -s /tmp/dlhosts
if [ $? == 1 ] ; then
wget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | sed -e '2,$s/127.0.0.1/0.0.0.0/g' -e '2,\$s/0.0.0.0 localhost/127.0.0.1 localhost/g' -e 's/[[:space:]]*#.*$//' > /etc/hosts
echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e '2,\$s/0.0.0.0 localhost/127.0.0.1 localhost/g' -e 's/[[:space:]]*#.*$//' > /tmp/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts
chmod 777 /tmp/dlhosts
/tmp/dlhosts
fi
ln -s /tmp/hosts /etc/hosts
echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab


注意点击save startup后需要重启路由
然后查看是否成功,ping个被Hosts过滤的域名看看

[ 本帖最后由 可口可乐 于 2009-1-31 20:48 编辑 ]
我的恩山、我的无线 The best wifi forum is right here.
不知道怎么看TMP目录,如果是NAS/FTP下生产的TMP目录看过了没有
而且运行后也能PING到HOSETS.TXT里面的网址

启动logger WAN UP Script Executing
sleep 30
test -s /tmp/dlhosts
if [ $? == 1 ] ; then
echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e 's/[[:space:]]*#.*$//' > /tmp/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts
chmod 777 /tmp/dlhosts
/tmp/dlhosts
fi
ln -s /tmp/hosts /etc/hosts
echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab


起到后下面框里显示这个
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
少了段脚本,已更新
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

不错 ,支持!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

好东西,能否做到cron里面呢?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

要是能屏蔽各个网站广告就好了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

openwrt如何更新  谢谢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

myfriends 发表于 2012-2-13 09:14
openwrt如何更新  谢谢

Microsoft Windows 95/98/ME:        C:\WINDOWS\
Microsoft Windows NT/2K:        C:\WINNT\SYSTEM32\DRIVERS\ETC\
Microsoft Windows XP/2K3:        C:\WINDOWS\SYSTEM32\DRIVERS\ETC\
Linux/BSD/Solaris/Unixes:        /etc/hosts
BeOS:        /boot/beos/etc/hosts
Macintosh OSX/10.*:        /etc/hosts (link)
Macintosh (non OSX) method #1        Place the Mac Hosts file in the Preference folder. re-name it "Hosts" (exact case matters) shutdown, restart.
Macintosh (non OSX) method #2        Copy the Mac Hosts file to your computer re-name it "Hosts".
In the TCP/IP Control Panel, choose 'Select Hosts file' Select this file, close and restart.
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

rm /tmp/HostsX.orzhosts

wget -P /tmp http://hostsx.googlecode.com/svn/trunk/HostsX.orzhosts

sleep 2

/etc/init.d/dnsmasq restart



这个命令就可以 写到路由脚本或者定时运行就可以
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

rm /tmp/HostsX.orzhosts

wget -P /tmp http://hostsx.googlecode.com/svn/trunk/HostsX.orzhosts

sleep 2

/etc/init.d/dnsmasq restart



这个命令就可以 写到路由脚本或者定时运行就可以
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

怎么做具、体点
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

不知道还有没有效果 !
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-27 09:52

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表