Skip to content

Search LastPass for sites, usernames and passwords with Alfred

License

Notifications You must be signed in to change notification settings

Unimatrix0/lastpass-alfred-workflow

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lastpass Search Workflow for Alfred

Simple yet powerful integration with the Lastpass CLI so you can now get your passwords out of your Lastpass vault and straight into the clipboard from within Alfred.

Current version: 1.5.3

Requires Alfred 3, 4, or 5 and LastPass CLI v1.3 or higher

Installation

  1. Ensure you have Alfred 3, 4, or 5 installed with the Alfred Powerpack License
  2. Install LastPass command line interface
    1. using HomeBrew: brew install lastpass-cli
    2. using MacPorts: sudo port install lastpass-cli lastpass-cli-doc
    3. manually, see https://github.com/LastPass/lastpass-cli for details
  3. Download and open https://github.com/Unimatrix0/lastpass-alfred-workflow/raw/master/LastPass%20Search.alfredworkflow
  4. Run lpsetemail [email protected] in Alfred to set your LastPass username.

Usage

  • lpsetemail [email protected] - must be run when you first install/upgrade to version 1.2 or higher
  • lpsettimeout NUMSEC - Set number of seconds until your login times out (where NUMSEC is an integer such as 28800, if you use 0 that will keep you logged in until your computer restarts)
  • lptrust - Enable or disable MFA bypass
  • lplogin - Log in to LastPass
  • lplogout - Log out of LastPass
  • lp <query> Search Lastpass vault for item containing <query>
    • <query> can be a literal string or a regular expression
    • <query> is matched as case-insensitive substring against the name, folder or username fields of your lasspass items.
    • If multiple <query> strings are provided (separated by whitespace) all of them need to match.
    • Press RETURN to copy the password to clipboard.
    • Press Shift-RETURN to copy the username to clipboard.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

  • Version 1.5.3
    1. Add configurable option to use --trust in order to bypass multifactor login for next 30 days.
    2. Fixes login bug by removing unused code previously used to detect osascript path.
    3. Updates some key types based on how Alfred 5 exports them.
  • Version 1.5.2
    1. Fix name extraction for linked accounts
  • Version 1.5.1
    1. Updated workflow icon
  • Version 1.5.0
    1. Homebrew switched to use /opt/homebrew/bin as default path now. Add this path to binary findings. (thanks to Andreas Krüger)
    2. Remove the --trust option from the login command, since this will remove the multifactor option. (thanks to Andreas Krüger)
    3. Add support for searching by username
    4. Reformat Perl code using perltidy
  • Version 1.4.9
    1. Fixed a filesystem access issue, probably introduced with security inprovements in macOS 10.15.6 (?), causing LastPass login to fail.
    2. Updated install instructions in Readme.
  • Version 1.4.8
    1. If no folder/category is set for an entry in LastPass the CLI returns the literal text "(none)", which is then displayed in Alfred. Removed it (as well as translations in other languages).
  • Version 1.4.7
    1. Changed mechanism for copying to clipboard. Now marks passwords as transient, Alfred will no longer store them in the clipboard history.
    2. Updated icon submitted by Tom Conroy has been merged in (thanks for this Tom!)
  • Version 1.4.6
    1. Updated to work with Alfred 3 (long awaited official release of the long-in-testing beta version).
    2. Username display functionality submitted by Guillermo Moreno has been merged in with some minor changes (thanks for your hard work Guillermo!)
    3. Released with my apologies for the delay in getting this version out of beta... my masters course was INTENSE this semester, thank you to all of those that waited patiently.
  • Version 1.4.5
    1. Fixed detection for when login has timed out, now correctly requests login.
    2. Fixed rare cases of login-script loops.
    3. Improved speed of copying usernames.
    4. Updated documentation.
  • Version 1.4.4
    1. Merged in Ariel Barreiro's code submission which better handles two factor authentication (2FA).
  • Version 1.4.3
    1. Fixed binary so that it is ACTUALLY updated (my bad #oops)
    2. Added a tweak to SIGNIFICANTLY speed up password copying to the clipboard #enjoy
  • Version 1.4.2
    1. NOTE: This version requires the LastPass CLI v 0.7.1 or higher due to this new feature --> Login process completely changed over to use AppleScript (cleaner and nicer). This was thanks to work between myself and Bob from LastPass who maintains the official LastPass CLI to add a feature allowing an external login prompt to be used.
    2. Login password prompt now uses an AppleScript password prompt.
    3. Fix to allow you to search for words in any order.
    4. Vault item's which now require re-authentication will pop up the AppleScript login prompt.
    5. Has now been tested with a Vault with over 30,000 items for performance tweaks. (I have since been told by LastPass support their soft limit is significantly lower than this at ~2500 items explains why I was having some issues in testing).
    6. More resilient escaping of text in the XML to ensure that special characters should not cause any issues.
    7. Fixed missing quotes in some areas that could cause issues with spaces.
    8. Squashed a little regex bug and wiped up the goo.
    9. Fixed issues with spaces in certain paths we referenced
    10. Fixed how the initial login process is run after a reboot. This required the changes made to how we manage the login process and it has subsequently been cleaned up significantly.
    11. Other minor general tweaks.
  • Version 1.2
    1. Bug - Removed deprecated framework code
    2. Bug - Merged pull request #4 from jsquyres "we-love-macports-too" to support macports installs of the lastpass-CLI
    3. Bug - Further improved on jsquyres code to support some additional install locations.
    4. Bug - Fixed bash script reliability, after two login attempts the script was often failing.
    5. Improvement - Improved sync behaviour to better support extremely large vaults.
    6. Improvement - Added new 'lpsync' command to force a sync on demand.
    7. Improvement - Changed behaviour to store login email in your Apple Keychain (set with lpsetemail [email protected]).
    8. Improvement - Added the ability to set the logout timeout and store in the keychain (set with lpsettimeout NUMSEC where NUMSEC is an integer such as 28800, if you use 0 that will keep you logged in until your computer restarts).
    9. Improvement - Added hotkeys to the main functions.
  • Version 1.1
    1. Removed code that worked around an old buggy version of pinentry
    2. Fixed incorrect handling of no search results found (previously reported CLI tools were not installed)
  • Version 1.0 - Initial Release

Credits

Created by Stuart Ryan (<= v1.4.7)

Updated by Lothar Haeger (v1.4.8 - v1.5.2)

Updated by Unimatrix0 (>= v1.5.3)

License

Released under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991

Notes

NOTE: This Alfred Workflow is not affiliated in any way with LastPass. The LastPass trademark and logo are owned by LastPass.com. The LastPass logo and product name have been used with permission of the LastPass team.

My thanks go out to LastPass for their awesome product and the new CLI!

About

Search LastPass for sites, usernames and passwords with Alfred

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • AppleScript 100.0%