J
justme
hi
i need to connect to a secured server to get a security log file. This
log file
can only be accessed using the software client (GUI) that comes with
the distribution CD. And everytime i used the software to get the
file, it requires me to use a username and password. After that, the
first page is http://securedserver:1010/logs/. So i gathered a little
code in perl to do that automatically. It seems that the software does
not allow ppl to use scripts to get its files, not even ftp or SSH.
Any other suggestions?
thanks
use LWP::UserAgent;
use HTTP::Request::Common qw(POST GET);
use HTTP::Headers;
use LWP:
ebug;
$PROXY_URL = 'http://securedserver:1010/';
$TARGET_URL = 'http://securedserver:1010/logs/log.txt'; #the file i
want to get
$PROXYUSER = 'admin';
$PROXYPASS = 'password';
LWP:
ebug::level('+') ;
$ua = LWP::UserAgent->new();
$req = HTTP::Request->new(GET => $PROXY_URL);
$req->proxy_authorization_basic($PROXYUSER, $PROXYPASS);
$res = $ua->request($req);
if ($res->is_success) {
print($res->content);
}
else {
print("Something wrong!\n");
}
....
.....
the output is:
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://securedserver:1010/
LWP::UserAgent::_need_proxy: Not proxied
LWP:
rotocol::http::request: ()
LWP:
rotocol::collect: read 350 bytes
LWP::UserAgent::request: Simple response: OK
<html>
<!-- <h1> Server </h1> -->
<HEAD><TITLE>Some company Co.</TITLE></HEAD>
<BODY>
<CENTER><IMG SRC = "sample.gif"></CENTER>
<P ALIGN=CENTER><I><B>
This server cannot be configured via a web browser.<br>
Use the software that is included on the distribution CD instead.
</B></I></P>
</BODY>
</html>
i need to connect to a secured server to get a security log file. This
log file
can only be accessed using the software client (GUI) that comes with
the distribution CD. And everytime i used the software to get the
file, it requires me to use a username and password. After that, the
first page is http://securedserver:1010/logs/. So i gathered a little
code in perl to do that automatically. It seems that the software does
not allow ppl to use scripts to get its files, not even ftp or SSH.
Any other suggestions?
thanks
use LWP::UserAgent;
use HTTP::Request::Common qw(POST GET);
use HTTP::Headers;
use LWP:
$PROXY_URL = 'http://securedserver:1010/';
$TARGET_URL = 'http://securedserver:1010/logs/log.txt'; #the file i
want to get
$PROXYUSER = 'admin';
$PROXYPASS = 'password';
LWP:
$ua = LWP::UserAgent->new();
$req = HTTP::Request->new(GET => $PROXY_URL);
$req->proxy_authorization_basic($PROXYUSER, $PROXYPASS);
$res = $ua->request($req);
if ($res->is_success) {
print($res->content);
}
else {
print("Something wrong!\n");
}
....
.....
the output is:
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://securedserver:1010/
LWP::UserAgent::_need_proxy: Not proxied
LWP:
LWP:
LWP::UserAgent::request: Simple response: OK
<html>
<!-- <h1> Server </h1> -->
<HEAD><TITLE>Some company Co.</TITLE></HEAD>
<BODY>
<CENTER><IMG SRC = "sample.gif"></CENTER>
<P ALIGN=CENTER><I><B>
This server cannot be configured via a web browser.<br>
Use the software that is included on the distribution CD instead.
</B></I></P>
</BODY>
</html>