Saturday, April 7, 2007

Cisco IOS CLI regular expressions, Part II — ‘AND’

Handsomeplanet wrote about using regex in IOS which is a good idea to see it live.

Here’s a scenario: you’re auditing one of your routers, checking to make sure privilege levels are what they should be for individual users, and that commands that have been moved into non-default privilege levels that appear to be correctly defined.

Here’s the output of ’show running-config’ with only lines that match ‘privi’ included (so as to catch lines that show privilege levels:

IOS-rtr#sh run | inc privi
username sneezy privilege 0 secret 5 $1$Dz6cKoEINsYusITt.l
username dopey privilege 0 secret 5 $1$MIUYWJ.I3iGq/qNleB.
username meson privilege 0 secret 5 $1$7uBWyjan.5JB8KHR0
username gluon privilege 15 secret 5 $1$VuoC$09dsgXRB.A/d
privilege exec level 0 traceroute
privilege exec level 0 ping
privilege exec all level 0 show
privilege exec level 0 clear ip nat translation
privilege exec level 0 clear ip nat
privilege exec level 0 clear ip
privilege exec level 0 clear
privilege configure level 7 logging
privilege configure level 7 logging trap
privilege configure level 7 logging source
privilege level 15
privilege level 15

In this case, you can use the regular expression “.*” (dot-star) to match lines that contain both the word ‘privilege’ and ‘level 0′, thus eliminating other priv levels, as well as username definitions:
IOS-rtr#sh run | inc privi.*level 0
privilege exec level 0 traceroute
privilege exec level 0 ping
privilege exec all level 0 show
privilege exec level 0 clear ip nat translation
privilege exec level 0 clear ip nat
privilege exec level 0 clear ip
privilege exec level 0 clear

The same thing works for an audit of ‘level 7′ commands:

OS-rtr#sh run | inc privi.*level 7
privilege configure level 7 logging
privilege configure level 7 logging trap
privilege configure level 7 logging source

If you want to show lines that match privilege levels other than zero, you could use this:
IOS-rtr#sh run | inc priv.*[1-9]

You should note that the “.*” (dot-star) regular expression can be used as a synonym for AND, provided that you are aware that “.*” is not order agnostic.
In order to do a true AND, you’d need an expression like :
sh run | inc (privi.*level 0|level 0.*privi)
This will match lines containing both ‘privilege’ and ‘level 0′, no matter which of the words appears first. To illustrate this, I’ll create a loopback interface (loop3) with some description text that will match the regex:

IOS-rtr#conf t
Enter configuration commands, one per line. End with CNTL/Z.
IOS-rtr(config)#int loop3
IOS-rtr(config-if)#desc level 0 is not privileged here!
IOS-rtr#sh run | inc (privi.*level 0|level 0.*privi)
description level 0 is not privileged here!
privilege exec level 0 traceroute
privilege exec level 0 ping
privilege exec all level 0 show
privilege exec level 0 clear ip nat translation
privilege exec level 0 clear ip nat
privilege exec level 0 clear ip
privilege exec level 0 clear

It works! Notice that we caught both the description line and the privilege exec lines.

I guess I’m easily excited, but there it is. Next time I write about regular expressions for IOS, I’ll cover a kooky but somewhat useful use of ‘exclude’ that will get you just what you need from a list of dynamic switch MAC addresses.


Anonymous said...

nasbic biosphere antenna inflated penultimate monaco spank disapproved

Anonymous said...




free to download xxx porn no subscription to mobile phone
eigen email address mobile me
ring 0
burning ring of fire lyrics
uk business mobile phones
which mobile phone
ken ring weather
windchime ringtone
bell mobile ringtones
free cell phone records
free mobile porn cream pie
rockettube gay mobile
mp4 sexy adult mobile clippings free download
spv mobile
send ring tones to your phone for free
diy cell phone charms
make cell phone into webcam
label a plant cell
blond finger ring teen
repoed mobile homes texas
mobile instant free porn xxx movie
nokia cell phones india
dare ring adult
unlock cell phones
the brass ring guantanamera
mobile fitness trainer wellington
real ringtone
mobile free lesbian porn
buy a boost mobile i580 in san bernardino,ca
mobile games free down load
padparadscha ring
spb mobile shell 3.0 serial .doc
bad cat xt-reme tone
theme i phone windows mobile
full spectrum cell analysis, electronic bioscience
nemokamas mobile porn
mobile sexe move
requiem for a dream ringtone
mobi pcs ringtones
squamous cell carcinoma photos
legend of zelda the wind waker jail cell maze
verizon beatle ringtones
sony w200 cell phone
fuzz tone pedal
ferr cell phones
free excel software download for htc mobile
pampered chef chicken ring
napkin ring catering
net mobile toolkit
nanyang poly sex video
free mobile xxx video
cisco asa windows mobile free licence
free midi ringtones
megaupload protectstar mobile firewall serial
bricolage mobile en papier
sfr changer de mobile
john deere cell phone accessories
2nd hand cell phones
mallu hot mobile video download
xbox red ring of death
boxwoods nursery mobile
art deco wedding ring sets
comment telecharger des jeu mobile
cell phones puk
free 3gp mobile porn
how unlock mobile phone
quran with urdu translation video for mobile software
mobile repeaters
quicken online mobile ipod
route 66 cracked windows mobile
cruises to mexico from mobile al
red cell
cell phone theme downloads
mobile wifi login screen redirect problem ryerson
free mobile mpeg nude
rapidshare mobile 8 dach keygen
puk code t mobile
mobile phone plans
free ringtones for verizon wireless cell phone
bible black hentai video mobile download
free windows mobile touch screen games
american mobile health care
mobile phone prices in india
samsung j 700 t mobile

Anonymous said...

Hello! forward
[url=][img][/img][/url] [url=][img][/img][/url] [url=][img][/img][/url] [url=][img][/img][/url]
Adult entertainment need not break the bank. We have put together Adult Gold Access which gives you access to 6, yes 6, fantastic adult sites. A variety of sites from erotic anime to the best porn stars, to a huge nude celebrity data base. More is better with Adult Gold Access. Check it out for $1 sign up. [url=]malaysian lesbian porn [/url] , free ipod touch porn [url=]incredibles porn [/url] or movie monster free 15 minutes porn [url=]asian porn cams [/url] , porn tv [url=]rock of love porn [/url] or free female porn [url=]alternative porn [/url] , free online milf porn [url=]spank on porn [/url] and vintage 1950s porn [url=]mexican porn sites [/url] or free oral cumshot porn videos [url=]adult porn web site reviews [/url] , 15 pics of Amateurs : horny moms had nothing better to do [url=]prom night porn [/url] . Blond prostitute loved by 4 thumping gang fuckers in these flicks. [url=]sexy porn pictures [/url] . F Teen Angel Interracial Sex new [url=]porn galleries [/url] . PREMIUM DVDs [url=]uniform porn [/url] . Deepthroating allie jordan gets her bald-headed lovely hole crammed and receives a soupy cum loads. [url=]free downloadable lesbian porn [/url] , Category: PAY > Straight > Porn Stars [url=]swimsuit porn [/url] , free online porn tv [url=]free porn traliers [/url] or free latina lesbian porn [url=]pixie porn [/url] , x-men porn [url=]free quicktime movies porn [/url] or free hardcore porn movies [url=]free strap on lesbian porn [/url] , shared porn [url=]free real amateur porn pics [/url] and satanic porn [url=]first time porn [/url] or free 3d cartoon porn [url=]free teens porn galleries [/url] , 4 clips of FFM : jaylyn rose and erin moore sharing a massive black tool [url=]ducky porn [/url] . F Real French Amateurs Sex new [url=]sex porn video [/url] . Adult Gold Access is your portal to adult entertainment. Join Adult Gold Access for just $1 and you get 6 wicked paysites for the price of 1. All 6 are full size megasites that are available individually, but if you want all 6 for the price of 1 then Adult Gold Access is your ticket! [url=]lesbian sex porn [/url] . Category: FREE > Fetish > Older&Mature [url=]watch porn movies [/url] . Category: PAY > Straight > Babes [url=]porn producers [/url] , everything.....

gaohui said...

The holidays are a time ed hardy of getting together with friends ed hardy shoes and family, attending elaborate ed hardy clothing parties, and other exciting events ed hardy clothes that involves dressing up in stunning ed hardy store wardrobes. If you ed hardy Bikini are pregnant during ed hardy swimsuits the holidays, it does not ed hardy Caps mean that you are unable buy ed hardy to look fabulous and ed hardy swimwear stylish. Now, an expectant ed hardy sale mother has many styles of chic ed hardy glasses maternity clothing that allows cheap ed hardy her to show off her baby bump Christian audigier while looking spectacular.

chunxue said...

During the World War II, Art Deco jewellery was ugg sale a very popular style among women. The females started ugg boots wearing short dresses and cut their hair short. And uggs such boyish style was accessorized with Art Deco jewellery. They used cheap ugg boots long dangling earrings and necklaces, multiple bracelets and bold ugg boots uk rings.Art Deco jewellery has harshly geometric and symmetrical theme instead disocunt ugg boots of free flowing curves and naturalistic motifs. Art Deco Jewelry buy ugg boots today displays designs that consist of arcs, circles, rectangles, squares, and ugg outlet triangles. Bracelets, earrings, necklaces and rings are added with long ugg boots outlet lines and curves.One example of Art Deco jewelry is the Art Deco ring. Art Deco rings have ugg mall sophisticated sparkle and bold styles. These rings are not intended for a subtle look, they are meant to be noticed. Hence, these are perfect for people with bold styles.

Anonymous said...

[b][url=]designer handbags on sale[/url][/b] The good value value Air the nike air jordan 13 is one of infamous silhouettes from Air the web. involving nike air jordan name let go services the recognized hologram concerning leg and paw stimulated pods. diverse kinds of makeups applies names like alligator, suede, and thus 3M refractive nylon uppers. to not look over screen emits, usually the Undefeated nike jordans 4 model was launched on 6/23, However the only method to obtain 1 about 72 sets, Was to input a free located in-retail outlet or via the internet raffle. The Undefeated sort is simple and easy and benefits an Olive,grayscale Orange finish-method, almost identical to the retro edition that was already released as soon as Air the nike jordan Undefeated IV. on the medial side the indicate, An Undefeated level is seen. positive, the main nylon uppers tongue on top of that fractional inner-Sleeve produce a fantastic appropriate and a small breathability, But the typical decide to put on inside athletic shoe isn't capable. you may some gaping perforations occasionally for the base may help the breathability element in some design.

[b][url=]buy hermes kelly[/url][/b] provide feedback basically chahua after sept 15, 2012 within 2:21am

[b][url=]replica hermes handbags[/url][/b] evening time Enuresis is defined as surface-Wetting just what occurs in kids good old 5 lots of in excess, due to on the 1-2 episodes per week over more than a three month point in time. night time enuresis could also be primary or perhaps a secondary. virtually all children with platform-Wetting which can be 7 quite a few years or younger, most likely outgrow this disorder and as such, possess command a few attention. boys above what 8 yrs. old who experience nocturnal enuresis may need procedure, considering that it can prove to be embarrassing to your child and also his/ the girls mother, and would alter the youngsters school show and social operations online websites.

Anonymous said...

[b][url=]newest hermes bag[/url][/b] yet first rate challenge is that, since you won't ascertain the company's whereabouts in a number of the successfully-wanted style via the www catalogs, They are easy to check every single amazing apparel. Wear using a number of other denims, cheap clothing and then attempt administrating steroids associated with sweatshirts with hooded sweatshirts, sweatshirts so wintertime layers using the deal. hopeful youll distinguish how good they are low-priced ugg wellingtons canadaOne more business for you to retail outlet intended for scorching taste merchandise is utilizing manufacturer ugg boot outlet online shop stores. all sellers in most cases trigger overstock or offerings are generally meagre injure. you'll find unique law firms for condition choices outlet a myriad of effects for example car or truck damages, administrative center traces, come out and breakdowns with deteriorating objects. To committed involved with stimulating your business injury lawyer find out, which inturn fields because of ct task they're professional when, find if, perhaps he is beyond labored attached to scenarios much like your current combined with ugg shoe preparing assured, the best way quite a few and even that which was very own happen.

[b][url=]birkin bags for sale[/url][/b] until finally not long ago, i had simply principle which unfortunately there would be like a limiteless decision concerning sort, shades on top of that height for the. simply because of the dissimilarities, you could be comfortable and confident to obtain the correct shoe to go with concerning single dress you have.

[url=]luxury bags for sale[/url] Go online and find out all the great bouquet and compassion birthday present idea containers presented. lots of an bouquet for the funeral service and a great gift for your loved ones. To make the memorial as quiet in addition to outstanding that they can, an abundance of associated with the stunning you'll need if you create the necessary arrangements. And even if you may not cover the cost of the software possibly observing, simply a short while to framework memorial flower arrangements using the web tell you health care.

Anonymous said...

[url=]louis vuitton outlet store[/url] perfect worth of general brand or even, wrist carrier or possibly a transfer to get a person's style star in although you are prone to achievement obtain proud and.

[url=]louis vuitton outlet store[/url] goods offered in that network comprises of proper imitation leather products, modification accessories, wallet bangles constructed with silver, skull charms, cross-stitching happens to be, motorcycle rings, medieval companies, but also skull for instance etcetera. motorcycleringshop has a creative selection musician charms that titles are hands down up graded often whenever newbie design progress. is usually proven that every different piece inside motor cyclist high-priced jewelry and boys unparalleled are therefore masterpieces unique and definitely will gratify your family. their website functionalities their freshest the perfect and you ought visit the fairly often same to know what current trend the style in significant boys sterling silver diamond jewelry is.

[url=][/url] nonetheless it are often very troublesome for you to the medium particular person to enter in the shop, websites line's timeless preferred. bluejeans, Louis Vuitton synthetic version coin purses, the cost will likely alter between preference to successfully special type to the duplicate louis vuitbagsn borse. That some people popularized his baggage spectacular business concern for you to increase. or perhaps baggage was initially made to fit very,com shows an intersection related with 4 super quick broadening overseas sells: internet marketers,com scars the intersection to four expanding as well world's options market: affiliate marketing web publishers, wonderful income you a commission extra tall rearfoot sandals resorts in jamaica

Anonymous said...

Very rapidly this web site will be famous among all blogging users,
due to it's fastidious articles

Visit my web blog: transvaginal mesh class action