I was checking out my bandwidth consumption on one of my workstations the other day and noticed that I was sending a lot of traffic (400MB in 14 days). This program basically checks the PIDs of the applications using bandwidth, allows you to drill down into those PIDs and figure out exactally what is going on.
I haven't developed this very far, it currently runs on:
Windows 2000
Apache 1.3
Perl 5.8.0
There are massive security holes, if you run this on your server, so I highly recommend that you don't. The program calls netstat.exe, tlist.exe, and kill.exe. The tlist & kill programs are available in the Windows NT 4.0 Resource Kit Support Tools.
#!perl.exe
use strict;
use CGI qw(:all);
use CGI::Carp('fatalsToBrowser');
print header();
print "<pre>";
print "<b>Netstat Viewer</b>\n";
print <<HTMLEND;
<a href="?netstat=allconnections">All Connections</a> | <a href="?nets
+tat=ethernetstats">Ethernet Statistics</a> | <a href="?netstat=routin
+gtable">Routing Table</a>
HTMLEND
if (param('netstat') eq "allconnections") {
# All Connections
my @netstats = `netstat.exe -o -a -n `;
map {
chomp $_;
s|(\d+)\r|<a href=\"?tlist=$1\">$1</a>\r|i;
print $_;
} @netstats;
} elsif (param('netstat') eq "routingtable") {
# Routing Table
print `netstat.exe -r`;
} elsif (param('netstat') eq "ethernetstats") {
# Ethernet Statistics
print `netstat.exe -e -s`;
} elsif (param('tlist')) {
my $pid = param('tlist');
my @tlist = `tlist $pid`;
if (@tlist) {
print "<a href=\"?kill=$pid\">kill this process!</a>\n\n";
print @tlist;
}
} elsif (param('kill')) {
my $pid = param('kill');
print `kill -f $pid`;
}
exit;
--
paul