mirror of
https://github.com/gryf/softtoken.git
synced 2025-12-19 12:28:09 +01:00
Added clipboard support with -C option
This commit is contained in:
12
README.rst
12
README.rst
@@ -3,7 +3,7 @@ SoftToken OTP
|
||||
########################################
|
||||
|
||||
SoftToken OTP is an application to generate One-Time-Passwords to be used as a
|
||||
second factor authentication mechanism.
|
||||
second factor authentication mechanism.
|
||||
It can either print it when executed in the commandline or type it wherever
|
||||
your focus is. This can be especially useful when assigning a keybind to use
|
||||
your token.
|
||||
@@ -24,7 +24,7 @@ your token.
|
||||
Main features
|
||||
=============
|
||||
|
||||
* Generate Time-Based One-Time Passwords
|
||||
* Generate Time-Based One-Time Passwords
|
||||
* Multiple tokens support
|
||||
* Print OTP wherever the focus is (useful for keybindings)
|
||||
|
||||
@@ -70,7 +70,6 @@ Generate an OTP:
|
||||
$ softtoken -t token1
|
||||
630567
|
||||
|
||||
|
||||
Generate an OTP and get it wherever your focus is:
|
||||
|
||||
.. code-block:: bash
|
||||
@@ -78,6 +77,11 @@ Generate an OTP and get it wherever your focus is:
|
||||
$ softtoken -t token1 -X
|
||||
630567
|
||||
|
||||
Generate an OTP and copy to clipboard (requires xclip):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ softtoken -t token1 -C
|
||||
|
||||
=============
|
||||
TODO
|
||||
@@ -85,5 +89,3 @@ TODO
|
||||
|
||||
* Add HOTP support
|
||||
* Parametrize TOTP time
|
||||
* Add support to copy the OTP automatically into the clipboard
|
||||
|
||||
|
||||
@@ -3,14 +3,8 @@
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
configparser==3.5.0
|
||||
flake8==2.5.5
|
||||
hacking==0.11.0
|
||||
mccabe==0.2.1
|
||||
pbr>=1.6 # Apache-2.0
|
||||
pep8==1.5.7
|
||||
pyflakes==0.8.1
|
||||
pyotp==2.2.1
|
||||
pyperclip>=1.5.27
|
||||
python-xlib==0.17
|
||||
PyUserInput==0.1.11
|
||||
six==1.10.0
|
||||
|
||||
|
||||
2
setup.py
2
setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
from codecs import open
|
||||
from os import path
|
||||
|
||||
__version__ = '0.0.1'
|
||||
__version__ = '0.0.2'
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
|
||||
# Get the long description from the README file
|
||||
|
||||
@@ -16,15 +16,17 @@ import argparse
|
||||
import base64
|
||||
import configparser
|
||||
import hashlib
|
||||
import sys
|
||||
from os import path
|
||||
from os import urandom
|
||||
import sys
|
||||
|
||||
from pykeyboard import PyKeyboard
|
||||
|
||||
import pyotp
|
||||
|
||||
import pyperclip
|
||||
|
||||
__version__ = '0.0.1'
|
||||
__version__ = '0.0.2'
|
||||
|
||||
CONFIG_FILE = '.softtoken.conf'
|
||||
|
||||
@@ -104,6 +106,8 @@ def main():
|
||||
parser.add_argument('-X', action='store_true', default=False,
|
||||
dest='print_focus', help='Output the OTP where '
|
||||
'the current focus is')
|
||||
parser.add_argument('-C', action='store_true', default=False,
|
||||
dest='copy_clipboard', help='Copy OTP to clipboard')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -152,6 +156,8 @@ def main():
|
||||
if args.print_focus:
|
||||
k = PyKeyboard()
|
||||
k.type_string(otp)
|
||||
elif args.copy_clipboard:
|
||||
pyperclip.copy(otp)
|
||||
else:
|
||||
print(otp)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user