Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to connect to Xyplex Terminal Server

Status
Not open for further replies.

simpson

MIS
Oct 23, 2001
58
CA
Hello all,

Looking for some help in incorporating some communications with our Xyplex terminal servers into my syscheck scripting. Really don't know where to begin when it comes to making a connection to a terminal server and executing commands remotely. Any help or direction as to where I can become more enlighted would be appreciated.

Simp
 
You can use telnet to connect to terminal servers/ports. They can be configured one of two ways: an IP per port or one IP and multiple port numbers. To check your ports, you can either check one port at a time or telnet to the terminal server and run a command to check whether a connection is established or idle. The problem with expect is that you'll be required to create a file with "expected" parameters. Depending on what level you want to verify the connection, you may have to supply passwds. This sounds eerily close to something I created years ago. You woudn't happen to be from Nortel would you?
 
Thanks for the responces. I expected that I would have to use expect. (haha) But I was hoping for a different answer. I quess it is expect.

No, sorry I don't work for Nortel. I am fairly familiar with Terminal servers I was just hoping for some type of connection string I could incorporate.

Thanks again.
Simp
 
Expect/Tcl is easy to use.

Here's a sample toy script that takes a hidden password
entered by the user at init and plays cheey tricks
on the password entered.
Just an example to show how flexible expect/tcl can be.

Code:
#!/usr/bin/tclsh
package require Expect

#exp_internal 1
set prompt ".*@.*"

proc getpass {str} {
      stty -echo
      puts -nonewline stdout $str
      flush stdout
      set ans [gets stdin]
      stty echo
      return $ans
}


proc fakehash {string} {
set len [expr int(1 + rand() * [string length $string])]
set str [format %s h$len]
 
  if {[binary scan $string $str out] == 1} {  
      return $out
  } 
return $string
}

       set pass [getpass "\nPlease enter the password for your procedure: "]
       spawn -noecho /bin/sh

          expect {

                        -re "$prompt" {
                                       interact {
                                                -o
                                                 timeout 5 {
                                                 send_user "Onetime hash = [fakehash $pass]\n" ; send "\r\n" 
                                                 }
                                        }
                          }

                         eof {send_user "\n Id at $spawn_id, died unexpectedly..\n"}
                         timeout {send_user "\n $spawn_id timed out..closing.."}
                          
            }

Good luck.
 
Thanks I definately find this usefull!!!!

Simp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top