Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- # -*- coding: utf-8 -*-
- """Brut force d'un chiffre de césar sur un mot (assisté par dictionnaire).
- Le fichier liste.de.mots.francais.frgut.txt est accessible librement sur le net. Il doit être placé dans le répertoire d'exécution.
- (sous licence WTFPL: http://sam.zoy.org/wtfpl/).
- 03/08/2012, by Ginko."""
- import sys, string
- text = sys.argv[1]
- abc = string.ascii_lowercase
- def import_dico():
- dico = []
- with open('liste.de.mots.francais.frgut.txt', 'r') as f:
- for line in f:
- dico.append(line.rstrip('\n'))
- return dico
- mots_fr = import_dico()
- def shift_table():
- """Generator that shift the table."""
- for i in range(26):
- yield "".join((abc[i:], abc[:i]))
- for a in shift_table():
- trans = text.translate(string.maketrans(abc, a))
- if trans in mots_fr: print trans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement