Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 08-11-2014, 10:09 AM
Casey Casey is offline
Registered User
 
Join Date: Oct 2011
Posts: 114
For Users Wanting Help With RegEx Keyword Colorization

I absolutely love the keyword colorization in the SecureCRT 7.3. If you happen to use Cisco gear and want a bit of a head start on creating your own keyword list, then you may use mine as a template if you wish.

I do a lot of work in Cisco IOS routers/switches, Nexus Switches, and ASAs. My keyword file is setup to assist me with that. I find it helpful and hopefully you will too.




I'm constantly changing my keyword file. Feel free to change it up as much as you wish. I'm not married to it; I'm just trying to help out the community here.

Here's some basic steps that I would recommend for installing:
  1. Set your Terminal color screen to Monochrome (black and white), but then change the BLACK font to GRAY. To me, the black text simply seems too harsh on the eyes. Gray text helps the colors flow better and my eyes bleed less.
  2. Save the attached keyword file to the "Keywords" folder within your configuration folder and then select it within the SecureCRT GUI (Make sure you check the 'Color' checkbox).
  • Attached are some screen caps to hopefully help out.
  • For me, I made the changes to my 'default session' so that all sessions are affected. It's up to you on how you choose to proceed.
  • If you want the keyword list to change the default font color for you (and ignore step 1 above), you can edit the last rule titled ".*|setasregextosetdefaultcolor" and check the RegEx check box. It will then manually force your default color to gray.


Holler if you have any questions. My RegEx code may not be the most efficient, and that's largely due to the fact that I only started learning this stuff once SecureCRT started supporting it.

Take care...

[Edit 10/24/2014]
Uploaded new 'Cisco Words' keyword file; tweaked wording in post.
Attached Images
File Type: jpg SecureCRT - Change Font to Gray.jpg (149.8 KB, 23333 views)
File Type: jpg SecureCRT - Locate Config Path.jpg (77.7 KB, 26458 views)
File Type: jpg SecureCRT - Select Keyword File in Dropdown list.jpg (88.4 KB, 27842 views)
File Type: jpg SecureCRT - Sample1.jpg (367.8 KB, 29741 views)
File Type: jpg SecureCRT - Sample2.jpg (244.6 KB, 24730 views)
File Type: jpg SecureCRT - Sample3.jpg (165.1 KB, 24134 views)
Attached Files
File Type: zip Cisco Words.zip (1.7 KB, 10347 views)
File Type: ini Cisco Words.ini (4.0 KB, 18032 views)

Last edited by jdev; 02-14-2019 at 10:02 AM. Reason: Embedded graphics into post for efficient viewing, and made links to .ini file within for ease of acces
  #2  
Old 08-11-2014, 11:46 AM
sintrix sintrix is offline
Registered User
 
Join Date: Mar 2014
Posts: 4
Cisco Guy Here. NICE WORK DUDE. Lovin it
  #3  
Old 10-24-2014, 12:41 PM
Casey Casey is offline
Registered User
 
Join Date: Oct 2011
Posts: 114
Updated keyword file in parent post for those interested...
  #4  
Old 06-20-2015, 09:59 AM
luupski luupski is offline
Registered User
 
Join Date: Apr 2012
Posts: 8
Explanation

Casey,

is there any info somewhere that would explain the regex lines in your file
I tried to find and play around with some, but was not successfull

thnx in advance

Cheers
  #5  
Old 06-22-2015, 08:49 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi luupski,

While Casey has been kind enough to post his keyword highlighting solution, and may have time to answer questions or add to the documentation, we are happy to answer any specific questions you have.

What specific regex problem are you trying to solve?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
  #6  
Old 06-22-2015, 09:00 AM
luupski luupski is offline
Registered User
 
Join Date: Apr 2012
Posts: 8
Todd,

thnx for your reply

I do like what casey has done !

I was trying to have only the Serial interface# with the IP address highlighted at the show ip int brief command
Secondly to have the IP address and the Packets input and the CRC errors highlighted with their individual counts in the show interfaces Serial#

So i can see what the IP is, the amount of packets input and the CRC errors at a glance

Thank you in advance for your reply

Luupski
  #7  
Old 06-22-2015, 09:06 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Luupski,

I guess I should have qualified my post. I can help you with keyword highlighting, but I have no knowledge of what you want to highlight. It sounds like you want to highlight data that has spaces in it, but I am not sure.

Would you post an example of the output you want to highlight?

If there are spaces, then you will have to use multiple keywords.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
  #8  
Old 06-22-2015, 09:31 AM
luupski luupski is offline
Registered User
 
Join Date: Apr 2012
Posts: 8
Todd,

I have highlighted in red what needs to be highlighted when i run the commands, and yes, unfortunately there are spaces

Thnx

Luupski



R2#sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unset up up
Serial3/0 192.168.1.25 YES manual up down


R2#sh int s3/0
Serial3/0 is up, line protocol is down
Hardware is M4T
Internet address is 192.168.1.25/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, crc 16, loopback not set
Keepalive set (10 sec)
Restart-Delay is 0 secs
Last input 00:49:02, output 00:00:03, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: weighted fair
Output queue: 0/1000/64/0 (size/max total/threshold/drops)
Conversations 0/1/256 (active/max active/max total)
Reserved Conversations 0/0 (allocated/max allocated)
Available Bandwidth 1158 kilobits/sec
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
1 packets input, 24 bytes, 0 no buffer
Received 1 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
288 packets output, 8205 bytes, 0 underruns
0 output errors, 0 collisions, 2 interface resets
0 output buffer failures, 0 output buffers swapped out
3 carrier transitions DCD=up DSR=up DTR=up RTS=up CTS=up
  #9  
Old 06-22-2015, 10:47 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Luupski,

SecureCRT does not currently support spaces, so regular expressions will not work tie data separated by spaces together.

You will need to create separate keywords for each item that you want to highlight. The draw back of this solution is that you have no way of associating a number with a string or a string with a string separated by spaces which you are trying to do in a few places.

So the question is, are having trouble highlighting words, or were you having trouble trying to highlight words separated by spaces?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
  #10  
Old 06-22-2015, 11:14 AM
luupski luupski is offline
Registered User
 
Join Date: Apr 2012
Posts: 8
Todd,

The trouble is to highlight the values for example the CRC value

Luupski
  #11  
Old 06-22-2015, 11:23 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Luupski,

There is no good way to accomplish your goal since spaces (phrases) are not currently supported. The "0" is just not unique enough to be meaningful if it were highlighted independently of "CRC".

I have created a feature request to add highlighting support for "phrases" as opposed to "words". Should we add this feature, we will post to this forum thread.

If you would like to be notified directly, please complete and submit the form at the following location:
Submit Feature Request
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
  #12  
Old 06-24-2015, 10:15 AM
Casey Casey is offline
Registered User
 
Join Date: Oct 2011
Posts: 114
Quote:
Originally Posted by luupski View Post
Casey,

is there any info somewhere that would explain the regex lines in your file
I tried to find and play around with some, but was not successfull

thnx in advance

Cheers
There's no description field when creating a rule, so the best I was able to do was to prefix each colored section with something like: "[*] Interfaces" or "[*]SubnetMask,IP,_IP:Port,IP/SubnetMask"

If you need help with a specific rule explanation, I can try to explain what I was going after when creating it. The rules aren't guaranteed to be the most efficient with their matches. Often they are only what I was able to come up with at the time or perhaps the first match I got from a google search.

Not being able to match over spaces is a drag, however this is keyWORD matching and not keyPHRASE matching.
  #13  
Old 10-14-2015, 12:15 PM
pavel.skovajsa pavel.skovajsa is offline
Registered User
 
Join Date: Mar 2015
Posts: 2
Hello,

I cannot thank more the VanDyke team for this feature. For people working 7 hours a day with Cisco CLI this is really a killer feature for us and our whole org.

One of my colleagues has developed alternative to Casey's Cisco Words, for those who are using Traditional color scheme - you can find it attached.

The only small request I have with this feature is that I wish the regex parsing would be little faster. There is really a speed difference when doing "show log" and scrolling with and without the feature turned on. After all regex parsing is O(n) using the old NFA -> DFA algorithm, so arguing it is computationally intensive won't help you
  #14  
Old 10-14-2015, 04:24 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi pavel.skovajsa,

Thanks for the post and feedback about keyword highlighting.

I have created a feature request to improve performance when using regular expressions. We will post to this thread if we are able to improve the performance in a future SecureCRT release.

If you would like to be notified directly, please complete and submit the form at the following location:
Submit Feature Request
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
  #15  
Old 10-14-2015, 04:45 PM
pavel.skovajsa pavel.skovajsa is offline
Registered User
 
Join Date: Mar 2015
Posts: 2
Apparently I cannot port attachments so I am attaching links from box.com

Cisco Words for BlackBckgrd.ini

My colleague noticed the .ini file syntax uses 00+blue+green+red format, so he created a very nice Excel Spreadsheet with a small macro if you want to play with colors some more.

Enjoy!
Attached Images
File Type: png Spreadsheet_ScreenShot.png (269.8 KB, 1735 views)
File Type: png Spreadsheet_MacroCode_Screenshot.png (17.1 KB, 856 views)
Attached Files
File Type: ini Cisco Words for BlackBckgrd.ini (4.0 KB, 3615 views)
File Type: zip CiscoWords.xlsm.zip (31.3 KB, 613 views)

Last edited by jdev; 03-19-2019 at 12:54 PM. Reason: Upload .ini file; include screen-shot of spreadsheet colors and macro code, make .xlsm avail as .zip download
Closed Thread


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 08:04 AM.