VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Cross platform scripting? (https://forums.vandyke.com/showthread.php?t=12879)

SimonHF 10-27-2017 12:54 PM

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... :-)

bgagnon 10-27-2017 01:18 PM

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.

SimonHF 10-27-2017 06:11 PM

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

GJB56 10-28-2017 07:34 AM

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


bgagnon 10-30-2017 07:02 AM

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?

SimonHF 10-30-2017 10:27 AM

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?

bgagnon 10-30-2017 10:42 AM

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.

SimonHF 10-30-2017 12:06 PM

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

bgagnon 10-30-2017 01:15 PM

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.

bgagnon 10-30-2017 01:37 PM

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.

SimonHF 10-30-2017 03:36 PM

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

bgagnon 10-30-2017 03:57 PM

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.

SimonHF 10-30-2017 04:42 PM

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?


All times are GMT -6. The time now is 12:41 PM.