├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── demo.png └── src ├── 1C1236B0-F0F6-4EF7-BBDF-3B05247A4DBC.png ├── generator.py ├── icon.png └── info.plist /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | max_line_length = 80 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.py] 13 | indent_size = 4 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | logs 3 | *.log 4 | .vscode -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Emmanuel Pilande 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

Alfred Password Generator 🗝

3 |
4 | 5 |

6 | Simple password generator with customizable characters
7 | 8 |

9 | 10 | ## Why? 11 | 12 | Need a quick and simple password generator with customizable characters. 13 | 14 | ## Installation 15 | 16 | 1. Download the Alfred Workflow ([Password-Generator.alfredworkflow](https://github.com/epilande/alfred-password-generator/releases/latest/download/Password-Generator.alfredworkflow)). 17 | 1. Double-click to import into Alfred (requires Powerpack). 18 | 1. Customize workflow variables `letters`, `digits`, `punctuation` (see [Variables](#variables)). 19 | 20 | ## Usage 21 | 22 | `pw {length}` - Generate password with `{length}` characters. If `{length}` not specified, `defaultLength` will be used. 23 | 24 | ## Variables 25 | 26 | | Key | Default | Description | 27 | | --------------- | ------------------------------------------------------ | -------------------------------- | 28 | | `defaultLength` | `16` | Password length. | 29 | | `letters` | `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` | Letters allowed in password. | 30 | | `digits` | `0123456789` | Digits allowed in password. | 31 | | `punctuation` | `!"#$%&'()*+,-./:;<=>?@[]^_{\|}~` | Punctuation allowed in password. | 32 | 33 | ## More workflows 34 | 35 | - 🔍 [alfred-browser-tabs](https://github.com/epilande/alfred-browser-tabs) - Search browser tabs from Chrome, Brave, & Safari. 36 | - 🤫 [alfred-be-quiet](https://github.com/epilande/alfred-be-quiet) - Workflow to automatically pause audio/video playing. 37 | - 🔐 [alfred-wifi-password](https://github.com/epilande/alfred-wifi-password) - Get Wi-Fi password from Keychain. 38 | - 🎨 [alfred-prettier-clipboard](https://github.com/epilande/alfred-prettier-clipboard) - Format code in your clipboard with Prettier. 39 | - 🖊 [alfred-markdown](https://github.com/epilande/alfred-markdown) - Markdown text expander. 40 | 41 | ## License 42 | 43 | [MIT License](https://oss.ninja/mit/epilande/) 44 | -------------------------------------------------------------------------------- /demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epilande/alfred-password-generator/7c37ee2b9f3e670669135c98fca35befe9ae28fd/demo.png -------------------------------------------------------------------------------- /src/1C1236B0-F0F6-4EF7-BBDF-3B05247A4DBC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epilande/alfred-password-generator/7c37ee2b9f3e670669135c98fca35befe9ae28fd/src/1C1236B0-F0F6-4EF7-BBDF-3B05247A4DBC.png -------------------------------------------------------------------------------- /src/generator.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import os 4 | import sys 5 | import secrets 6 | import json 7 | 8 | defaultLength = os.environ['defaultLength'] 9 | letters = os.environ['letters'] 10 | digits = os.environ['digits'] 11 | punctuation = os.environ['punctuation'] 12 | 13 | length = int(sys.argv[1]) if len(sys.argv) > 1 else int(defaultLength) 14 | 15 | combinations = [ 16 | { 17 | 'title': f"Generate password {length} characters", 18 | 'combo': letters + digits + punctuation 19 | }, 20 | { 21 | 'title': f"{length} characters - Letters", 22 | 'combo': letters 23 | }, 24 | { 25 | 'title': f"{length} characters - Letters + Digits", 26 | 'combo': letters + digits 27 | }, 28 | { 29 | 'title': f"{length} characters - Letters + Punctuation", 30 | 'combo': letters + punctuation 31 | } 32 | ] 33 | 34 | 35 | def item(d): 36 | password = ''.join(secrets.choice(d['combo']) for i in range(length)) 37 | return { 38 | 'title': d['title'], 39 | 'subtitle': f"{password}", 40 | 'arg': f"{password}", 41 | } 42 | 43 | 44 | items = list(map(item, combinations)) 45 | 46 | print(json.dumps({'items': items})) 47 | -------------------------------------------------------------------------------- /src/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epilande/alfred-password-generator/7c37ee2b9f3e670669135c98fca35befe9ae28fd/src/icon.png -------------------------------------------------------------------------------- /src/info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.epilande.password-generator 7 | category 8 | Tools 9 | connections 10 | 11 | 1C1236B0-F0F6-4EF7-BBDF-3B05247A4DBC 12 | 13 | 14 | destinationuid 15 | 56D66C8A-7B0E-4068-AD79-3B9371C2079B 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | vitoclose 21 | 22 | 23 | 24 | 56D66C8A-7B0E-4068-AD79-3B9371C2079B 25 | 26 | 27 | destinationuid 28 | C2933FFF-0351-4055-ACB8-F1F0F04D1FF9 29 | modifiers 30 | 0 31 | modifiersubtext 32 | 33 | vitoclose 34 | 35 | 36 | 37 | 38 | createdby 39 | Emmanuel Pilande 40 | description 41 | Workflow to generate passwords 42 | disabled 43 | 44 | name 45 | Password Generator 46 | objects 47 | 48 | 49 | config 50 | 51 | autopaste 52 | 53 | clipboardtext 54 | {query} 55 | ignoredynamicplaceholders 56 | 57 | transient 58 | 59 | 60 | type 61 | alfred.workflow.output.clipboard 62 | uid 63 | 56D66C8A-7B0E-4068-AD79-3B9371C2079B 64 | version 65 | 3 66 | 67 | 68 | config 69 | 70 | alfredfiltersresults 71 | 72 | alfredfiltersresultsmatchmode 73 | 0 74 | argumenttreatemptyqueryasnil 75 | 76 | argumenttrimmode 77 | 0 78 | argumenttype 79 | 1 80 | escaping 81 | 102 82 | keyword 83 | pw 84 | queuedelaycustom 85 | 3 86 | queuedelayimmediatelyinitially 87 | 88 | queuedelaymode 89 | 0 90 | queuemode 91 | 1 92 | runningsubtext 93 | 94 | script 95 | ./generator.py $1 96 | scriptargtype 97 | 1 98 | scriptfile 99 | 100 | subtext 101 | 102 | title 103 | Password Generator 104 | type 105 | 0 106 | withspace 107 | 108 | 109 | type 110 | alfred.workflow.input.scriptfilter 111 | uid 112 | 1C1236B0-F0F6-4EF7-BBDF-3B05247A4DBC 113 | version 114 | 3 115 | 116 | 117 | config 118 | 119 | lastpathcomponent 120 | 121 | onlyshowifquerypopulated 122 | 123 | removeextension 124 | 125 | text 126 | Ready to paste! 127 | title 128 | Password Generator 129 | 130 | type 131 | alfred.workflow.output.notification 132 | uid 133 | C2933FFF-0351-4055-ACB8-F1F0F04D1FF9 134 | version 135 | 1 136 | 137 | 138 | readme 139 | GitHub Repo: https://github.com/epilande/alfred-password-generator 140 | 141 | Command: 142 | `pw {length}` - Generate password with `{length}` characters. If `{length}` not specified, `defaultLength` will be used. 143 | uidata 144 | 145 | 1C1236B0-F0F6-4EF7-BBDF-3B05247A4DBC 146 | 147 | xpos 148 | 95 149 | ypos 150 | 75 151 | 152 | 56D66C8A-7B0E-4068-AD79-3B9371C2079B 153 | 154 | xpos 155 | 265 156 | ypos 157 | 75 158 | 159 | C2933FFF-0351-4055-ACB8-F1F0F04D1FF9 160 | 161 | xpos 162 | 435 163 | ypos 164 | 75 165 | 166 | 167 | variables 168 | 169 | defaultLength 170 | 16 171 | digits 172 | 0123456789 173 | letters 174 | abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 175 | punctuation 176 | !"#$%&'()*+,-./:;<=>?@[]^_{\|}~ 177 | 178 | version 179 | 1.0.0 180 | webaddress 181 | https://github.com/epilande/alfred-prettier-clipboard 182 | 183 | 184 | --------------------------------------------------------------------------------