All right,
I've been playing around with Tcl lately and I found what I need, but still cann not make Tcl script recognizing the output after Telnet session establishment, than sending the username and the password, and than the easy part, execute a command and loging off.
I found that in Tcl I can use the command "connect" and than establish a telnet session.
A sample script I'm banging my head with:
tclsh
proc telnet_switch{}{
set success "Login successful!"
set check "Username:"
connect 172.26.160.6 telnet port 2046
if {string equl $check}{
puts "username\n"}
else{ puts "password\n"}
return $success
}
The command connect telnet port works on it's own, I've tested that. But how to make this simple script running? I've got an error like:
wrong # args: should be "proc name args body"
What I'm missing here?