Cisco devices running the Cisco IOS have three types of ways to display passwords in the device configuration which include Type 0, Type 5, and Type 7. Below we describe all three methods of storing passwords in the Cisco IOS device configuration and how to obtain the password from each method either by simply reading the password, by quickly converting the password from the Cisco defined encryption algorithm, or by cracking MD5 UNIX password hashes.
I spent a lot of time the other night trying to find a perl script that would decode Cisco type 7 password hashes and many of them did not work properly. At first I thought I was doing something wrong however I am pretty sure that most of the scripts were just broken. Anyhow I finally located the below script on some site and I can’t remember where I found it so I wanted to post it here mostly for reference however if someone else finds it useful then that would be great. Below is the actual script itself followed by an example of using the script.
Tonight I needed to console into a old Cisco 2900 switch to test a couple password related items and it was the first time that I would be using USB to Serial adapter on my Macbook. Previously there had been a lot of issues with the adapter I have, which is a PL-2303, and getting the right drivers installed on Windows 7 64-bit so I was thinking there might not even be drivers available for OSX Lion. After a little research I cam across an article that purehate had written on QD however after following the instructions in the article the USB to Serial adapter still was not working. Below is information on installing newer drivers that will work on OSX Lion.
Earlier tonight I created a little script that will run in cron on a Linux server. The script counts the number of directories and files in a specific directory and if the count is above Y then it deletes directories and files older than X number of days. In the example script below the number of items (directories and files) that have to be located in the directory before the script to delete files older than a specific date is 10. If there are ten items then the script will delete items older than 90 days. Below the script is the entry made in a specific users cron on the Linux server.
Earlier I was transferring some configuration files from an application on a Windows 7 computer to an application on a OSX Lion computer. The location of a file referenced in the configuration files had changed so I needed to update about a hundred different INI files with the new location. Doing this on OSX is very easy using perl as long as you get the syntax correct as it can be tricky if there are multiple quotes and or slashes. Below is a quick example of a perl command used to replace a single line of text in multiple files without having to modify each file individually.