This works on my system, although I've had to make some configuration changes to apache.
First the web page which I created as:
/var/www/html/web-netstat/index.shtml
(where /var/www/html/ is my normal web documentroot)
Note that it is "shtml", which means that the server will check it for server-side includes.
Code: Select all
<HTML>
<HEAD>
<TITLE>Remote netstat output</TITLE>
<META http-equiv="refresh" content="60;">
</HEAD>
<BODY>
<PRE>
<!--#exec cmd="netstat -an" -->
</PRE>
</BODY>
</HTML>
Code: Select all
<Location /web-netstat>
Options +Includes
Order deny,allow
Deny from all
Allow from .foobar.com
</Location>
WARNING: Using server-side includes may open up your web-site to allow uninvited guests access to your command-line. You need to ensure that you limit access to hosts or domains that you trust. If you want to be absolutely safe, then rather use SSL with a user/passwd combination in addition to this. I don't know of any flaws in apache that would currently allow this, but overrun hacks have been found before....
Now, all you'll need to do is to use something like lynx to get and parse the page into plain text and to pipe it into the rest of the command line in the perl script (i.e. replacing the "netstat -an" part).
Let me know if this works !
Regards,
Rolf.