Andy Rosen Posted September 5, 2020 Share Posted September 5, 2020 (edited) GitHub: https://github.com/ajrosen/Alfred Packal: http://www.packal.org/workflow/lastpass-accelerator LastPass Accelerator Interact with LastPass CLI. LastPass Accelerator uses the LastPass CLI. The easiest way to install it is with brew: brew install lastpass-cli If you have not installed brew, first run this: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" Variables ClipboardTimeout Number of seconds a password is stored in the clipboard before restoring the clipboard to its previous contents lppath Location of the LastPass CLI program lpuser Your LastPass username Commands lpin [username] Login to LastPass. The username is taken from the workflow variable {lpuser}, unless provided here. After you enter your LastPass password you will be prompted for your MFA code. If you have previously logged in with the CLI's --trust option you can leave this blank. If you have not enabled MFA for LastPass do it now. Until then, you can leave this blank. lpout Logout of LastPass. lpstat Show LastPass status. Either "Logged in as..." or "Not logged in." lpass Copy an item's password, username (with Control), URL (with Shift), or notes (with Command) to the clipboard. Edited September 5, 2020 by Andy Rosen Add link to Packal Link to comment
vjunior1981 Posted September 6, 2020 Share Posted September 6, 2020 Hi there, I'm having issues trying to use this. I was able to login: But when I've tried to search for any entry, debug shows that all entries were found, but the workflow seems to end there: Best regards, Vitor Jr. Link to comment
Andy Rosen Posted September 8, 2020 Author Share Posted September 8, 2020 I think I've been able to reproduce this behavior. Do you have any LastPass entries or folders with a double-quote ( " ) in the Name or Username fields? Link to comment
vjunior1981 Posted September 10, 2020 Share Posted September 10, 2020 Not really. But, maybe, spaces are being translated do quoted strings? Like in this example "Productivity Tools"? Link to comment
Andy Rosen Posted September 15, 2020 Author Share Posted September 15, 2020 I've published a new version, 1.0.1, that adheres to JSON syntax more strictly in the script filter. If Alfred doesn't like the format the filter outputs then it looks like you got no results. Apparently a trailing comma after the last item in a list does not cause Alfred 4.1.1 [1172] problems. Maybe older versions do? And thanks for checking it out! Link to comment
deanishe Posted September 15, 2020 Share Posted September 15, 2020 3 hours ago, Andy Rosen said: that adheres to JSON syntax more strictly in the script filter. Are you not using a real JSON library to generate the JSON? If not, you should, or the workflow is buggy. Link to comment
Andy Rosen Posted September 16, 2020 Author Share Posted September 16, 2020 I'm not. The filter is in bash. I'm using the LastPass CLI to generate a list of items, and wrapping the output in JSON for Alfred. Link to comment
deanishe Posted September 16, 2020 Share Posted September 16, 2020 2 hours ago, Andy Rosen said: The filter is in bash. Please don't try to generate JSON by smushing strings together. It never works. As you noted, Alfred does accept invalid JSON (trailing commas aren't actually allowed), but it's only so lenient. Use a language that has proper JSON support. 40-02 1 Link to comment
Terminal Posted October 23, 2020 Share Posted October 23, 2020 @Andy Rosen I am receiving `JSON error: Invalid escape sequence around character 10600. in JSON:` Which at 10600 is this `"/Michelangelo\mic/` The backslash Link to comment
Andy Rosen Posted October 27, 2020 Author Share Posted October 27, 2020 @Terminal I hadn't really considered LastPass having strings that are not JSON-compliant. Version 1.0.3 strips backslashes, which should fix your problem. Thanks! Link to comment
deanishe Posted October 27, 2020 Share Posted October 27, 2020 28 minutes ago, Andy Rosen said: strips backslashes, which should fix your problem. I'm pretty sure the backslash is part of the string. It needs escaping, not removing. Link to comment
Andy Rosen Posted October 27, 2020 Author Share Posted October 27, 2020 Yes, I believe the backslash is part of the string. But it's only for display in the Alfred window (title, subtitle, autocomplete, match). The only fields relevant to the workflow's functionality (uid, arg) are LastPass internal IDs, which are always numeric only. Link to comment
deanishe Posted October 27, 2020 Share Posted October 27, 2020 (edited) I guess that's fixed till somebody has a double quote in a field, then Edited October 27, 2020 by deanishe Link to comment
Andy Rosen Posted October 27, 2020 Author Share Posted October 27, 2020 Yup! I'm trying to find a fix for that too, but the LastPass CLI isn't making it easy 🙁 Link to comment
Terminal Posted October 28, 2020 Share Posted October 28, 2020 17 hours ago, Andy Rosen said: Yup! I'm trying to find a fix for that too, but the LastPass CLI isn't making it easy 🙁 @Andy RosenThe best approach I can think of is if you offer a v2 that utilizes the lastpass-cli that integrates last pass dumping out as json. Check the GitHub for the PR which supports this. It would make your workflow so much more fluid. Link to comment
Andy Rosen Posted October 29, 2020 Author Share Posted October 29, 2020 I'd love to see a JSON option for ls and export. Unfortunately I don't see that happening any time soon. The last merge was over a year ago. But Version 1.1.0 properly escapes backslashes and double-quotes. I'm storing sanitized fields in separate files, then merging and formatting them with awk. Link to comment
Terminal Posted November 3, 2020 Share Posted November 3, 2020 On 10/28/2020 at 8:55 PM, Andy Rosen said: I'd love to see a JSON option for ls and export. Unfortunately I don't see that happening any time soon. The last merge was over a year ago. But Version 1.1.0 properly escapes backslashes and double-quotes. I'm storing sanitized fields in separate files, then merging and formatting them with awk. Yeah, I just pulled and merge locally so I can have that support. Thanks. I’ll test tomorrow. Link to comment
vjunior1981 Posted November 16, 2020 Share Posted November 16, 2020 On 9/15/2020 at 5:05 PM, Andy Rosen said: I've published a new version, 1.0.1, that adheres to JSON syntax more strictly in the script filter. If Alfred doesn't like the format the filter outputs then it looks like you got no results. Apparently a trailing comma after the last item in a list does not cause Alfred 4.1.1 [1172] problems. Maybe older versions do? And thanks for checking it out! Thanks mate, now everything looks amazing! Best regards, Vitor Jr. Link to comment
Andy Rosen Posted December 1, 2020 Author Share Posted December 1, 2020 Version 1.3.0 is now available! GitHub: https://github.com/ajrosen/Alfred Packal: http://www.packal.org/workflow/lastpass-accelerator What's New? A new command lpconfigure lets you view and change the workflow's variables. If you login as a different user with lpin that user will be saved as the default. A new command lpgen generates random passwords. Changed the icon so the LastPass desktop app stands out. Link to comment
Andy Rosen Posted December 17, 2020 Author Share Posted December 17, 2020 Version 2.0 What's new? A new command lpmanage provides access to account-wide commands Change your password Import items from a file into your vault Export items in your vault to a file Use the Option key to per form additional actions on a selected item Share is not yet implemented Logging in (lpin) checks for the trusted_id file and skips prompting for MFA if it exists Link to comment
Andy Rosen Posted December 29, 2020 Author Share Posted December 29, 2020 Version 2.1 This is a bug fix release. Items that have Reprompt enabled could not be retrieved. Now the workflow will prompt for your password and try again. GitHub: https://github.com/ajrosen/Alfred Packal: http://www.packal.org/workflow/lastpass-accelerator Link to comment
Andy Rosen Posted January 20, 2021 Author Share Posted January 20, 2021 Version 2.2 What's new? Improved results filtering Items match anywhere in the text, not just from the start, and regardless of word boundaries Items are filtered on an item's path (the title in Alfred's results), user and URL fields Eg., this matched the URL field https://www.alfredforum.com/ GitHub: https://github.com/ajrosen/Alfred Packal: http://www.packal.org/workflow/lastpass-accelerator Link to comment
Andy Rosen Posted May 4, 2021 Author Share Posted May 4, 2021 I'm pretty excited about this release 😃 Version 3.0 What's new? Secure Notes Now you can view the Secure Notes in your vault. The item is shown in a dialog window where you can copy/paste. Folders You'll also see folders in the search results. Actioning a folder will filter results to that folder. ShowFolders variable Disabled by default, to stay consistent with current behavior, this changes the initial display to show only the folders in your vault. Actioning a result, or typing in an argument, will then show passwords, notes, and folders. Performance enhancements and bug fixes Link to comment
Andy Rosen Posted May 23, 2021 Author Share Posted May 23, 2021 Version 3.2 What's new? Browser integration If your browser is the front-most application, then any items that match the current URL's hostname will be included at the top of the results list. Supported browsers: Safari Chrome Opera Edge I use Firefox. As frequenters of this forum know, Firefox does not support Applescript 😠 What about Version 3.1.0? Selecting a Secure Note was copying the entire note's contents to the clipboard and not restoring the clipboard. Now the clipboard is undisturbed. I didn't post an announcement since it was "just" a bug fix. Link to comment
deanishe Posted May 23, 2021 Share Posted May 23, 2021 1 hour ago, Andy Rosen said: As frequenters of this forum know, Firefox does not support Applescript 😠 It's still possible to get the current URL Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now