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-16-2013, 04:13 PM
night_hawke night_hawke is offline
Registered User
 
Join Date: Mar 2011
Posts: 19
Search data from csv

Ok, so i have an interesting problem. 4095 devices i need to access via securecrt, however we must connect through another server to have access to them.

What i need is for a script that can search a csv file for a hostname (user defined) and ssh into the ip address. the Csv is hostname,ip. the hostname is 4 characters long.

EXAMPLE

4001,192.168.1.1
4002,192.168.1.2
4003,192.168.1.3

is this possible?
Reply With Quote
  #2  
Old 07-16-2013, 04:26 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,309
Hello night_hawke,

What version of SecureCRT are you using?

On what operating system?

Quote:
Ok, so i have an interesting problem. 4095 devices i need to access via securecrt, however we must connect through another server to have access to them.
By ssh into the ip address, is this the command you will be issuing from the shell prompt of the [an]other server (ssh 192.168.1.1, ssh 192.168.1.2, etc.)?

How will you be connecting to the other server to have access to them?

Do you want to save sessions for the 4095 devices or will this just be ad hoc connections?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 07-17-2013, 01:38 PM
night_hawke night_hawke is offline
Registered User
 
Join Date: Mar 2011
Posts: 19
Quote:
Originally Posted by bgagnon View Post
Hello night_hawke,

What version of SecureCRT are you using?

On what operating system?



By ssh into the ip address, is this the command you will be issuing from the shell prompt of the [an]other server (ssh 192.168.1.1, ssh 192.168.1.2, etc.)?

How will you be connecting to the other server to have access to them?

Do you want to save sessions for the 4095 devices or will this just be ad hoc connections?
I'm using SecureCRT 7.0 on Windows 7 64-bit.

I will be issuing the command ssh 192.168.1.1 from a jumpbox location. I have a session created for the jumpbox from there we can ssh into any of the 4095 devices in our network. The connections to the 4095 devices will be ad hoc connections.
Reply With Quote
  #4  
Old 07-17-2013, 02:26 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,309
Hi night_hawke,

Thanks for the clarification.

I will assume then you will already be connected to the jumpbox and so you just want to be able to look up the IP based on alias (first field) and connect to the device using the second field.

I think this would best be handled by creating a dictionary. I happen to have an example script, which I have attached.

In your scenario, instead of the message box (lines 73-74) that displays the alias/host pair found, you would instead maybe have:

Code:
crt.Screen.Send "ssh " & strHost
Then, if you need to perform other work you could then follow with WaitForString() and Send() as needed.

See the scripting manual on our website here for additional information on VBScript and SecureCRT.
Attached Files
File Type: txt AliasSearchForHostUsingDictionary.vbs.txt (2.6 KB, 250 views)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
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:37 AM.