Giter VIP home page Giter VIP logo

autopass's Introduction

Autopass

A rofi frontend for pass

⚠️ DEPRECATED ⚠️

This project is deprecated. Please check out autopass.cr. Autopass.cr has all the features of autopass and some more. Migrating is easy, you'll only need to rebuild the cache.

Features

  • performs autotype with entries
  • allows setting window name property (a regex) to match against window titles
  • automatically focuses correct window or asks you to
  • allows any amount of additional properties which can be used in autotype
  • displays entries that are most likely to match currently focused window first
  • uses encrypted cache to store pass entries in a single file for fast startup
  • OTP (one-time-password) generation (install the ruby gem rotp for this)

Installation

ArchLinux

Get autopass-git with your favorite aur helper

Other systems

  • Install the ruby development package from your distribution (ruby-devel or ruby-dev on Debian)
  • Run gem install bundler to install the bundler ruby gem
  • Clone this repositority and cd into it
  • Run bundle install
  • Then run bundle exec rake install with root permissions (because it will install autopass globally)

Dependencies:

Optionally you can install one of the following browser extensions for better autotype. These add your current URL to your title (and window title) which can be matched by the URL entry in your password entry.

Usage

  • run autopass
  • Highlight an entry either by fuzzy search or with arrow keys
  • Press Enter for autotype
  • Press Alt+1 for autotype_1
  • Press Alt+2 for autotype_2
  • Press Alt+3 for autotype_3
  • etc
  • Press Alt+p to copy pass to clipboard
  • Press Alt+u to copy user to clipboard
  • Press Alt+c to copy otp code to clipboard
  • Press Alt+t to autotype a tan from the entry
  • Press Alt+o to open specified URL in your browser

Copied values are cleared from clipboard after 45 seconds

Entry syntax

Create entries as usual with pass insert etc. Edit them with pass edit and add additional properties in the following syntax

my_super_secret_password
---
user: username
url: https://example.com/login
some_other_property: some value
autotype: [user, ':tab', some_other_property, ':tab', pass, ':tab', ':otp']
autotype_1: [user]
autotype_2: [pass]
autotype_3: user some_other_property :tab pass # this is also ok
window: some site.*- Chromium
otp_secret: my_one_time_password_secret
tan: |
	204194
	294922
	240581
# ...

You can write any kind of key value pairs here as long as it's valid yaml. The keys autotype, autotype_{1-7}, window, otp_secret and tan have special meanings. ':tab' hits - you guessed it - the Tab key, ':enter' hits the Enter key, ':otp' types the current time based one time password, :delay delays the autotype sequence. Make sure you add otp_secret to an entry when using ':otp'.

Config:

Default config file:

---
# you can insert any environment variable inside %{} for it to be replaced by
# the value of that variable. If it needs to be at the beginning of the string
# you have to escape it (e.g. `foo: %{BAR}` will raise an error, `foo: '%{BAR}'`
# will work though)

cache_file: '%{HOME}/.cache/autopass/autopass.cache'
# cache_key: YOUR_KEY_ID
# key_bindings:
#   autotype_tan: Alt+t
#   copy_username: Alt+u
#   copy_password: Alt+p
#   open_browser: Alt+o

# # clipboard command to use:
# # (default)
#   clip_command: 'xclip'
# # or
#   clip_command: 'xclip -selection clipboard'
# # Browsers window names to use for matching
# browsers:
#   - chrome
#   - chromium

Defaults:

  • window: name of the entry (without parent group(s))
  • autotype: [user, ':tab', pass]
  • autotype_1: [pass]
  • autotype_2: [user]
  • autotype_3: [':otp']
  • alt_delay: 0.5
  • delay: 0.5

You can define global fallbacks for autotype and autotype_{1-7} in the config file located in $XDG_CONFIG_HOME/autopass. You could override the default behavior of autotype_1 and autotype_2 for example to be reversed: autotype_1: [user], autotype_2: [pass].

Furthermore you can set keys to use for looking up the custom autotype sequence autotype_key: autotype, username username_key: user and password password_key: pass in the config file.

Some users experience problems with alternative autotypes (using the Alt modifier key). It almost certanly is caused by releasing the Alt key only after the autotype has already started. Therefor there's now a config option alt_delay which waits the amount in seconds before starting the autotype for alternative autotypes. The value is 0.5 by default.

Known Problems

xdotool uses the wrong keyboard layout if it is set in xorg.conf.d instead of using the command xkbmap.

autopass's People

Contributors

antonok-edm avatar dblouis avatar dsiw avatar eltomello avatar jfeick avatar nbraud avatar repomaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

autopass's Issues

How to run it?

I can't run your program beside having all the needed dependencies.
If I just try ./bin/autopass I get:

Traceback (most recent call last):                                                                                                                                                                                 
    2: from ./bin/autopass:5:in `<main>'
    1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- autopass/config (LoadError)

Error while copying another password while previous password is not yet cleared

I'm getting the following messages when I try to copy another password or username while the previous entry has not yet been cleared:

/usr/bin/autopass:455:in `sleep': Interrupt
	from /usr/bin/autopass:455:in `block in copy'
	from /usr/bin/autopass:453:in `fork'
	from /usr/bin/autopass:453:in `copy'
	from /usr/bin/autopass:465:in `<main>'

Add manpage or at least --help to autopass

It would be usefull to find the docs without going to this repo.
Easyest case would be the README as a manpage. But a special written manpage surely would be better to find options like clear-cache.

YAML errors

With this file:

PASSWORDIWONTTELLYOU

---
user: username
autotype: [user, :tab, pass]

I get this error message.

Failed parsing yaml of entry 'foo.bar.baz':

---
user: username
autotype: [user, :tab, pass]
(<unknown>): did not find expected node content while parsing a flow node at line 3 column 18
/usr/bin/autopass:205:in `entry_from': undefined method `merge' for nil:NilClass (NoMethodError)
        from /usr/bin/autopass:224:in `block in update_cache'
        from /usr/bin/autopass:222:in `each'
        from /usr/bin/autopass:222:in `update_cache'
        from /usr/bin/autopass:161:in `initialize'
        from /usr/bin/autopass:251:in `new'
        from /usr/bin/autopass:251:in `<main>'

Public key not found

When I run autopass the first time, after updating cache it fails with this message:

autopass 
Updating cache...
[################################################ ]
gpg: xxxxxxx: skipped: public key not found
gpg: [stdin]: encryption failed: public key not found

I tried both long and short format for the key ID. Also I am using subkeys.

Maybe autopass uses gpg1 and not gpg2?

Can't chomp in entry_from

Got the following error, just installed from AUR.

/usr/bin/autopass:341:in `entry_from': undefined method `chomp' for nil:NilClass (NoMethodError)
	from /usr/bin/autopass:380:in `block in update_cache'
	from /usr/bin/autopass:378:in `each'
	from /usr/bin/autopass:378:in `update_cache'
	from /usr/bin/autopass:305:in `initialize'
	from /usr/bin/autopass:407:in `new'
	from /usr/bin/autopass:407:in `<main>'

My config:

---
# you can insert any environment variable inside %{} for it to be replaced by
# the value of that variable. If it needs to be at the beginning of the string
# you have to escape it (e.g. `foo: %{BAR}` will raise an error, `foo: '%{BAR}'`
# will work though)
#
cache_file: '%{HOME}/.cache/autopass/autopass.cache'
cache_key: <my-32-bit-fingerprint>
# key_bindings:
#   autotype_tan: Alt+t
#   copy_username: Alt+u
#   copy_password: Alt+p
#   open_browser: Alt+o

# clipboard command to use:
# (default)
#   clip_command: 'xclip'
# or
#   clip_command: 'xclip -selection clipboard'
'

optionparser

Im getting pretty gridlocked on what may be a bundle issue?

$ autopass
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- optionparser (LoadError)
        from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/bill/bin/autopass:8:in `<main>'

I dont see any mention of gems here, but when i try to run autopass(not even testing yet if all dependencies are configured, i just got them all installed), i see an optionparser error. I thought maybe i needed to make a Gemfile and add in there gem 'OptionParser' and install bundle, however this has not helped, same error.

What might my RHEL 7.3 need to get over the hump? Do i need ruby, gem, bundler at all for this app?

Note for future users, for RHEL 7.3 i got a few packages for the dependedncies here
yum install libnofity xdotool xclip xorg-x11-utils

To be honest with you, im not sure where im at, or what to expect, so totally lost, if theres more info i might be missing, im all ears.

xclip missing parameters

I'm using awesomewm for my window manager, and autopass does not copy contents to clipboard using xclip.
To use the clipboard functionality I have to explicitly usexclip -selection clipboard

e.g.
Line 444:

def copy(attribute, notification_seconds = 5)
  clear_clip_pidfile = '/tmp/autopass-clear-clip.pid'
  value = @entry.attributes[attribute]

  if File.exist?(clear_clip_pidfile)
    Process.kill(:INT, File.read(clear_clip_pidfile).to_i)
  end
  IO.popen('xclip -selection clipboard', 'w+') { |io| io.print(value) }
  notify("Copied #{attribute} to clipboard. Clearing in 45 seconds", :normal, notification_seconds*1000)
  fork do
    File.write(clear_clip_pidfile, Process.pid)
    sleep(45)
    IO.popen('xclip -selection clipboard', 'w+') { |io| io.print('') }
    File.delete(clear_clip_pidfile)
  end
end

Couldnt this behaviour be implemented using a configuration file? (perhaps even to change xclip with another clipboard tool?)

Autopass doesn't parse any entry

After installing autopass and puting the long key-id in the config file, I get this error

Error: folder/username is not in the password store.
Failed parsing entry 'folder/username':

Pass exited with error when reading from folder/username
/usr/bin/autopass:352:in `basename': no implicit conversion of Hash into String (TypeError)
	from /usr/bin/autopass:352:in `rescue in entry_from'
	from /usr/bin/autopass:343:in `entry_from'
	from /usr/bin/autopass:384:in `block in update_cache'
	from /usr/bin/autopass:382:in `each'
	from /usr/bin/autopass:382:in `update_cache'
	from /usr/bin/autopass:309:in `initialize'
	from /usr/bin/autopass:411:in `new'
	from /usr/bin/autopass:411:in `<main>'

I did a pass init 0x<longkeyid> for the setup of pass

autopass failes to parse twitter handle

When running autopass (current master) I get:

Failed parsing entry 'www/twitter.com/@ArminGrodon':
super_secret_password
---
login: @ArminGrodon
url: https://twitter.com
autotype: login :tab pass
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 8
./autopass:348:in `basename': no implicit conversion of Hash into String (TypeError)

pass doesn't have a problem with strings starting with '@' (well, technically it probably just ignores everything past the first line) and rofi-pass doesn't either.

Cache_key option not defined

After initiating the first time, this is what I get when I type autopass into my terminal, both in sudo and outside sudo:

@ARCH ~]$ autopass
/usr/bin/autopass:302:in initialize': cache_key option not defined (RuntimeError) from /usr/bin/autopass:407:in new'
from /usr/bin/autopass:407:in <main>

Any idea what it could be?

add option to purge cache

Either on cmd line or in the gui a shortcut to purge the autopass cache would be usefull.
If #2 gets implemented it also helps to remove the right file.

TypeError with non-autopass entries: undefined method `merge!' for "baz":String

Just tried autopass and it crashes on an entry that I have already:

Failed parsing entry 'foo-autopass-test':
foo-bar
baz
undefined method `merge!' for "baz":String
/usr/bin/autopass:352:in `basename': no implicit conversion of Hash into String (TypeError)
	from /usr/bin/autopass:352:in `rescue in entry_from'
	from /usr/bin/autopass:343:in `entry_from'
	from /usr/bin/autopass:384:in `block in update_cache'
	from /usr/bin/autopass:382:in `each'
	from /usr/bin/autopass:382:in `update_cache'
	from /usr/bin/autopass:309:in `initialize'
	from /usr/bin/autopass:411:in `new'
	from /usr/bin/autopass:411:in `<main>'

Using 0.r77.d2c1288-1 from Arch's autopass-git.

Would love to be able to configure the BROWSERS variable

Currently the script has a hardcoded list of browsers in the BROWSERS variable. I use qutebrowser which is not in the list. I can hardcode it into the list but ideally, I'd like to be able to configure this outside of the script.

autopass fails to copy/autotype under arch

autopass fails to autotype/ copy username / copy password with this error:

[user@hostname ~]$ autopass
/usr/bin/autopass:291:in `<main>': undefined method `autotype!' for nil:NilClass (NoMethodError)

store cachefile by default under ~/.cache/autopass/autopass.cache

Storing the cachefile under /tmp will break if used by multiple users. Creating the cachefile under ~/.cache/autopass/autopass.cache seems as a more sensible default to me. Alternatively you may name the file uniqe. For example "/tmp/autopass_username.cache" could be an alternative.

Also everybody can copy it and hope my key leaks. Having o+r may not be really problematic but removing it is an easy fix for the paranoid. Only one who could still read it and isn't you would be root. But if root searches for your files you have other problems annyways.

undefined method crash on load

Hello,

Running autopass gives me a ruby error:

/usr/lib/ruby/2.3.0/ostruct.rb:170:in `new_ostruct_member': undefined method `to_sym' for #<Date: 2011-02-19 ((2455612j,0s,0n),+0s,2299161j)> (NoMethodError)
Did you mean?  to_s
    from /usr/lib/ruby/2.3.0/ostruct.rb:225:in `[]='
    from /home/desktop/.local/bin/autopass:47:in `block in expand_config'
    from /home/desktop/.local/bin/autopass:47:in `each'
    from /home/desktop/.local/bin/autopass:47:in `expand_config'
    from /home/desktop/.local/bin/autopass:326:in `entry_from'
    from /home/desktop/.local/bin/autopass:362:in `block in update_cache'
    from /home/desktop/.local/bin/autopass:360:in `each'
    from /home/desktop/.local/bin/autopass:360:in `update_cache'
    from /home/desktop/.local/bin/autopass:287:in `initialize'
    from /home/desktop/.local/bin/autopass:389:in `new'
    from /home/desktop/.local/bin/autopass:389:in `<main>'

It would seem I am missing some dependency, but I have all those listed here.
My system is on Debian testing.
Thanks.

Print window name after selecting

When defaulting to search window name, class, and classname it would be usefull to print the in the end selected Windowname so one can simply copy it from the shell for pass edit.

always types on us layout

Steps to reproduce:
create a pass file with a password containing special caracters. ( #?/ etc.)

switch your keyboard layout to german

[user@hostname ~]$ setxkbmap de

try to autotype this password. It wil come out mangled based on the differences between de and us layout.

Don't fail completely if (one) autopass entry is broken

If you run autopass via a starter of your choice you won't notice if one of the pass entrys has a error and wonder why autopass doesn't start.

It may would be more user friendly to mark those failed Items in the gui instead of failing hard.

/usr/bin/autopass:205:in `entry_from': undefined method `merge' for "admin":String (NoMethodError)
        from /usr/bin/autopass:224:in `block in update_cache'
        from /usr/bin/autopass:222:in `each'
        from /usr/bin/autopass:222:in `update_cache'
        from /usr/bin/autopass:161:in `initialize'
        from /usr/bin/autopass:251:in `new'
        from /usr/bin/autopass:251:in `<main>'

add config option to change shortcuts

Who doesn't love customising one's setup? Changeing the shortcut inside the config instead of the code itself helps keeping ones pass up to date since you don't get the urge to install around your package manager.

Create .password-store on startup if not already present.

If you install autopass, configure it and just run it you will be greetet by this.

[user@host ~]$ autopass
/usr/lib/ruby/2.2.0/fileutils.rb:127:in `chdir': No such file or directory @ dir_chdir - /home/user/.password-store (Errno::ENOENT)
       from /usr/lib/ruby/2.2.0/fileutils.rb:127:in `cd'
       from /usr/bin/autopass:232:in `checksums'
       from /usr/bin/autopass:222:in `update_cache'
       from /usr/bin/autopass:161:in `initialize'
       from /usr/bin/autopass:251:in `new'
       from /usr/bin/autopass:251:in `<main>'

a simple

[user@host ~]$ mkdir .password-store

fixes this. Maybe instead of creating the dir a hint to "pass init" would be preferable. But with a complete config we also have all the data needed for creation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.