kevinlyfellow
March 15th, 2007, 12:12 AM
I was working for the University of Maine not so long ago. One of my jobs was to write an after school curriculum for science (for middle school students). It was supposed to utilize technologies that these students may not have been exposed to (it was for a high poverty area). So, I spent quite a bit of time looking at different resources on the internet, and I came across inappropriate advertisements frequently. Recently studies have shown that most young people come across porn on the internet accidentally. I figured that it just plain sucks that young people need to be exposed to certain material accidentally, but I also do not agree with out-right filtering. Another thing I don't necessarily agree with is completely filtering out all ads altogether. Web sites make revenue by advertising and I feel its important that if you like a site, you should give them a chance at making money through ads.
So this has led me to make a script so that one can easily enter in an address to be blocked and it will be blocked system wide ever after. Let me know what you think :-)
#!/bin/bash
## this program is a shell script to easily block designated sites using the hosts file.
## it assumes that you want your blocked sites to be at the bottom of the hosts file.
######################
# configurable definitions
hostsfile=/etc/hosts
redirect="127.0.0.1"
######################
## Some definitions that shouldn't be changed
user=`whoami`
if [ $user = "root" ]
then
another="Yes"
while [ $another = "Yes" ]
do
site2bblocked=`zenity --entry \
--title="Block Site" \
--text="Enter site to be blocked.
DO NOT ENTER http:// !!!"`
if [ $site2bblocked ]
then
another=`zenity --list \
--title="Another site?" \
--column="Would you like to enter another site?" "Yes" "No"`
else
another="No"
fi
echo "$redirect $site2bblocked" >> $hostsfile
done
else
zenity --info --text="You need to be root to run this"
fi
return 0
So this has led me to make a script so that one can easily enter in an address to be blocked and it will be blocked system wide ever after. Let me know what you think :-)
#!/bin/bash
## this program is a shell script to easily block designated sites using the hosts file.
## it assumes that you want your blocked sites to be at the bottom of the hosts file.
######################
# configurable definitions
hostsfile=/etc/hosts
redirect="127.0.0.1"
######################
## Some definitions that shouldn't be changed
user=`whoami`
if [ $user = "root" ]
then
another="Yes"
while [ $another = "Yes" ]
do
site2bblocked=`zenity --entry \
--title="Block Site" \
--text="Enter site to be blocked.
DO NOT ENTER http:// !!!"`
if [ $site2bblocked ]
then
another=`zenity --list \
--title="Another site?" \
--column="Would you like to enter another site?" "Yes" "No"`
else
another="No"
fi
echo "$redirect $site2bblocked" >> $hostsfile
done
else
zenity --info --text="You need to be root to run this"
fi
return 0