Perl-Expect
It's been a long time since I actually wrote a program to solve a problem. Ditch the previous post, 'cuz I found a much better SSH daemon for Win called FreeSSHD which lets you run it with "ssh host command" just like I wanted. But even with a help page I found on the topic, I was unable to configure it to work without requiring a password, so I decided to finally get down to Expect (something I've claimed to know, tho' I never got it working to simulate a telnet job like I wanted) and found out that this code works!#!/usr/bin/perl
use Expect;
my $timeout=2;
my $exp=Expect->spawn("ssh xtp2 \"cmd.exe /c dir\"");
$exp->expect($timeout,
[ "password:" => sub { my $self = shift;
$self->send("root123\n")
} ]
);
$exp->soft_close();
1 Comments:
Internet Protocol Version 6 (IPv6)
Facilities in IPv6
IPv6 Addressing
IPv6 Packet Format
IPv6 Implementation in Linux
IPv6 Socket Implementation
IPv6 Fragmentation and De-Fragmentation Implementation
IPv6 Output
IPv6 Input
IPv6 UDP
IPv6 TCP
Post a Comment
<< Home