Eli Fulkerson .com HomeProjectsOffline-console
 

Offline Console

"offline-console" is a python program that lets you browse a Cisco device configuration file as if you were logged into the device. Primarily, it allows the "show interface" style syntax to show the stanzas in the configuration file. It also provides tab completion, a searchable pager, and access via | to any of your other console tools. (Like ips. Do you know about ips? You should know about ips. ips is love.)

"offline-console" is purely a configuration viewer, it is not an IOS simulator or a virtual machine or anything of the sort. It is intended for the situation where you don't (or shouldn't) have access to the device in question, but still want to look up settings as if you were interacting with it normally.

Note: Seems to work fine under Linux, I use it myself under Cygwin on Windows. I am using the 'readline' library here, which I do not think is available on vanilla Windows Python.

Download:


Listing directory https://download.elifulkerson.com/files/offline-console/0.2: offline-console.py September 14 2017 14:16:22 9031 Python script, ASCII text executable offline-console.py.asc September 14 2017 21:12:40 801 GnuPG signature offline-console.py.md5 September 14 2017 21:12:40 53 MD5 checksum offline-console.py.sha1 September 14 2017 21:12:40 61 SHA1 checksum offline-console.py.sha256 September 14 2017 21:12:40 85 SHA256 checksum offline-console.py.sha512 September 14 2017 21:12:40 149 SHA512 checksumBrowse the download server

Syntax:

Starting the console...

Syntax:  python offline-console.py file1 file2 file3 file4....

Note here that you can open multiple text files simultaneously, they will be treated as one long stream of text in the order that you specified.

Using the console...

General Behavior
  - up/down arrow history, tab autocompletion of known words (generated from the config file)  Availablity of | and >
    to interact with your shell environment.

show ARG, show run ARG 
  - simulates a "show" command of the specified stanza.

show run ARG1 && ARG2
  - you can't do this in IOS.  Show as many different stanzas as you like, separated by &&

pager NUMLINES 
   - allows you to set the page length, by default 20 lines.  Anything output under NUMLINES is displayed normally,
     any output over NUMLINES is sent to the PAGER (see below)

| (pipe)
   - anything after | is piped out to your shell and executed as if you were in the shell.  For instance, if you want you
     can "show access-list | grep SOMETHING | grep -v SOMETHINGELSE" etc.  WARNING:  This runs *live* in
     your shell, it isn't restricted by offline-console.  Please be aware of what you are doing.

> (redirect output)
  - The > character also goes out to your shell and will redirect standard out to files as expected.  WARNING:  This runs
    *live* in your shell, it isn't restricted by offline-console.  Please be aware of what you are doing.

autocomp
  - Prints the autocomplete list that offline-console has built for the given input file.

help
  - Prints a help blurb

ver
  - Prints version information

exit
  - Exits offline-console

In the PAGER...

offline-console imports the pager from pydoc. When you get more lines of output than your pager setting (20 by default) you will be dropped into the pager, which has its own commands. The pager can be identified by its ":" prompt. The two pager commands you are going to want to know right off the bat are 'h' to pull up the pager help file and 'q' to leave the pager. Also of note is the ability to search and highlight the contents of the pager buffer with /.

Normally, the pager clears the window of its contents when you leave it, so in offline-console you will see a real fast dump of your results prior to the pager kicking in. This flash is just there so you still have your output after the pager closes.

Errata:

Currently it doesn't handle internal abbreviation very well. For instance "show interface" is fine, "show int" is fine. "Show interface Port-channel" is fine. However, "show int port-channel" will fail, because it is looking for the exact line starter "int port-channel". You would want to (for instance) "show int[tab] port[tab]" for that one.