Esempio n. 1
0
 _minbound = int(sys.argv[3])
 _maxbound = int(sys.argv[4])
 
 if(_minbound > _maxbound):
     print("Incorrect bounds: minbounds must be lower than equal maxbounds")
     exit(-1)
 
 _filename = sys.argv[1]
 
 _langcode = str(sys.argv[2]).upper()
 _langdescription = AVAILABLE_LANG[str(sys.argv[2]).upper()]
 
 _selectedLanguage = None
 try:
     _selectedLanguage = Language(_langcode,_langdescription)
     _selectedLanguage.setLetterFrequency(loadFrequency(json.load(open(os.path.join(_LANGDIR_,"".join(["FREQ_",_langcode,".json"]))))))
 except:
     print("Problem in loading language "+_langcode)
     exit(-1) 
  
 _ciphertext = None    
 try:
     _ciphertext = CipherText(open(_filename,'rb').read())
 except:
     print("Problem in loading ciphertext")
     exit(-1)
 
 
 cracker = VigenereCracker(_selectedLanguage, _minbound, _maxbound)
 cracker.setContent(_ciphertext.getContentChar())