/* HINT: Search archives @ http://www.indyramp.com/masq/ before posting! */


Good day, Steve,

On Mon, 22 Nov 1999, Steve Creel wrote:

>       Hoping that I need not re-invent the wheel here, does anyone know
> of a program to monitor current connections through a masquerading
> machine?  I'm looking for something to use that others can see the
> activity on the machine via web.....

        How about this decidedly ungraphical version:

#!/bin/bash
#Copyright 1999, William Stearns <[EMAIL PROTECTED]>
#Released under the GPL.
#Untested - please send patches and improvements to the author.

while /bin/true ; do
        echo '<html><head>' >/home/httpd/html/masqconn.html
        echo '<title>Current Masq connections</title>' >>/home/httpd/html/masqconn.html
        echo '<META HTTP-EQUIV="REFRESH" CONTENT="60"></head>' 
>>/home/httpd/html/masqconn.html
        echo '<body><code>' >>/home/httpd/html/masqconn.html
        if [ -f /proc/net/ip_fwchains ]; then   #ipchains
                /sbin/ipchains -L -M >>/home/httpd/html/masqconn.html
        elif [ -f /proc/net/ip_input ]; then    #ipfwadm
                /sbin/ipfwadm -l -M >>/home/httpd/html/masqconn.html
        elif [ -n "`lsmod | grep '^iptables '`" ]; then #iptables
               #Ummm, not sure. >>/home/httpd/html/masqconn.html
        fi
        echo '</code></body></html>' >>/home/httpd/html/masqconn.html
        sleep 43
done

        Call it from /etc/inittab or /etc/rc.d/rc.local .
        Hey, let me know if it works.  *smile*
        Cheers,
        - Bill

---------------------------------------------------------------------------
        "The idea that Bill Gates has appeared like a knight in shining
armour to lead all customers out of a mire of technological chaos neatly
ignores the fact that it was he who, by peddling second-rate technology,
led them into it in the first place."
        - Douglas Adams, on Windows '95.
(Courtesy of David Rysdam <[EMAIL PROTECTED]>)
--------------------------------------------------------------------------
William Stearns ([EMAIL PROTECTED]).  Mason, Buildkernel, named2hosts, 
and ipfwadm2ipchains are at: http://www.pobox.com/~wstearns/

_______________________________________________
Masq maillist  -  [EMAIL PROTECTED]
Admin requests can be handled at http://www.indyramp.com/masq-list/ -- THIS INCLUDES 
UNSUBSCRIBING!
or email to [EMAIL PROTECTED]

PLEASE read the HOWTO and search the archives before posting.
You can start your search at http://www.indyramp.com/masq/
Please keep general linux/unix/pc/internet questions off the list.

Reply via email to