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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSH workaround

Status
Not open for further replies.

dmelle

Technical User
Jan 26, 2002
14
US
Ok, so I am a procomm lover, and the powers that be here locked down all telnet access and no we can only use SSH :(

So, I started up a script to telnet into a local server and then SSH from there.. I have not put much time at all into it, so currently the script just pops up an input dialog box to insert a manual ip for the end device, telnets and logs into the server, then SSH's to the ip that was input and logs in.. Works fine, but I would like to see if I can set something up where I just hit a connection in the connection directory and it goes out and does the functions of the script automatically.. Or something to that effect. Basically, I would rather not have to manually put in an IP address lol... Any input would be appreciated :)

Here is the wimpy stuff that I have written so far. Server and route usernames, IP's and passwords have been changed in here for obvious reasons. They are static in the script so my replacements should not be looked on as variables...


string RouterIP,RouterTelnet
integer Event,QuitCheckbox



proc main

dialogbox 0 81 22 244 87 2 "Router Selection"
editbox 8 70 20 110 11 RouterIP
pushbutton 1 68 48 40 13 "Go!!!!!" DEFAULT
checkbox 150 132 49 42 11 "Quit" QuitCheckbox
enddialog



while 1
dlgevent 0 Event ; Get dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase
case 1 ; Button was pressed.
exitwhile ; Exit the while loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy dialog box.


strfmt RouterTelnet "ssh -l routeruname %s^M" RouterIP

CONNECTMANUAL TELNET "Server ip x.x.x.x"
waitfor "login: "
transmit "serveruname^M"
waitfor "Password: "
transmit "serverpw^M"
waitfor "[dmelle@server1 ~]$ "
transmit RouterTelnet
waitfor "password: "
transmit "routerpw^M"
endproc
 
OK, I figured it out myself.. And is was one of those "Keep it simple stupid" kinda things... lol.. SO I just have all of my connections set up in the connection directory, and attach the RouterLogin script to run on connection. Here is the contents of that script and it pulls the ip from the current connection directory entry that launched the script...


string RouterIP,RouterTelnet

proc main



RouterIP = $IPADDRESS

strfmt RouterTelnet "ssh -l neteng %s^M" RouterIP ;Includes Router Username in SSH string

CONNECTMANUAL TELNET "x.x.x.x" ;Server IP address
waitfor "login: "
transmit "xxxxxx^M" ;Server Username
waitfor "Password: "
transmit "xxxxxx^M" ;Server Password
waitfor "[dmelle@server1 ~]$ "
transmit RouterTelnet
waitfor "password: "
transmit "xxxxxx^M" Router Password
endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top