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

Can Procomm be setup to use SSH login?

Status
Not open for further replies.

comtechau

Technical User
Mar 24, 2007
81
AU
I'm hoping for some insight into a niggly problem... I love Procomm for its versatility... But I want to modify a script to attempt an SSH connection if TELNET fails. I am currently using Procomm to control PuTTY with sendkeystr / sendvkey commands....
My problem is I cannot see/script for what responses occur to PuTTY.
I've been able to monitor the PuTTY Window's Titlebar Text to determine if an error occurs when connecting, but I'd like to monitor what is really occuring within the window...as I can when using Procomm for a TELNET connection.
IS THERE ANYWAY TO MANAGE THIS?
I wrote a script that backsup ~650 Router & Switch configs using CiscoTFTP and TELNET. I need to mod the script to try PUTTY if TELNET fails, which I have done as below.

BUT - I am hoping there is a better way...



Code:
PROC PUTTY
SwapStr = "D:\Putty\putty -load jssh -l <my account name> -pw <my password>"
strcat SwapStr IPADDStr
run SwapStr TaskId 
pause 2
taskwin TaskId WinId       ; Get window id for task.
winfocus WinId             ; Set focus to PUTTY's window.
pause 2   



;check to see if Security Alert Occurs
wintext $ACTIVEWIN TempStr
IF strfind TempStr "Security Alert" ; we have a security alert
	sendkeystr "y"
	pause 2
ENDIF
;end check




if winexists WinId
	
wintext WinId TempStr
  
  IF NOT strfind TempStr "(inactive)" ;check and make sure window is NOT inactive
	
	sendkeystr "COPY RUN TFTP"
	mspause 500
	sendvkey 0x0D	;ENTER KEY
	pause 1

	;obtain IP by stripping '^M' off end of SNMPHost string
	SwapStr = SNMPHost
	strrev SwapStr
	substr TempStr SwapStr 2 13
	strrev TempStr
	sendkeystr TempStr ;IP of SNMPc machine
	pause 1


	sendvkey 0x0D	;ENTER KEY
	pause 1

	
	;SET FILENAME
	strcat NameStr ".cfg" ;add .cfg extension
	tempstr = NameStr ;save current value of NameStr 
		;write PUTTY LOG FILE
		if fopen 7 "deleteme.txt" APPEND TEXT ;log file
		      	strcat NameStr ", <-> ,"
		        strcat NameStr IPADDStr
		      	fputs 7 NameStr
			fclose 7
		endif
		;end PUTTY LOG FILE
	
	
	SENDKEYSTR NameStr
	pause 1
	sendvkey 0x0D	;ENTER KEY
	

	pause 12 ; and pray the download finishes soon or we're shot
	
	;close putty window
	sendvkey 0x473 ;send ALT-F4
	mspause 500
	sendvkey 0x0D	;ENTER KEY
	  
  ENDIF


else
    	;putty did not work either 
	clear	;clearscreen
    	termputs 3 1 "Connect Failed..." 
    	termputs 3 18 cisco_ip  
	confail ++ 	;count the connection failures
	pause 1
	call erras
	 


endif

ENDPROC

 
Hmm, can't help you with this specific problem, but WinSCP has is scriptable. I'm using that in applications where Procomm doesn't quite fit my needs. But there was a post recently about someone doing something similar to you, it might be worth your while to search for that.
 
I'll have to post it when I get home, but a couple people have sent me some SSH/Procomm integration suggestions in the past that I haven't posted to my web site yet.

 
Thanks for the tips.
WinSCP looks an interesting option.
I've also tried the JHMI link - no luck as yet.
I might be trying the impossible...If I get anywhere with this I'll post an update.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top