-
Notifications
You must be signed in to change notification settings - Fork 0
/
Base64Solver.py
42 lines (30 loc) · 869 Bytes
/
Base64Solver.py
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
37
38
import enchant
import base64
def solvebase64values(text):
dictionary = enchant.Dict("en_US")
print("\n")
print("\tRunning Base 64 Decoder on input string " + text)
print("\tAll Possible Solutions strings : \n")
text.strip()
try:
result = base64.standard_b64decode(text)
result = result.decode("unicode_escape")
except:
print("base64 aborted")
return ""
print("\t" + result)
result.strip()
result_words = result.split(" ")
correctness = 0
for word in result_words:
result_word = ""
for l in word:
if l.isalnum() and l != " ":
result_word += l
result_word.strip()
try:
correctness += 1 if dictionary.check(result_word) else -.5
except:
pass
if correctness > 0:
return result