-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfb.py
More file actions
36 lines (22 loc) · 765 Bytes
/
Copy pathfb.py
File metadata and controls
36 lines (22 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import base64
from des import des_decrypt, des_encrypt
cipher_base64 = "h+F7XMoHpF0="
cipher_bytes = base64.b64decode(cipher_base64)
def try_keys(wordlist):
for word in wordlist:
key_text = word.strip()
if len(key_text) != 8:
continue
key = int.from_bytes(key_text.encode(), "big")
try:
decrypted = des_decrypt(cipher_bytes, key)
text = decrypted.decode(errors="ignore")
if all(32 <= ord(c) < 127 for c in text):
print("Posible clave:", key_text)
print("Mensaje:", text)
print("-"*40)
except:
pass
with open("words.txt", "r") as f:
wordlist = f.readlines()
try_keys(wordlist)