8 Useful Tips & Tricks for SecureCRT
SecureCRT is powerful, high-usability terminal emulator.
I found some useful tips & tricks when using SecureCRT, which are summarized below.
Copy & Paste
When using terminal window, we often need to copy & paste text content.
In SecureCRT, we can easily copy and paste text with one click of the mouse.
Color Scheme
SecureCRT has multiple color schemes built in, and we can create/edit Custom Color Schemes.
We can also find shared color schemes on GitHub.
Keyword Highlighting
Keyword highlighting allows us to focus on specific text content.
We need to create a keyword highlighting profile.
Regular expressions are based on the syntax used in Python. We can also use shared configuration files. The configuration file directory is in %appdata%\VanDyke\Config\keywords
, the suffix is .ini
. Download the configuration file on the official website or GitHub, then overwrite the configuration file.
The following is the configuration file I am using. Unfortunately, the source is no longer known, so I don’t know who the sharer is.
D:"Match Case"=00000000 Z:"Keyword List V2"=00000016 "(no(t)?(connect)?)|((shut)?(down)?)",000000ff,00000001 "(dis((able(d)?)|(connect(ed)?)|(allow(ed)?)|(card(ed)?))|(error(s)?))|(fail((ure)|(ed))?)|((city)?[w]{2}m)|(den((y)|(ied)){1})",000000ff,00000001 "red|administratively|undo|unknown|fault|block|refused|problem|warnings|alerts|critical|delete|inactive|unassigned",000000ff,00000001 "(([7-9]\d)|(100))(\.\d{0,2})?\%",000000ff,00000001 "green|up|forward|full|active",0000ff00,00000001 "(connect(ed)?)|(permit(ed)?)|(estab(lish)?(ed)?)|(enable(d)?|(allow(ed)?))",0000ff00,00000001 "(([0-3](\d)?)|\d{1})(\.\d{0,2})?\%",0000ff00,00000001 "(bgp|(ospf(v3)?)|(rip(ng)?)|eigrp|static|odr|unr|(is(\-)?is)|pim|direct)(\-\d*)?",00ff8000,00000001 "cyan|ipv6|tcp|udp|(i(c|g)mp)|gre|esp|ah|isakmp|(arp(a)?)|dhcp|(http(s)?)|dns|((t)?ftp)|telnet|ssh|www|ntp|radius|tacacs|pop\d|smtp|ppp|fr(ame(\-)?relay)?|hdlc",00ff8000,00000001 "standby|vrrp|glbp|(mst(p)?)|((r)?stp)|spanning\-tree|dot1q|802\.1q",00ff8000,00000001 "ldp|tdp|mpls|aaa|(account(ing)?)|(auth((entication)|(orization)))|nat|bfd|nqa|sla|rtr|vrf|vpn(\-instance)?",00ff8000,00000001 "(((passive\-)|(silent\-))?interface)|(in|out)((bound)|(put))?",00ff00ff,00000001 "magenta|router|redistribute|(import(\-route)?)|export|network|neighbor|peer|area|acl|(class((ifier)|(\-map)))|behavior|policy(\-map)?",00ff00ff,00000001 "access\-((list)|(class)|(group))|ip\-prefix|prefix\-list|(route(\-.*)?)|(traffic.*)",00ff00ff,00000001 "[4-6]\d((\.\d{0,2})?)\%",00ff00ff,00000001 "((fast)?|(gigabit)?)ethernet((\d)?\d\/)*(\d)+(\.\d{1,4})?",000080ff,00000001 "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/(\d){0,2})?",000080ff,00000001 "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}(\/(\d){0,3})?",000080ff,00000001 "([0-9a-fa-f]{4}[.|-][0-9a-fa-f]{4}[.|-][0-9a-fa-f]{4})|([0-9a-fa-f]{2}[.|-]){5}[0-9a-fa-f]{2}",000080ff,00000001 "\d{1,2}\.([0-9a-fA-F]{2,4}.){1,11}\d{1,2}",000080ff,00000001 "(orange|ge|fa|fe|(eth((\-)?(trunk)?))|null|loopback|tunnel|dialer|bri|serial|atm|pos|(vlan(if)?))(((\d)?\d\/)*(\d)+)?",000080ff,00000001 "((virtual\-(template|ppp|access))|(channel\-group)|(port\-channel)|(ether(\-)?channel))(((\d)?\d\/)*(\d)+)?",000080ff,00000001
If we need to display the color, we need to check the color option.
My SecureCRT window looks like this.
Scrollback Buffer
The default Scrollback Buffer on SecureCRT is 500, but 500 lines are not enough in many situations such as show tech or show run.
We can adjust the Scrollback Buffer up to 128000.
Anti Idle
The Anti Idle function on SecureCRT can be used to prevent the Telnet/SSH client session automatically disconnecting due to timeout.
Many computer protocols, such as telnet, include a NOP command that a client can issue to request a response from the server without requesting any other actions. Such a command can be used to ensure the connection is still alive or that the server is responsive.
NOP protocol commands
Importing SecureCRT Sessions
Usually we can manually add SecureCRT Sessoins, but sometimes we need to add a lot of Sessoins. SecureCRT scripts are used to perform automated tasks, and importing Sessions is one of them.
We can download the script here and import the pre-edited CSV file. Note that the file must be saved as ANSI, otherwise the task will fail.
The available fields are as follows.
session_name
The value that will be used for the session’s name. If this field does not exist, the hostname field is used as the session_name.folder
A relative folder path for the specified session (not including the session name) as displayed in the Session manager. Any folder that does not exist will be automatically created as the script runs.hostname
Required. The hostname or IP address for the remote server.protocol
Required. The protocol to be used for connecting with the session (SSH2, SSH1, Telnet, or RLogin).port
The port on which the remote server is listening.username
Username for the account on the remote server.emulation
The emulation (vt100, xterm, etc.).description
Comment/description. Multiple lines are separated with \r.
The result after executing the script is as follows.
Auto Save Session Logs
We can use SecureCRT to automatically save logs to improve efficiency.
For the log file name, the available variables are as follows.
%H
– hostname (not valid with protocols that do not specify a host, such as Serial)%S
– session name%Y
– four-digit year%y
– two-digit year%M
– two-digit month%D
– two-digit day of the month%P
– port (not valid with protocols that do not specify a port, such as RLogin)%h
– two-digit hour%m
– two-digit minute%s
– two-digit seconds%t
– three-digit milliseconds%F
– directory path starting below the “Sessions” folder%%
– percent (%)%envvar%
– environment variable
SecureCRT will automatically save logs whenever we connect to Telnet/SSH.
The result looks like this.
Upload & Download
SecureCRT supports Zmodem protocol, we can use SecureCRT to upload or download files.
Install lrzsz
on the server.
root@yang-explorer-1:~# apt install lrzsz Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libdumbnet1 Use 'apt autoremove' to remove it. Suggested packages: minicom The following NEW packages will be installed: lrzsz 0 upgraded, 1 newly installed, 0 to remove and 25 not upgraded. Need to get 74.8 kB of archives. After this operation, 531 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu eoan/universe amd64 lrzsz amd64 0.12.21-10 [74.8 kB] Fetched 74.8 kB in 1s (66.4 kB/s) Selecting previously unselected package lrzsz. (Reading database ... 155145 files and directories currently installed.) Preparing to unpack .../lrzsz_0.12.21-10_amd64.deb ... Unpacking lrzsz (0.12.21-10) ... Setting up lrzsz (0.12.21-10) ... Processing triggers for man-db (2.8.7-3) ... root@yang-explorer-1:~#
Use sz
to download files and rz
to upload files.
root@yang-explorer-1:~# root@yang-explorer-1:~# mkdir test root@yang-explorer-1:~# cd test root@yang-explorer-1:~/test# root@yang-explorer-1:~/test# rz rz waiting to receive. Starting zmodem transfer. Press Ctrl+C to cancel. Transferring devices.csv... 100% 190 bytes 190 bytes/sec 00:00:01 0 Errors root@yang-explorer-1:~/test# ls devices.csv root@yang-explorer-1:~/test# sz devices.csv rz Starting zmodem transfer. Press Ctrl+C to cancel. Transferring devices.csv... 100% 190 bytes 190 bytes/sec 00:00:01 0 Errors root@yang-explorer-1:~/test#
References
Example: Import Keyword Highlighting INI File
SecureCRT-Cisco-Highlighting
SecureCRT Text Highlighting
How to setup automatic session log on SecureCRT
Keep SecureCRT SSH Sessions from Disconnecting
Importing SecureCRT® Sessions from a Data File
Example: Import Arbitrary Data From File To SecureCRT Sessions
Solarized
Overview of Color Configuration in SecureCRT®
NOP protocol commands
Update on September 17, 2021
If you want to open the ssh:// or telnet:// link with SecureCRT by default in the browser, you may need to change the registry.
Keys:
Computer\HKEY_CLASSES_ROOT\telnet\shell\open\command Computer\HKEY_CLASSES_ROOT\ssh\shell\open\command
Values:
"C:\Program Files\VanDyke Software\Clients\SecureCRT.EXE" /T %1
1 Response
[…] 8 Useful Tips & Tricks for SecureCRT […]