开发者

Every entry to website will forward first to some page

开发者 https://www.devze.com 2023-04-11 01:04 出处:网络
I want to do in my office to all workers that if someone enters a website, he goes first to some url that will save his URL that he trying to go and then move him to his URL.

I want to do in my office to all workers that if someone enters a website, he goes first to some url that will save his URL that he trying to go and then move him to his URL.

How can I do it? Via hosts file or is t开发者_Python百科here another way to do it via router or something?

Or where can I read about it? Or how it's called? :)


What you're talking about is Internet Monitoring. Generally, you set up a server with software designed to do this.

I'm NOT making an endorsement, but the first one that comes to mind, simp;ly because it's the most recent I've seen, is iPrism. http://www.edgewave.com/products/web_security/

You can find a bunch more here. http://www.google.com/search?q=internet+usage+monitpring&sourceid=ie7&rls=com.microsoft:en-us:IE-Address&ie=&oe=

That said, this question should be moved to ServerFault.com because it is NOT a programming issue, unless you intend to write an Internet Monitoring system yourself.


If you have a transparent proxy, (or not so transparent but mandatory) e.g. squid they often provide ways of allowing you to rewrite URLs. With squid you can set a url_rewrite_program:

url_rewrite_program /usr/local/bin/redirector.pl

You then write a redirector program, e.g. this proof-of concept:

my %approved;

while (<>) {
         chomp;
         my @parts = split;
         my ($url, $ip, $ident, $method, $keypairs) = @parts;

         if (defined $approved{$ip}) {
           # We've seen them before
           print "$url\n";
         }
         else {
            # Not seen before
            # You *will* need to urlencode $url for this
            print "302:http://internal.site/page?dest=$url\n"; 
            $approved{$ip} = 1;
         }
}

Then all you need to do is implement http://internal.site/page so that it shows your message and either has a time based or click based redirect back to the url it was passed as dest.

Probably what you would want to do is use %approved to record the last time you saw a request from that machine and have a time out. You might also want to consider using lower level things than just the IP address, e.g. look up MAC address and switch ports.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号