# Tcl implementation of rexec client
namespace eval remote {
proc Open {host user password} {
# Record user authentification information for remote computer
variable Host $host
variable User $user
variable Password $password
}
proc Read {channel} {
# Channel read handle
if {[gets $channel line] < 0} {
if {[eof $channel]} {
close $channel
set ::remote::Flag EOF
}
} else {
lappend ::remote::Output $line
}
}
proc Command {commandString} {
# Remote execute a command using rexecd
catch {unset ::remote::Flag}
set ::remote::Output {}
set socketId [socket $::remote::Host 512]
fconfigure $socketId -blocking 0 -buffering line
puts $socketId \000$::remote::User\000$::remote::Password\000$commandString\000
fileevent $socketId readable [list ::remote::Read $socketId]
vwait ::remote::Flag
catch {close $socketId}
return $::remote::Output
}
}
# End of rexec clientkroc - 10 Jul 2003 - Remote execution: allow to launch a command on a remote computer. It needs two parts: a REXEC client to send the command and a REXEC daemon (server) running on the target computer.
Usage: rexec [ -abcdhns ] -l username -p password host command
-l username: Sets the login name for the remote host.
-p password: Sets the password for the remote host.
-n: Explicitly prompt for name and password.
-a: Do not set up an auxiliary channel for standard error.
-b: Use BSD-rsh type signal handling.
-c: Do not close remote standard in when local input closes.
-d: Turn on debugging information.
-h: Print this usage message.
-s: Do not echo signals to the remote process.REXEC must be use very carefully because it could give an unsecured access to a network.sdx provides a REXEC compatible server (see http://www.equi4.com/204
for details).I've done a REXECD starkit using it, available here: http://www.zolli.fr/fichiers/rexecd.zip
It's pure tcl so it shall runs on all tcl supported platforms.REXEC for linux:most linux distributions provides rexec client and rexecd.
REXEC for windows (commercial):http://www.denicomp.com
(quite slow) - http://www.cursor-ri.com
(faster but XP / 2K problems) - http://www.hummingbird.com
(expensive and complex but powerfull).Remote process execution for windows (free) http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

