diff --git a/README.rst b/README.rst index 29d0a31..791499a 100644 --- a/README.rst +++ b/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 - diff --git a/requirements.txt b/requirements.txt index 883b237..58f3cf0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py index 83d7907..d90f230 100644 --- a/setup.py +++ b/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 diff --git a/softtoken/softtoken.py b/softtoken/softtoken.py index e81ec14..7015253 100644 --- a/softtoken/softtoken.py +++ b/softtoken/softtoken.py @@ -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)