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

feat: a little more documentation please #18

Closed
dan-turner opened this issue Aug 2, 2017 · 3 comments
Closed

feat: a little more documentation please #18

dan-turner opened this issue Aug 2, 2017 · 3 comments

Comments

@dan-turner
Copy link

G'day guys,

This is great btw! I'm thinking about writing a browser extension that utilises this to fill TOTP's. I could just use ykman oath code, retrieve codes for all services and then filter, but I'd rather just ask for one. The CLI usage implies I should be able to do this but I can't for the life of me work out how and I can't find any examples:

Usage: ykman oath code [OPTIONS] [QUERY]

If the following is produced:

› ykman oath code
Amazon Web Services:johnsmith@acme       123456
Amazon Web Services:johnsmith@emca       654321

What's the appropriate [QUERY] to just return one?

@dagheyman
Copy link
Contributor

It works like a filter matching a string with the names of the credentials. It's case-insensitive.

$ ykman oath code acme should match only the first and $ ykman oath code emca should match only the second credential in your example.

Note that if the query/filter only matches a HOTP or Touch-credential it will trigger it. Here is the relevant code.

I agree that this behaviour (and a lot of other things) could be better documented. Would it have helped you if the output of $ ykman oath code -h explained this in more detail?

@dan-turner
Copy link
Author

Yeah, that's what I would have thought, but I'm getting this:

› ykman oath code acme
Traceback (most recent call last):
  File "/usr/local/bin/ykman", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/ykman/cli/__main__.py", line 117, in main
    cli(obj={})
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/ykman/cli/oath.py", line 307, in code
    cred = controller.calculate(cred)
  File "/usr/local/lib/python2.7/site-packages/ykman/oath.py", line 232, in calculate
    offset = resp[-1] & 0xF
TypeError: unsupported operand type(s) for &: 'str' and 'int'

@dagheyman
Copy link
Contributor

Nice find, that crash is definitely a bug. It only seems to happen on python2, so for now a workaround may be to use python3. I've committed a fix for py2 that will be included in the next release.

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

No branches or pull requests

2 participants