1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- from __future__ import print_function
- import time
- from pwman.ui.cli import PwmanCli
- from pwman.ui import tools
- from pwman.util.crypto_engine import CryptoEngine
- class PwmanCliMac(PwmanCli):
- """
- inherit from PwmanCli, override the right functions...
- """
- def do_copy(self, args):
- ids = self._get_ids(args)
- if len(ids) > 1:
- print("Can only 1 password at a time...")
- return None
- nodes = self._db.getnodes(ids)
- ce = CryptoEngine.get()
- for node in nodes:
- password = ce.decrypt(node[2])
- tools.text_to_mcclipboard(password)
- flushtimeout = self.config.get_value('Global', 'cp_timeout')
- flushtimeout = flushtimeout or 10
- print("erasing in {} sec...".format(flushtimeout))
- time.sleep(int(flushtimeout))
- tools.text_to_mcclipboard("")
|