MyBB Community Forums

Full Version: Block facebook - software
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there any god application that blocks access to facebook but on specific times?
1) Why would you want to block Facebook?
2) You'd be better trying some Parental Filter websites.
Hosts file + a script to automatically change it at different times?
Windows Vista - 7.
DD-WRT.
(2011-02-19, 04:23 AM)KuJoe Wrote: [ -> ]DD-WRT.

If he has a router and the technical know-how on how to flash it.
(2011-02-18, 04:10 PM)Dejanmo Wrote: [ -> ]Is there any god application that blocks access to facebook but on specific times?

CMIIW; You can block Facebook with your router setting. My linksys router has the option to allow or disallow internet usage, website, etc. on a specified time.
Ruby script. You could probably modify this one easily (or you could just use it instead to instigate insanity):
require 'webrick'
require 'webrick/httpproxy'
require 'getoptlong'

opts = GetoptLong.new(
    [ "--help",  "-h", GetoptLong::NO_ARGUMENT       ],
    [ "--file",  "-f", GetoptLong::REQUIRED_ARGUMENT ],
    [ "--port",  "-p", GetoptLong::REQUIRED_ARGUMENT ],
    [ "--delay", "-d", GetoptLong::REQUIRED_ARGUMENT ]
)

def showHelp
    puts "Act as a transparent proxy that delays certain sites from loading"
    puts "\t-h or --help  Display this help"
    puts "\t-f or --file  Specify a file to load sites from"
    puts "\t-p or --port  Specify the port to accept connections on (default 8080)"
    puts "\t-d or --delay Specify the number of seconds to sleep when accesing a \"slow\" site (default 5 seconds)"
end

$sites = []
$port  = 8080
$delay = 5

opts.each do |opt, arg|
    case opt
    when "--help"
        showHelp
        exit
    when "--port"
        $port = arg.to_i
    when "--file"
        begin
            fdata = File.read(arg)
            fdata.split(/\n/).each do |site|
                $sites << site
            end
        rescue
            puts "Failed to load file #{arg} - #{$!}"
            exit
        end
    when "--delay"
        $delay = arg.to_i
    else
        puts "Invalid argument - #{opt}"
        showHelp
        exit
    end
end

while site = ARGV.shift
    $sites << site
end

if $sites.size ==0
    puts "You have not specified any sites to delay from loading.  There is no purpose to proxy transparently."
    showHelp
    exit
end

puts "Delaying the following sites from loading:"
$sites.each do |site|
    puts "\t#{site}"
end

$proxy = WEBrick::HTTPProxyServer.new\
    :Port            => $port,
    :ServerType      => Thread,
    :RequestCallback => Proc.new { |req,res|
        puts "[+] Parsing request #{req.request_line}"
        delay = false
        $sites.each do |site|
            if req.request_line.match(site)
                delay=true
                break
            end
        end
        if delay
            puts "\tThis is a \"slow\" site, sleeping for #{$delay} seconds"
            sleep $delay
        end
    }

$proxy.start

trap("INT") {
    puts "Shutting down..."
    $done = true
}

until $done
    # Idle loop
    sleep(1)
end

$proxy.shutdown
Host file(127.0.0.1 .facebook.com) or some parenting software.