Exemplo n.º 1
0
def VigenereCrack(message):
    with open('Wordlist.txt','r') as fo:
        words = fo.readlines()
  
    for word in words:
        word = word.strip() # Remove the newline at the end.
        cracked = Vigenere.decryption(word, message)
        #Will ask the user to decide with their human congitive ability to decide the result
        if detectEnglish.isEnglish(cracked, wordPercentage=40):
            print('\nPossible encryption hack:')
            print('Key ' + str(word) + ': ' + bcolors.OKBLUE+bcolors.UNDERLINE+cracked[:100]+"\n"+bcolors.ENDC)
            response = input('Press'+bcolors.FAIL+' G '+bcolors.ENDC+'if desired message is found! Else, continue: ')

            if response.strip().upper().startswith('G'):
                return cracked
    return None
Exemplo n.º 2
0
import Vigenere

if __name__ == '__main__':
    Vigenere.initializeDictionaries()

    # Test
    key = 'EncryptionKey'
    print('Key:', key)
    message = 'Some random text with UPPER and lower alphabets...!'
    print('Plain Text:', message)
    cipher = Vigenere.encryption(key, message)
    print('Ciphertext:', cipher)

    plain = Vigenere.decryption(key, cipher)
    print('Plain Text:', plain)
Exemplo n.º 3
0
                    )
                    keyStatus = False

            if keyStatus:
                print('Encrypted Text:', end=' ')
                cipher = Vigenere.encryption(key, message)
                print(cipher)

        elif ch == 2:
            cipher = input('Enter your cipher to be decrypted: ')
            key = input('Enter your encryption key: ')
            keyStatus = True
            for k in key:
                if not k.isalpha():
                    print(
                        'Your encryption key should be consisted of alphabets only!'
                    )
                    keyStatus = False

            if keyStatus:
                print('Decrypted Text:', end=' ')
                message = Vigenere.decryption(key, cipher)
                print(message)

        elif ch == 0:
            print('Exit....')
            break

        else:
            print('Wrong input!')