1 |
< |
#!D:/Perl/bin/perl.exe |
1 |
> |
#!/usr/bin/perl |
2 |
|
# |
3 |
|
# Host Update |
4 |
|
# |
9 |
|
use strict; |
10 |
|
use LWP::UserAgent; |
11 |
|
use POSIX; |
12 |
+ |
use MIME::Base64 qw(encode_base64); |
13 |
|
|
14 |
|
my $agent = LWP::UserAgent->new; |
15 |
|
my ($sysname, $nodename, $release, $version, $machine) = uname(); |
16 |
|
|
17 |
+ |
if (!($nodename =~ /\./)) |
18 |
+ |
{ |
19 |
+ |
$nodename .= ".local.douglasthrift.net"; |
20 |
+ |
} |
21 |
+ |
|
22 |
|
$agent->agent("Host Update/1.0 ($sysname $release $machine) "); |
23 |
|
|
24 |
< |
my $response = $agent->post("http://douglaspc/cgi-bin/hostupdate.exe", |
25 |
< |
[host => $nodename]); |
24 |
> |
my $response = $agent->post("http://topsecret.douglasthrift.net/auth/hostupdat" |
25 |
> |
. "e.cgi", [host => $nodename], Authorization => "Basic " . |
26 |
> |
encode_base64("HostUpdate:frell2003")); |
27 |
|
my $content = $response->content; |
28 |
|
|
29 |
< |
print "$content |
23 |
< |
"; |
29 |
> |
print "$content"; |