Skip to content

Commit 7600297

Browse files
committed
Cisco Password Recovery (Type 7) Utility
1 parent 8ca78aa commit 7600297

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Cisco Password (Type 7) Recovery Tool
2+
3+
A quirky script for recovering passwords encrypted using `service password-encryption` (Type 7) from old Cisco networking gear.
4+
Made to automate the recovery and exploration of old equipment found in lab storage.
5+
6+
> [!WARNING]
7+
> ## Disclaimer
8+
> This tool is provided for **educational and research purposes only**. It is intended exclusively for recovering passwords from your own equipment or systems you have explicit permission to access.
9+
>
10+
> **The author accepts no responsibility or liability** for any misuse of this script or for any unauthorized access attempts. Use of this tool against systems without proper authorization may violate computer crime laws and other regulations.
11+
>
12+
> By using this script, you acknowledge that you are solely responsible for how it is used and agree to use it only in legal and ethical ways.
13+
14+
## Getting Started
15+
16+
The scripts may require specific software and/or packages (See [Prerequisites](#prerequisites) for more information).
17+
18+
### Prerequisites
19+
20+
Tools and elements required to successfully use the script:
21+
22+
* [Python 3](https://www.python.org/) installed on the machine used for generation.
23+
24+
## Configuration
25+
26+
This script requires you to provide an array of passwords you wish to recover (saved in a variable as a list).
27+
28+
## Usage
29+
30+
To run this script you need to issue the following commands:
31+
32+
```properties
33+
# On windows
34+
python main.py
35+
36+
# On Linux/Unix based systems
37+
python3 main.py
38+
# or
39+
chmod +x ./main.py;
40+
./main.py
41+
```
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/python3
2+
3+
#
4+
## Script Name: Cisco Password-Encryption Decryptor
5+
## Author: unkn0wnAPI [https://github.com/unkn0wnAPI]
6+
## Information: Recover lost passwords from old Cisco network devices
7+
#
8+
9+
#
10+
## Configuration
11+
#
12+
PASSWORDS: list[str] = []
13+
14+
#
15+
## Global Variables
16+
#
17+
CISCO_KEYS: list[int] = [
18+
0x64, 0x73, 0x66, 0x64, 0x3B, 0x6B, 0x66, 0x6F,
19+
0x41, 0x2C, 0x2E, 0x69, 0x79, 0x65, 0x77, 0x72,
20+
0x6B, 0x6C, 0x64, 0x4A, 0x4B, 0x44, 0x48, 0x53,
21+
0x55, 0x42
22+
]
23+
24+
#
25+
## Functions
26+
#
27+
def type7_decryptor(passwd: list[str]) -> list[str]:
28+
global CISCO_KEYS
29+
30+
decrypted_passwords: list[str] = []
31+
for password in passwd:
32+
seed = int(password[:2])
33+
enc_bytes = password[2:]
34+
decrypted_password = ''
35+
36+
for i in range(0, len(enc_bytes), 2):
37+
byte = int(enc_bytes[i:i+2], 16)
38+
decrypted_password += chr(byte ^ CISCO_KEYS[(seed + i // 2) % len(CISCO_KEYS)])
39+
40+
decrypted_passwords.append(decrypted_password)
41+
return decrypted_passwords
42+
43+
def main() -> None:
44+
global PASSWORDS
45+
46+
print('===Cisco Password-Encryption (Type 7) Decryptor===')
47+
48+
if len(PASSWORDS) == 0:
49+
print('[ERROR] No passwords provided for decryption')
50+
return 1
51+
52+
print(f'[INFO] Found {len(PASSWORDS)} passwords to decrypt')
53+
decrypted_passwords: list[str] = type7_decryptor(PASSWORDS)
54+
print('[OUTPUT] Decrypted passwords (ENCRYPTED -> PLAIN TEXT):')
55+
56+
for x in range(len(PASSWORDS)):
57+
print(f' - {PASSWORDS[x]} -> {decrypted_passwords[x]}')
58+
59+
if __name__ == '__main__':
60+
main()

0 commit comments

Comments
 (0)