1
0
mirror of https://github.com/gryf/softtoken.git synced 2025-12-19 04:20:22 +01:00

Added clipboard support with -C option

This commit is contained in:
Daniel Alvarez
2016-12-24 11:39:11 +01:00
parent 53cd1f79fe
commit 9bc5020cd8
4 changed files with 17 additions and 15 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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)