Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I think the warnings are because the keys on your machine are for localhost:22 whereas you are connecting to localhost:9999. You should be able to retain host key checks by telling ssh that it’s connecting through a proxy. Here I used netcat.

    Try this for extra evil (untested):

    use strict;
    use warnings;

    open my $pipe, '|-', 'ssh', '-o', 'ProxyCommand=nc localhost 9999', 'localhost', 'perl';

    die "Can't fork: $!\n" unless defined $pipe;

    print $pipe <<'END_PERL';
    use strict;
    use warnings;
    use File::Temp qw( tempfile );

    my ( $fh, $filename ) = tempfile();

    local $/ = \65536;
    print $fh $_ while <DATA>;

    system 'gnome-open', $filename;

    local $/ = \65536;
    print $fh $_ while <>;

    SSH over SSH is not very efficient though. You could write a script that forks and runs ssh then stays around while that process is running, accepting connections on some port (bound to localhost only for security reasons) and writing the data to a file which it invokes gnome-open on it. Then on the remote side all you’d need to do is pipe the file to nc localhost 9999.