use strict; use IO::Socket::Socks; $IO::Socket::Socks::SOCKS4_RESOLVE = 1; package SshGenUser; use strict; use WebServer; sub new { my ($class, $url)= @_; my $self= bless { w=>WebServer->new($url), }, $class; $self->{w}{ua}->proxy([qw(http https)] => 'socks://localhost:9050'); return $self; } sub genuser { my ($self)= @_; return $self->{w}->httpget("/cgi-bin/gen_user.sh")->content; } package main; use strict; use Getopt::Long; my $svr= SshGenUser->new("http://ctcj7wybt4naqpqk.onion"); my $html= $svr->genuser(); my ($username, $password, $ip); if ($html =~ />username<\S+\s+(\w+)/) { $username= $1; } if ($html =~ />password<\S+\s+(\w+)/) { $password= $1; } if ($html =~ /connecting to (\S+) with SSH/) { $ip= $1; } printf("torify ssh %s@%s / %s\n", $username, $ip, $password); system("term torify ssh $username\@$ip");