Results 1 to 2 of 2
  1. #1

    Member Since
    Jan 29, 2012
    script to blackhole a website after an hour
    I would like to write a script which will use the route command to interrupt access to a website for the rest of the day one hour after detecting first use of the day. I will use the route command to blackhole the address. The idea here is to limit facebook access to just an hour a day. I plan to build these features into the script, which will run via cron every 15 minutes or so:

    1. check what DNS addresses were used by various web browsers and apps on the computer over the last hour and build a table of what was done at what time.
    2. read a configuration file which has a list of websites to blackhole and an optional number of minutes to wait before blackholing,
    3. if sufficient time has passed blackhole the site with a command similar to route add `host| awk '{print $NF}'`
    4. add the site name and IP address to a text table.
    5. go through the table and make sure any additional addresses for the sites in the config file are also blackholed.
    6. if midnight, remove the blackhole routes and flush DNS cache

    I can do all of this except I don't know how to do #1 on my list. Is it possible using built-in Mac utilities (I would prefer not to download freeware/shareware such as djbdns for this) to look in a log file or somehow look up what has been queried in DNS over the last hour or so? Can I turn on logging for the DNS client or somehow tell what the DNS client has done recently?


  2. #2

    Member Since
    Jan 29, 2012
    I forgot to mention, I am talking about doing this on macbooks running Snow Leopard and Lion.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Terminal -- shell script -- script will only read two lines of a file
    By Straitsfan in forum OS X - Apps and Games
    Replies: 0
    Last Post: 01-30-2011, 10:04 PM
  2. Whats A good Website Hosting website
    By MacKid6693 in forum Web Design and Hosting
    Replies: 8
    Last Post: 03-16-2010, 12:50 PM
  3. May our snoozing last another hour!
    By BlueMac in forum Schweb's Lounge
    Replies: 19
    Last Post: 11-02-2008, 03:40 PM
  4. My 48 Hour Film!
    By PowerBookG4 in forum Movies and Video
    Replies: 5
    Last Post: 06-22-2007, 04:24 PM
  5. power hour?
    By hotskate in forum Schweb's Lounge
    Replies: 27
    Last Post: 01-14-2007, 12:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts