in reply to logging internet activity on win32
I wish I had some sample code here, but that is at work. Although it should be easy to figure out from the examples and the docs.
Now, I haven't tried this with HTTPS, so I have no idea if it would work. It is also possible you may need to fire up separate proxies for different protocols too, I am not sure offhand and without anything to test with. :)
ZoneAlarm should be no problem, you just allow perl to connect to the outside (it even asks for permission, like TPF, right?).
If this doesn't cut it, you could go more low-level with IO::Socket::INET. Basically, you have open two sockets, one to communicate with the browser, and one to do the same with the internet. Beware though, that now you will need to grok HTTP to do this. The upside is that you can proxy just about anything, here is a small example of a IMAP proxy that does nothing but pass on the data. I intend to do something with this at some point, but for now it will serve as an example on what you can do - principle should be the same. Is probably lousy code though, is just proof of concept to myself... :)
use IO::Socket; my $listener = IO::Socket::INET->new ( Listen => 5, LocalAddr => 'localhost', LocalPort => 143, Proto => 'tcp' ); while(defined(my $connection = $listener->accept)) { print "New connection\n"; my $sender = IO::Socket::INET->new("$host:143"); $connection->print($sender->getline()); ## open LOG, '>>imaplog.txt' or die "$!"; while(my $line = $connection->getline()) { my ($id) = $line =~ /^(\w+)/; ## print LOG "Q: $line"; $sender->print($line); my $total_answer = ''; while(my $answer = $sender->getline()) { ## print LOG "A: $answer"; $total_answer .= $answer; #$connection->print($answer); last if($answer =~ /^$id\s+(OK|NO|BAD)/i); } $connection->print($total_answer); } ## close LOG; $sender->close; $connection->close; undef $sender; undef $connection; }
Maybe, just maybe any of this helps. :)
|
|---|