Block websites?

Discussion in 'Mac Programming' started by 7Deuce, Mar 24, 2011.

  1. 7Deuce macrumors newbie

    Joined:
    Mar 24, 2011
    #1
    Hey, newbie programmer here. I would like to write a program that can block a website during a given time of day. I've read around a bit and it seems one possibility would be to write a script that edits /etc/hosts and use launchd/cron(?) to make it run at the desired times. What other ways are there of doing this? I would be looking to do this in python.
     
  2. Angelo95210 macrumors 6502a

    Angelo95210

    Joined:
    Jan 7, 2009
    Location:
    Paris, France
    #2
    I think this is the most efficient way, /etc/hosts and cron/launchd being the most low level tools for this.

    Eventually you might not use cron/launchd and use your own way of timing. But /etc/hosts is for me the way to go.
     
  3. Hansr macrumors 6502a

    Joined:
    Apr 1, 2007
    #3
    +1 for /etc/hosts

    An alternative is an SOCKS proxy for all traffic or an in browser solution like Leechblock.
     
  4. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    Use Celery (a Python framework). It works great as a cron replacement and is extremely powerful. You'll appreciate the fact that you learnt it in many other projects as well.
     
  5. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #5
    If you are behind a NAT router/gateway you could also try blocking the site there.

    B
     
  6. 7Deuce thread starter macrumors newbie

    Joined:
    Mar 24, 2011
    #6
    Thanks for all the ideas guys.

    What kind of things did you have in mind when you said 'your own way of timing'?
     
  7. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #7
    Cromulent mentioned Celery.

    B
     

Share This Page