Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 03-23-2020, 08:26 AM
pfistyle pfistyle is offline
Registered User
 
Join Date: Nov 2010
Posts: 11
Tabname

Hi,

Sorry to open a thread, but I'm desperate. I really checked for hours for a solution to my problem. If there is THE existing thread, which could bring me to my solution, please just paste me the link... Read several, got no working solution.

Situation: I connect over sessions to linux jumphosts, from there to network devices (mostly cisco routers).

I would like the to have the tab name to be set to the actual hostname of the device I am connected to.

How can this be done as easy as possible? Thank you for any help.
Reply With Quote
  #2  
Old 03-23-2020, 08:57 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

It's likely the info is in several threads, but it's easier just to cover it again than to find it. (One of the reasons we prefer you just contact support@vandyke.com instead of using forums.)

First, though, have you considered using the alternate way of connecting through jump hosts implemented in v7.1
:

Changes in SecureCRT 7.1 (Beta 1) -- February 26, 2013
------------------------------------------------------

New features:

  • Added support for dependent sessions so that a connection can be made to a jump host or SSH gateway before the session is connected.
That way your "end host" tab always will have the session name you have designated.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 03-23-2020, 09:14 AM
pfistyle pfistyle is offline
Registered User
 
Join Date: Nov 2010
Posts: 11
Hi Brenda,

Thank you for your help.

I don't think that option would fit for me. I need to be able to work on the jumphost and sometimes connect to another host (router). As soon as I connect, I would the tabname to be the same as the hostname of the device I'm logged in on...

Normally I have several tabs open and would like to know, if they are connected to the jumphost or any other device.
Reply With Quote
  #4  
Old 03-23-2020, 09:29 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

No worries, that is the case on occasion unfortunately.

Are you on Windows or Mac?

I think the attached script is the best solution but presently it is VBScript only.

It does require you configure it as a logon script so that it is "always ready" for when you might "ssh host". See the comments in the script.

If that won't fit your environment, let me know. There might be another solution.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 03-23-2020, 09:45 AM
pfistyle pfistyle is offline
Registered User
 
Join Date: Nov 2010
Posts: 11
Hey Brenda,

It works almost perfectly, thank you.

The only problem is, that when I log out of a host and connect to another, the tab name stays the same as the hostname of the device I connected to first.

Is there a solution for this problem?

Thanks!
Reply With Quote
  #6  
Old 03-23-2020, 09:49 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

Please describe how you are doing this (in detail):
Quote:
...that when I log out of a host and connect to another...
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 03-23-2020, 09:52 AM
pfistyle pfistyle is offline
Registered User
 
Join Date: Nov 2010
Posts: 11
Hey,

I am logged into a linux jumphost.

Then I connect to a router (A) --> the tab name is changed to it's hostname

Then I exit the router

Then I connect to another router (B) --> the tab name stays router A's hostname

Thank you.
Reply With Quote
  #8  
Old 03-23-2020, 10:00 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

How do you connect to router (A)? Do you type "ssh routerA"?

How do you exit the router? Do you type "exit"?

How do you connect to router (B)?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #9  
Old 03-23-2020, 10:02 AM
pfistyle pfistyle is offline
Registered User
 
Join Date: Nov 2010
Posts: 11
Hi Brenda,

I do a ssh or telnet to router A

I do an "exit" to log out router A

I do a ssh or telnet to router B

Thx.
Reply With Quote
  #10  
Old 03-23-2020, 10:38 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

Does the jump host shell prompt match router B's?

That's the one caveat to using this script. The jump host's shell prompt must be different and unique from any other shell prompt in order for the script to work properly. That's how it detects you have exited a session with a host.

Can you change your prompt on the jump host?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #11  
Old 03-24-2020, 12:15 AM
pfistyle pfistyle is offline
Registered User
 
Join Date: Nov 2010
Posts: 11
Hi Brenda,

I log in/out like this:

me@linux:~$ t router1
Trying 2.2.2.2...
Connected to router1

This system is for the use of authorized users only.


Username: me
Password:

router1#exit
Connection closed by foreign host.
me@linux:~$ t router2
Trying 1.1.1.1...
Connected to router2

This system is for the use of authorized users only.


Username: me
Password:

router2#exit
Connection closed by foreign host.
me@linux:~$

After connecting to router1, the tab name stays router1...

Thank you!
Reply With Quote
  #12  
Old 03-24-2020, 07:59 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

Change line 40 in the script to accommodate your $ prompt.

From:

Code:
        strText = objTab.Screen.ReadString("#", ">", 5)
to:

Code:
        strText = objTab.Screen.ReadString("#", ">", "$", 5)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #13  
Old 03-24-2020, 08:43 AM
pfistyle pfistyle is offline
Registered User
 
Join Date: Nov 2010
Posts: 11
Hi Brenda,

Thx, but this does not help. Now the tabname stays always the name of the jumphost I connect to initially.

Thank you!
Reply With Quote
  #14  
Old 03-24-2020, 09:32 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

Is Cancel available from the Script menu?

If so, if you select it, what is the error message?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #15  
Old 03-24-2020, 11:43 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,282
Hi pfistyle,

I misunderstood the execution of the script, I thought it was designed to run until cancelled, but that is not the case.

Try the new attached one.
Attached Files
File Type: txt NameTabBasedOnShellPrompt(LoopsForever).py.txt (3.7 KB, 36 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

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:07 PM.