Skip to content

Commit e943fc2

Browse files
committed
Cisco UnCipher - Reverse Type 7 Passwords
1 parent 2df2d28 commit e943fc2

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

cisco-uncipher.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Uncipher Cisco type 7 ciphered passwords
3+
Usage: python uncipher.py <pass> where <pass> is the text of the type 7 password
4+
Example:
5+
$ python uncipher.py 094F4F1D1A0403
6+
catcat
7+
"""
8+
import fileinput
9+
import sys
10+
11+
global key
12+
key = [0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b, 0x66, 0x6f, 0x41,
13+
0x2c, 0x2e, 0x69, 0x79, 0x65, 0x77, 0x72, 0x6b, 0x6c,
14+
0x64, 0x4a, 0x4b, 0x44, 0x48, 0x53, 0x55, 0x42]
15+
16+
def uncipher(ciphertext):
17+
try:
18+
index = int(pw[:2],16)
19+
except ValueError:
20+
return ''
21+
pw_text = ciphertext[2:].rstrip()
22+
pw_hex_values = [pw_text[start:start+2] for start in range(0,len(pw_text),2)]
23+
pw_chars = [chr(key[index+i] ^ int(pw_hex_values[i],16)) for i in range(0,len(pw_hex_values))]
24+
pw_plaintext = ''.join(pw_chars)
25+
return pw_plaintext
26+
27+
try:
28+
for pw in fileinput.input():
29+
30+
print uncipher(pw)
31+
except:
32+
pw = sys.argv[1]
33+
print uncipher(pw)
34+

0 commit comments

Comments
 (0)