Andy Rosen 0 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 post
vjunior1981 0 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 post
Andy Rosen 0 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 post
vjunior1981 0 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 post
Andy Rosen 0 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 post
deanishe 1,366 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 post
Andy Rosen 0 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 post
deanishe 1,366 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 post
Terminal 14 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 post
Andy Rosen 0 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 post
deanishe 1,366 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 post
Andy Rosen 0 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 post
deanishe 1,366 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 post
Andy Rosen 0 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 post
Terminal 14 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 post
Andy Rosen 0 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 post
Terminal 14 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 post
vjunior1981 0 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 post
Andy Rosen 0 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 post
Andy Rosen 0 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 post
Andy Rosen 0 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 post
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