diff --git a/locale/de/LC_MESSAGES/loxodo.mo b/locale/de/LC_MESSAGES/loxodo.mo index b22453c..df4e0f3 100644 Binary files a/locale/de/LC_MESSAGES/loxodo.mo and b/locale/de/LC_MESSAGES/loxodo.mo differ diff --git a/locale/de/LC_MESSAGES/loxodo.po b/locale/de/LC_MESSAGES/loxodo.po index 56a56b9..8f78315 100644 --- a/locale/de/LC_MESSAGES/loxodo.po +++ b/locale/de/LC_MESSAGES/loxodo.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Loxodo 0.0-git\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-12-26 01:57+0100\n" -"PO-Revision-Date: 2018-12-26 01:58+0100\n" +"POT-Creation-Date: 2018-12-30 18:07+0100\n" +"PO-Revision-Date: 2018-12-30 18:07+0100\n" "Last-Translator: Christoph Sommer \n" "Language-Team: Christoph Sommer \n" "Language: de_DE\n" @@ -127,13 +127,13 @@ msgid "Generated Password Length" msgstr "Generiere Passwörter mit Länge" #: ../src/frontends/wx/settings.py:51 -msgid "Avoid easy to mistake chars" -msgstr "Ohne leicht zu verwechselnde Zeichen" - -#: ../src/frontends/wx/settings.py:53 msgid "Alphabet" msgstr "Alphabet" +#: ../src/frontends/wx/settings.py:53 +msgid "Avoid Bigrams" +msgstr "Vermeide Bigramme" + #: ../src/frontends/wx/settings.py:76 msgid "Settings" msgstr "Einstellungen" @@ -288,6 +288,9 @@ msgstr "Konnte Passwort für \"%s\" nicht in Zwischenablage kopieren" msgid "Could not load python module \"webbrowser\" needed to open \"%s\"" msgstr "Konnte Python-Modul “webbrowser” nicht laden, um “%s” zu öffnen" +#~ msgid "Avoid easy to mistake chars" +#~ msgstr "Ohne leicht zu verwechselnde Zeichen" + #~ msgid "Changed title of \"%s\"" #~ msgstr "Titel von \"%s\" geändet" diff --git a/locale/loxodo.pot b/locale/loxodo.pot index 157da15..fdb7034 100644 --- a/locale/loxodo.pot +++ b/locale/loxodo.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-12-26 01:57+0100\n" +"POT-Creation-Date: 2018-12-30 18:07+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -128,11 +128,11 @@ msgid "Generated Password Length" msgstr "" #: ../src/frontends/wx/settings.py:51 -msgid "Avoid easy to mistake chars" +msgid "Alphabet" msgstr "" #: ../src/frontends/wx/settings.py:53 -msgid "Alphabet" +msgid "Avoid Bigrams" msgstr "" #: ../src/frontends/wx/settings.py:76 diff --git a/src/config.py b/src/config.py index aef6ad2..5f3fe84 100755 --- a/src/config.py +++ b/src/config.py @@ -34,10 +34,10 @@ def __init__(self): self._basescript = None self.recentvaults = [] self.pwlength = 10 - self.reduction = False self.search_notes = False self.search_passwd = False - self.alphabet = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_" + self.alphabet = "abcdefghikmnopqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ_" + self.avoid_bigrams = "cl mn nm nn rn vv VV" self._fname = self.get_config_filename() self._parser = SafeConfigParser() @@ -53,16 +53,9 @@ def __init__(self): break self.recentvaults.append(self._parser.get("base", "recentvaults" + str(num))) - if self._parser.has_option("base", "alphabet"): - self.alphabet = int(self._parser.get("base", "alphabet")) - if self._parser.has_option("base", "pwlength"): self.pwlength = int(self._parser.get("base", "pwlength")) - if self._parser.has_option("base", "alphabetreduction"): - if self._parser.get("base", "alphabetreduction") == "True": - self.reduction = True - if self._parser.has_option("base", "search_notes"): if self._parser.get("base", "search_notes") == "True": self.search_notes = True @@ -71,6 +64,12 @@ def __init__(self): if self._parser.get("base", "search_passwd") == "True": self.search_passwd = True + if self._parser.has_option("base", "alphabet"): + self.alphabet = self._parser.get("base", "alphabet") + + if self._parser.has_option("base", "avoid_bigrams"): + self.avoid_bigrams = self._parser.get("base", "avoid_bigrams") + if not os.path.exists(self._fname): self.save() @@ -95,9 +94,10 @@ def save(self): break self._parser.set("base", "pwlength", str(self.pwlength)) - self._parser.set("base", "alphabetreduction", str(self.reduction)) self._parser.set("base", "search_notes", str(self.search_notes)) self._parser.set("base", "search_passwd", str(self.search_passwd)) + self._parser.set("base", "alphabet", str(self.alphabet)) + self._parser.set("base", "avoid_bigrams", str(self.avoid_bigrams)) filehandle = open(self._fname, 'w') self._parser.write(filehandle) filehandle.close() diff --git a/src/frontends/wx/recordframe.py b/src/frontends/wx/recordframe.py index 3bc63e4..ca65800 100755 --- a/src/frontends/wx/recordframe.py +++ b/src/frontends/wx/recordframe.py @@ -176,7 +176,7 @@ def _on_toggle_passwd_mask(self, dummy): self._tc_passwd.SetFocus() def _on_generate_passwd(self, dummy): - _pwd = self.generate_password(alphabet=config.alphabet,pwd_length=config.pwlength,allow_reduction=config.reduction) + _pwd = self.generate_password(alphabet=config.alphabet,pwd_length=config.pwlength,avoid_bigrams=config.avoid_bigrams) self._tc_passwd.SetValue(_pwd) @staticmethod @@ -190,20 +190,15 @@ def _urandom(count): return retval @staticmethod - def generate_password(alphabet="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_", pwd_length=8, allow_reduction=False): - # remove some easy-to-mistake characters - if allow_reduction: - for _chr in "0OjlI1": - alphabet = alphabet.replace(_chr, "") - + def generate_password(alphabet="0123456789", pwd_length=8, avoid_bigrams=""): # iteratively pick one character from this alphabet to assemble password last_chr = "x" pwd = "" for dummy in range(pwd_length): - # temporarily reduce alphabet to avoid easy-to-mistake character pairs + # temporarily reduce alphabet to avoid easy-to-mistake bigrams alphabet2 = alphabet - if allow_reduction: - for _chr in ('cl', 'mn', 'nm', 'nn', 'rn', 'vv', 'VV'): + if len(avoid_bigrams) > 1: + for _chr in (avoid_bigrams.split(" ")): if last_chr == _chr[0]: alphabet2 = alphabet.replace(_chr[1],"") diff --git a/src/frontends/wx/settings.py b/src/frontends/wx/settings.py index 07122b3..370c18c 100644 --- a/src/frontends/wx/settings.py +++ b/src/frontends/wx/settings.py @@ -48,10 +48,10 @@ def __init__(self, parent): _sz_main.Add(_sz_fields, 1, wx.EXPAND | wx.GROW) - self._cb_reduction = self._add_a_checkbox(_sz_fields,_("Avoid easy to mistake chars") + ":") - self._tc_alphabet = self._add_a_textcontrol(_sz_fields,_("Alphabet")+ ":",config.alphabet) + self._tc_avoid_bigrams = self._add_a_textcontrol(_sz_fields,_("Avoid Bigrams")+ ":",config.avoid_bigrams) + _sz_fields.AddGrowableCol(1) _ln_line = wx.StaticLine(self.panel, -1, size=(20, -1), style=wx.LI_HORIZONTAL) @@ -117,7 +117,7 @@ def update_fields(self): """ self._sc_length.SetValue(config.pwlength) self._tc_alphabet.SetValue(config.alphabet) - self._cb_reduction.SetValue(config.reduction) + self._tc_avoid_bigrams.SetValue(config.avoid_bigrams) self._search_notes.SetValue(config.search_notes) self._search_passwd.SetValue(config.search_passwd) @@ -126,10 +126,10 @@ def _apply_changes(self, dummy): Update source from fields """ config.pwlength = self._sc_length.GetValue() - config.reduction = self._cb_reduction.GetValue() config.search_notes = self._search_notes.GetValue() config.search_passwd = self._search_passwd.GetValue() config.alphabet = self._tc_alphabet.GetValue() + config.avoid_bigrams = self._tc_avoid_bigrams.GetValue() config.save() def _on_cancel(self, dummy):