#! /usr/bin/perl -p # Decrypt Cisco-encrypted passwords in configuration files. Perl # version; requires perl 4.036 minimum. Unlike many similar tools # circulating on the net, this one also works for passwords longer # than 11 characters (i.e. doesn't chop after 11 chars and doesn't # get confused with newer IOS versions which have alleviated this # limit). # # Absolutely no warranties whatsoever. Use at your own risk. No # batteries included. Not suitable for children under 3 years. # # Written and © by Helge Oldach <ciscocrack@oldach.net> # # You are not expected to understand this code, although the algorithm # is really blatantly stupid. Look how short it is in perl. @tbl = unpack("C*", "dsfd;kfoA,.iyewrkldJKDHSUBsgvca69834ncxv9873254k;fg87"); ($pre, $dummy, $seed, $pwd, $dummy, $suf) = ($_ =~ /^(.*\s+(password|md5)\s+)7\s+([0-1][0-9])(([0-9A-F][0-9A-F])+)(.*)$/); if ($pwd) { $_ = $pre; foreach $p ($pwd =~ /../g) { $_ .= pack("C", hex $p ^ $tbl[$seed++]); $seed %= $#tbl; } $_ .= $suf . "\n"; }
or
join([chr(int(x[i:i+2],16)^ord('dsfd;kfoA,.iyewrkldJKDHSUBsgvca69834ncxv9873254k;fg87'[(int(x[:2])+i/2-1)%53]))for i in range(2,len(x),2)])
No comments:
Post a Comment