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 10-27-2017, 12:54 PM
SimonHF SimonHF is offline
Registered User
 
Join Date: Sep 2005
Posts: 42
Cross platform scripting?

Unfortunately it is not an option for me to use SecureCRT on Windows. Instead I use it on OSX. I notice that most of the scripting examples run on Windows.

Is there a web page / info somewhere which describes which scripting functionality works on which OS platform? If my wish came true then Perl would be possible on OSX... :-)
Reply With Quote
  #2  
Old 10-27-2017, 01:18 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,449
Hi SimonHF,

What are you trying to accomplish?

You can use Python on Mac OS and we do have some Python examples. You might just try using the script recorder in SecureCRT (Script menu / Start/Stop Recording Script).

I have added this thread to a feature request in our product enhancement database to add scripting support for Perl (Mac, Linux). Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to support@vandyke.com and include "Feature Request - Forum Thread #12879" in the subject line or use this form from the support page of our website.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 10-27-2017, 06:11 PM
SimonHF SimonHF is offline
Registered User
 
Join Date: Sep 2005
Posts: 42
Hi Brenda,

Thanks for the quick response.

One thing which attracted me to the script facility is the ability to log in on many boxes. I work with Amazon EC2 a lot and the number of boxes and IPs change all the time. It's relatively easy to get a list of e.g. 100 IPs of similar boxes but difficult to then manually log in on each box. If I could script logging in and hand the script the 100 IPs then this would be very useful for me. You say Python is the only scripting language available for OSX. Do you happen to have an example Python script which will log in on n boxes given a list of IPs?

Thanks,
Simon
Reply With Quote
  #4  
Old 10-28-2017, 07:34 AM
GJB56 GJB56 is offline
Registered User
 
Join Date: Nov 2011
Posts: 22
I found this on the forum a while ago and it is a timesaver. Get a list of IPs from the clipboard and store into an array. Then your script can just loop through the array and connect to each host.

Code:
Sub Get_Hosts_From_Clipboard()
' Start of with a reasonable size for the array
	ReDim vSessionsArray(64)
	strClip = crt.Clipboard.Text
' Split up the selected text into separate lines. ' First, let's standardize the text by making sure ' each line is separated by only a carriage return.
	strClip = Replace(strClip, vbcrlf, vbcr)
	strClip = Replace(strClip, vblf, vbcr)
' Now, use Split() to create an array out of each of the lines.
	vSessionsArray = Split(strClip, vbcr)
' Remove leading and trailing spaces
	For Each strSession In vSessionsArray
		strSession = Trim(strSession)
	Next
End Sub
Reply With Quote
  #5  
Old 10-30-2017, 07:02 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,449
Hi Simon,

GJB56's example does illustrate the concept, but is VBScript unfortunately.

Is your goal to create sessions? Or do you just want to make ad hoc connections?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #6  
Old 10-30-2017, 10:27 AM
SimonHF SimonHF is offline
Registered User
 
Join Date: Sep 2005
Posts: 42
From time to time I've found it necessary to run a command on a larger number of boxes which tend to have an ever changing list of IPs or names making it impossible to save the login in SecureCRT. The largest group I've tried so far is ssh'ing into 63 boxes. However, this is significant keyboard and mouse time in the SecureCRT GUI just to log on to all of them. Finally once connected then I can send a command to all of them concurrent and see the results in each GUI tab. What I'm looking for is a way to automated the connection process. And secondly, 63 tabs still works in SecureCRT, but what if I wanted to do the some thing with e.g. 630 IPs? Presumably the GUI would bork at handling 630 tabs?

So I'd love to have a script on Linux allowing me to connect to many boxes. Or better a feature in SecureCRT where I can just past multiple IPs in the connect host dialog field. But going forwards I'm wondering what the limits are regarding the number of hosts which can be connected to and what good strategies are for automating ssh commands to very many hosts?
Reply With Quote
  #7  
Old 10-30-2017, 10:42 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,449
Hi Simon,

I am assuming that means no, you don't care to save the sessions.

In that case, the Python example scripts in this post would probably suit you best.

I agree, I think trying to make 630 connections in the GUI would not be advisable.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #8  
Old 10-30-2017, 12:06 PM
SimonHF SimonHF is offline
Registered User
 
Join Date: Sep 2005
Posts: 42
What about SecureCRT adding features to directly support connecting to clusters like other ssh tools (e.g. cssh [1]) have? -- Simon

[1] https://www.linux.com/learn/managing...ers-clusterssh
Reply With Quote
  #9  
Old 10-30-2017, 01:15 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,449
Hi Simon,

Are you familiar with SecureCRT's command window?
Command (Chat) Window Video
http://www.youtube.com/watch?v=-OhccJcsoyI
The difference I can see from the tool you referenced is command window is static (enabled from the View menu). So I have added this thread to a feature request in our product enhancement database to add the ability to have a floating command window that sends its output to more than one session. Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to support@vandyke.com and include "Feature Request - Forum Thread #12879" in the subject line or use this form from the support page of our website.

If using v8.1.x or later, you can combine tab groups with command window to control which sessions receive the commands. Or, if you prefer tiles (enabled via Window menu) as illustrated in the article, any locked session does not receive commands.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #10  
Old 10-30-2017, 01:37 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,449
Hi Simon,

I guess the "cluster part" of that functionality was not addressed.

I have created a feature request on your behalf in our product enhancement database to add the ability to connect and send commands to large number of devices more efficiently (like clusterssh). Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to support@vandyke.com and include "Feature Request - Forum Thread #12879" in the subject line or use this form from the support page of our website.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #11  
Old 10-30-2017, 03:36 PM
SimonHF SimonHF is offline
Registered User
 
Join Date: Sep 2005
Posts: 42
Yes, and also cssh is able to connect to the boxes in a cluster without having to rely on a scripting language solution like SecureCRT does? -- Simon
Reply With Quote
  #12  
Old 10-30-2017, 03:57 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,449
Hi Simon,

Quote:
... without having to rely on a scripting language solution like SecureCRT does?
That seems like a bit of a mischaracterization.

You do not have to use a script to make connections in SecureCRT. You can create saved sessions. That was my point in asking the earlier question:
Quote:
Is your goal to create sessions? Or do you just want to make ad hoc connections?

Scripts are just a way to help you do repetitive tasks easier. If the task you need to accomplish is more suited to having saved sessions, we have an example script here that would allow you to create saved sessions from your device list.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #13  
Old 10-30-2017, 04:42 PM
SimonHF SimonHF is offline
Registered User
 
Join Date: Sep 2005
Posts: 42
Unfortunately I can only make ad-hoc connections. Like I said before, saving sessions does not work very well with Amazon EC2 because the boxes come and go so often. Make sense?
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 09:30 AM.