ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdate/hostssh.pl
Revision: 192
Committed: 2004-08-22T21:23:29-07:00 (20 years, 10 months ago) by Douglas Thrift
Content type: text/x-perl
File size: 822 byte(s)
Log Message:
Meep!

File Contents

# User Rev Content
1 Douglas Thrift 150 #!/usr/bin/perl
2     #
3     # Host SSH
4     #
5     # Douglas Thrift
6     #
7     # $Id$
8    
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     my $host = $ARGV[0];
17    
18     if ($host eq "")
19     {
20     die "$0: no host";
21     }
22     elsif (!($host =~ /\./))
23     {
24     $host .= ".local.douglasthrift.net";
25     }
26    
27     $agent->agent("Host SSH/1.0 ($sysname $release $machine) ");
28    
29 Douglas Thrift 151 my $response = $agent->post("http://topsecret.douglasthrift.net/auth/hostupdat"
30     . "e.cgi", [host => $host, mode => "n"], Authorization => "Basic " .
31     encode_base64("HostUpdate:frell2003"));
32 Douglas Thrift 150 my $content = $response->content;
33    
34     if ($content =~ /^name=(.+)$/)
35     {
36     system ("ssh -L 8080:localhost:80 -R 8080:localhost:80 -L 5900:localhost:5"
37 Douglas Thrift 192 . "900 -L 2302:localhost:23 Douglas\\ Thrift\@$1");
38 Douglas Thrift 150 }

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Id