[ previous ] [ next ] [ threads ]
 From:  "T. Lechat" <m0n0wall at lechat dot org>
 To:  "Adam Nellemann" <adam at nellemann dot nu>, <m0n0wall at lists dot m0n0 dot ch>
 Subject:  Re: [m0n0wall] How to Display the traffic graph directly?
 Date:  Tue, 28 Dec 2004 01:51:32 +0100
> I would like to display certain pages (or parts thereof) from the
> m0n0wall web GUI, either as part of a composite web-page (ie. with
> other status pages shown in other frames) or on my Active Desktop. In
> order to do so, it is, among other things, necessary to somehow
> "pre-provide" the userid/password, as the page(s) will otherwise not
> show (or alternativly, ask for this information, which is also not
> acceptable).


One way (not the best, but a working solution) to achieve your goal is to 
use an intermediate web server with php and put the following script in it :
This script call m0n0wall webgui with the basic authentification, parse the 
returned page to change some url, and send result to your browser.
For exemple, name it as m0n0.php, and your new webserver is 
From now, call http://myinternalwebserver/m0n0.php

And oh surprise, traffic graph is now working...

You can change $page to whatever you want.


$ip=""; // m0n0wall webgui ip
$port="80";             // m0n0wall webgui port
$page="graph.php"; // m0n0wall trafficgraph page
$get="ifnum=ng0&ifname=WAN"; // m0n0wall trafficgraph get string
$user="myuser"; // m0n0wall user
$password="mypassword"; //m0n0wall password

/*   Do request   */



$msg = <<< EOT
GET /$page?$get  HTTP/1.0
Authorization: Basic $auth\r\n\r\n

while ($buffer=fgets($sock,4096)) $out.=$buffer;
if(!$outa[1]) $outa=explode("\n\n",$out,2);
header("Content-type: image/svg+xml");}echo $outa[1];?>