0

I believe that this question has been asked before. Here is what I want to achieve. I want to monitor all outgoing web-traffic from the PC. And when a rule is hit, I want the access to a list of websites to be denied until another rule is hit.

This is like a timed access to the internet. I want the person using the PC can access the internet freely for two hours, but after that, any internet request to specific websites should be denied. So what I was thinking is monitoring the LAN interface for outgoing traffic and match the outgoing URL with a list of URLs, if match and the counter passes two hours, then deny the access, else allow ... Also, I want to know how to exactly calculate the time spent on a website in the list.

Sorry for taking too long to explain, hope I was able to pass my idea.

Best Regards.

sikas
  • 5,435
  • 28
  • 75
  • 120
  • if you think the questions been asked and answered before why don't you try Google? – Lloyd Mar 03 '12 at 20:25
  • How would you define time spent on a web site? For example, if I go to foo.com and then don't do another GET for some period of time, is that time spent on the site? What if I simply walked away from my computer and left it on that site? Should that count as "time spent" on the site? – Carey Gregory Mar 03 '12 at 20:27
  • @CareyGregory: Something like facebook and twitter generates traffic as long as they are open. So the duration the website is kept open is calculated. But this is not the main goal yet! I need first to capture traffic and then will work on how I want it to be calculated. – sikas Mar 03 '12 at 20:33
  • Yes, I understand that some sites maintain an active dialog as long as you're on the page, but many don't. I'd say most. As for capturing traffic, I would just go find an open source packet sniffer and work with that. It should be very simple to do as you suggested and just monitor the traffic for HTTP requests. – Carey Gregory Mar 03 '12 at 20:35
  • @CareyGregory: I don't just want to sniff/capture traffic. I want to also deny traffic if usage exceeds a specific amount of time. – sikas Mar 03 '12 at 20:48

1 Answers1

2

You could go for this: http://www.codeproject.com/Articles/14423/Getting-the-active-TCP-UDP-connections-using-the-G

It lists the active TCP connections. From the IP you can get the domain by fetching it from the DNS cache. Then you can disable all connections during a specific time of day.

bytecode77
  • 14,163
  • 30
  • 110
  • 141