Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Working? #1

Open
Jud opened this issue Mar 30, 2013 · 3 comments
Open

Not Working? #1

Jud opened this issue Mar 30, 2013 · 3 comments
Assignees
Labels

Comments

@Jud
Copy link

Jud commented Mar 30, 2013

I have this code:

import os
import sys
import getpass
import onepassword.keychain

# Our password function
def get_password(msg=False):
    # Get the password
    p = getpass.getpass(prompt='1Password: ', stream=sys.stderr)
    p = False if not len(p) else p

    return p

k = onepassword.keychain.AKeychain(
        path=os.path.expanduser("~/Dropbox/1Password.agilekeychain"))

k.unlock(get_password())
print k.decrypt(keyid=k.levels['SL5'], string="My Item")

When the string "My Item" is a 1Password "Account", it doesn't print anything. When the item is a 1password "Login" item, it prints out binary data. Have I set it up incorrectly?

@ghost ghost assigned Roguelazer Apr 22, 2013
@Roguelazer
Copy link
Owner

Sorry for taking so long to respond to you.

You should be able to look through the items attribute of the AKeychain object. What do you get when you run the following:

print [(item.data['typeName'], item.data['title']) for item in k.items]`

@glushchenko
Copy link

Ok, but how we can use data stored in k.items[1]._decrypted ? I need a password stored in encrypted section.

@ghost
Copy link

ghost commented Jun 13, 2014

(I realize this is an almost year old issue, but I figured lost wandering souls could make use of my findings)

It is not completely obvious how onepasswordpy should be used without digging into the source code (something that one could improve upon in the README, perhaps?).

Here's a basic script that allows me to retrieve my 1password items using onepasswordpy. Of course you'll want to change the path on line 6 to your own setup (don't forget to switch AKeychain for CKeychain if your data resides in iCloud).

Additionally, on line 18, I'm using SL5. This should be fine for most cases, but if the script doesn't work with your keychain, that might be something to investigate.

If you're looking for more than what the very basic script offers, decrypted_data should hold most of what a typical user would be looking for.

Thanks again @Roguelazer for your work on this project; looking forward to adding some contributions in the future :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants