diff --git a/.gitignore b/.gitignore index 0d20b64..9335c31 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.pyc +*.todo \ No newline at end of file diff --git a/Context.sublime-menu b/Context.sublime-menu index c122efe..1dfa36f 100644 --- a/Context.sublime-menu +++ b/Context.sublime-menu @@ -40,6 +40,13 @@ { "command": "generate_password", "caption": "Generate Password (32 char)", "args": {"length": "32"} }, { "command": "generate_password", "caption": "Generate Password (40 char)", "args": {"length": "40"} }, { "command": "generate_password", "caption": "Generate Password (64 char)", "args": {"length": "64"} }, + { "command": "generate_password_spec_symbols", "caption": "Generate Password with spec symbols (6 char)", "args": {"length": "6"} }, + { "command": "generate_password_spec_symbols", "caption": "Generate Password with spec symbols (8 char)", "args": {"length": "8"} }, + { "command": "generate_password_spec_symbols", "caption": "Generate Password with spec symbols (12 char)", "args": {"length": "12"} }, + { "command": "generate_password_spec_symbols", "caption": "Generate Password with spec symbols (16 char)", "args": {"length": "16"} }, + { "command": "generate_password_spec_symbols", "caption": "Generate Password with spec symbols (32 char)", "args": {"length": "32"} }, + { "command": "generate_password_spec_symbols", "caption": "Generate Password with spec symbols (40 char)", "args": {"length": "40"} }, + { "command": "generate_password_spec_symbols", "caption": "Generate Password with spec symbols (64 char)", "args": {"length": "64"} }, { "caption": "-" }, { "command": "decode_heidi_sql", "caption": "Decode HeidiSQL password"}, { "caption": "-" }, diff --git a/Default.sublime-commands b/Default.sublime-commands index 87138e3..8bd88ed 100644 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -126,6 +126,41 @@ "command": "generate_password", "args": {"length": "64"} }, + { + "caption": "String Utilities: Insert Password (6 char)", + "command": "generate_password_spec_symbols", + "args": {"length": "6"} + }, + { + "caption": "String Utilities: Insert Password (8 char)", + "command": "generate_password_spec_symbols", + "args": {"length": "8"} + }, + { + "caption": "String Utilities: Insert Password (12 char)", + "command": "generate_password_spec_symbols", + "args": {"length": "12"} + }, + { + "caption": "String Utilities: Insert Password (16 char)", + "command": "generate_password_spec_symbols", + "args": {"length": "16"} + }, + { + "caption": "String Utilities: Insert Password (32 char)", + "command": "generate_password_spec_symbols", + "args": {"length": "32"} + }, + { + "caption": "String Utilities: Insert Password (40 char)", + "command": "generate_password_spec_symbols", + "args": {"length": "40"} + }, + { + "caption": "String Utilities: Insert Password (64 char)", + "command": "generate_password_spec_symbols", + "args": {"length": "64"} + }, { "caption": "String Utilities: Decode HeidiSQL password", "command": "decode_heidi_sql" diff --git a/stringutilities.py b/stringutilities.py index 3d64037..2167fa3 100644 --- a/stringutilities.py +++ b/stringutilities.py @@ -385,13 +385,20 @@ def run(self, edit, length=16): length = int(length) self.view.insert(edit, self.view.sel()[0].begin(), ''.join(sample(self.chars, length))) +class GeneratePasswordSpecSymbolsCommand(sublime_plugin.TextCommand): + chars = "0123456789abcdefghijkmnpqrstuvwxyzABCDEFGHKMNPQRSTUVWXYZ%*)?@#$~" + + def run(self, edit, length=16): + length = int(length) + self.view.insert(edit, self.view.sel()[0].begin(), ''.join(sample(self.chars, length))) + class DecodeHeidiSqlCommand(sublime_plugin.TextCommand): # Requires .strip('\x00') on output otherwise sublimetext adds a 'NUL' control chracter def run(self, edit): for region in self.view.sel(): if not region.empty(): text = self.view.substr(region) - if text[0].isdigit(): text = self.decodeHeidi(text) + if text[0].isdigit(): text = self.decodeHeidi(text) self.view.replace(edit, region, text) def decodeHeidi(self, hex_in):