-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreak_steb.py
More file actions
executable file
·64 lines (47 loc) · 1.22 KB
/
break_steb.py
File metadata and controls
executable file
·64 lines (47 loc) · 1.22 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
import itertools
import secretpy
steb_letters = [
"nprtx",
"ae",
"dhlnrtx",
"qrsty",
"jhgi",
"x",
"ae",
"nprtx",
]
def permute_steb(letters):
letters = [list(x) for x in letters]
perms = itertools.product(*letters)
return list(perms)
def get_english():
words = []
with open("american-english", "r") as e_dict:
for line in e_dict:
words.append(line.strip())
return words
def check_stebs(possibs, english_words):
all_chances = []
for chance in possibs:
if chance in english_words:
all_chances.append(chance)
print(chance)
return all_chances
def caesar_them(possibs, shift_amt):
cipher = secretpy.Caesar()
pts = []
for pos in possibs:
pt = cipher.decrypt(pos, shift_amt, secretpy.alphabets.ENGLISH)
pts.append(pt)
return pts
def main():
possibs = permute_steb(steb_letters)
possibs = ["".join(x) for x in possibs]
english_words = get_english()
eight_words = [x for x in english_words if len(x) == 8]
for i in range(26):
pts = caesar_them(possibs, i)
pts = check_stebs(pts, eight_words)
print("\n".join(pts))
main()