VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Launch New Sessions from host list (https://forums.vandyke.com/showthread.php?t=14432)

SeanL 02-18-2021 01:46 PM

Launch New Sessions from host list
 
Looking for a script or built in function that lets me launch a large number of sessions (10-100) at once. Ideally it would just use the same default session settings.

With the upgrade 9.0 today allowing python 3 i'm wondering if anyone has any ideas?

I've been using one for a while but it's a bit annoying to setup:
Code:

# $language = "python"
# $interface = "1.0"

# Connect to an SSH server using the SSH2 protocol. Specify the
# username and password and hostname on the command line as well as
# some SSH2 protocol specific options.


def main():
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 4494R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 4495R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 4499R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6401R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6402R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6403R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6404R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6405R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6406R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6408R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6409R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6411R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6413R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6416R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1534R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1546R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1570R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1586R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1608R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 1638R")
        crt.Session.ConnectInTab ("/SSH2 /AcceptHostKeys /L myUSERNAME /PASSWORD THISisAsecretPASWORD|THISisAsecretPASWORD 6439R")


               
main()


Ideally I'd like to be able to QUICKLY loop through a list of hostnames and launch a session for it.
Right now my script has to be manually edited with the new hostnames or IPs and it only starts launching the next session after about 3-5 seconds since launching the last one.


In the end I'll use the command window to send the same set of commands to all devices.

Any ideas would be much appreciated, thank you!

berdmann 02-18-2021 02:43 PM

Hi SeanL,

We have a script code example that shows how to instruct SecureCRT to establish ad-hoc connections to hosts listed one by one in the clipboard that I think might provide you with the functionality that you are looking for.

Please refer to the following link:
https://forums.vandyke.com/showpost....86&postcount=1
Does that seem like something that might work well for you?


All times are GMT -6. The time now is 09:07 PM.