Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-02-2008, 05:24 AM
ruxi008 ruxi008 is offline
Registered User
 
Join Date: Jul 2008
Posts: 4
Flag "Login Script" in .ini Session Files

hi,

following situation:
one file with all nodes/hosts i would like to connect to.
one "basic" .ini Session file.

out of this files i generate 1 central session-folder by changing the "hostname" flag.
i also distribute the session-folder to several different users by changing the username.
------------------
now my problem:

some nodes are accessible only over one central ssh-hub. for them i activatet "Automated Logon" in menu "Logon Script". (Filled in 'ssh <nodename>' in field "send:").

looking the .ini files of this sessions i see an encrypted string for flag "Logon Script"...

----------------------
here my questions:
any ideas how i can generate this string out of the above mentioned hosts file?
any ideas how i can use a part of of the "session name" in a logon script to connect to different servers over one central ssh-hub?

version used: SecureCRT 5.0

regards
Philipp
Reply With Quote
  #2  
Old 07-02-2008, 10:00 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
SecureCRT 5.0 is a little bit out of date and it would be best to install the most current version available for your license. Could you send let us know your serial number via this form?

It would be best to have the most current version that your license will work with.

Could you also include any script you have written so that we can work with what you already have and be a little more specific?
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #3  
Old 07-03-2008, 01:23 AM
ruxi008 ruxi008 is offline
Registered User
 
Join Date: Jul 2008
Posts: 4
hi,

i put your update-suggestion to our sales department.

currently i manually set up the session-list on my workstation and change the user with the attached vbs script. here i didn't have the problem with the encryped "logon.." line because i duplicate it only...
-------------------
in future i would like to replace this manual intervention by generating the .ini Files automatically on a unix host:

here i have one centralized file including all hosts (+several other information) i would like to connect to:
...,
<hostname1> <hostinformation1> <crt-session-directory1>...
<hostname2> <hostinformation2> <crt-session-directory2>...
<hostname3> <hostinformation3> <crt-session-directory3>...
....

a daily/weekly batch job generates the Sessionfiles in this way:

/Config/Sessions/<crt-session-directory1>/<hostname1>-<hostinformation1>.ini
/Config/Sessions/<crt-session-directory2>/<hostname2>-<hostinformation2>.ini
/Config/Sessions/<crt-session-directory3>/<hostname3>-<hostinformation3>.ini

the batch job also replaces the username and generates a zip/tar file for each user of this folder afterwards. so our operators always have a actual list of host they have to connect to...
--------------
connection to host1-3 goes this way:

ssh <centralhub> ssh <host1>
ssh <centralhub> ssh <host2>
ssh <centralhub> ssh <host3>

so the only problem i have is to set up the hob over the centralhub...

regards
Attached Files
File Type: zip ChangeUser.zip (1.0 KB, 188 views)
Reply With Quote
  #4  
Old 07-03-2008, 10:10 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Your two objectives are not really related to SecureCRT in any way except that SecureCRT supports VBScript. Your questions are about VBScript.
Quote:
any ideas how i can generate this string out of the above mentioned hosts file?
I recommend downloading script56.chm for VBScript help. It's a great resource and will provide information about built-in functions like Split, Left, Right, etc..

There are many example scripts available on the Internet (some even within other forum posts on this site) that might help you parse data. Search for "Split+VBScript". I think that splitting on '/' would be useful for you. If you split on '/' and put the result in an array then I think hostname will be available as item 3 of the array.
/Config/Sessions/<crt-session-directory1>/<hostname1>
Quote:
any ideas how i can use a part of of the "session name" in a logon script to connect to different servers over one central ssh-hub?
Once you have parsed the string you only need to assign it to a variable (or use the array index). You could loop through the array after parsing it and use the variable if you want to connect to multiple servers.

Does this information help, or do you need more specific information?
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]

Last edited by jdev; 07-03-2008 at 10:32 AM.
Reply With Quote
  #5  
Old 07-04-2008, 03:49 AM
ruxi008 ruxi008 is offline
Registered User
 
Join Date: Jul 2008
Posts: 4
hi,

thank you!

one last question(this should be related SecureCRT):

>any ideas how i can use a part of of the "session name" in a logon script<

actual i have this simple "logon script" which is executed when i press the connect button
--------------------------------
Sub Main()
hostname = "aix0045a"
crt.Screen.Synchronous = True
crt.Screen.Send "/usr/bin/ssh " & hostname & vbcr
End Sub
--------------------------------
how to get the variable "hostname" out of the selected session-name?
Reply With Quote
  #6  
Old 07-04-2008, 08:44 AM
ruxi008 ruxi008 is offline
Registered User
 
Join Date: Jul 2008
Posts: 4
problem solved....

Sub Main()
hostname = crt.session.path
hostname = Left(hostname, InStrRev(hostname, "-") - 1)
crt.Screen.Synchronous = True
crt.Screen.Send "/usr/bin/ssh " & hostname & vbcr
End Sub

regards
Reply With Quote
  #7  
Old 07-05-2008, 10:18 AM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Hi ruxi008,

I'm glad you were able to find a solution - thanks for posting the solution!
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:40 AM.