-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcrypt.py
38 lines (28 loc) · 856 Bytes
/
crypt.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 detectEnglish,vigenereCipher,pyperclip
def main():
ciphertext = "CNVUT"
hackedMessage =hackVigenere(ciphertext)
if hackedMessage !=None:
print 'Copying hacked message to clipboard:'
print(hackedMessage)
pyperclip.copy(hackedMessage)
else:
print 'Failed to hack'
def hackVigenere(ciphertext):
fo=open('dictionary.txt')
words=fo.readlines()
fo.close()
for word in words:
word=word.strip()
decryptedText=vigenereCipher.decryptMessage(word,ciphertext)
if detectEnglish.isEnglish(decryptedText,wordPercentage=40):
#print()
#print 'Possible encryption break:'
#print 'Key' , str(word) , ':' , decryptedText[:100]
vigenereCipher.main(str(word))
#print 'Enter D for done'
#response = raw_input('')
#if response.upper().startswith('D'):
# return decryptedText
if __name__ == '__main__':
main()