~sircmpwn/pass-rotate

ref: 837d726c037a6d52bd5cbf159a75386a39e4dea0 pass-rotate/passrotate/__init__.py -rw-r--r-- 710 bytes
837d726cDrew DeVault Merge pull request #29 from gabm/AddPassName 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from passrotate.provider import get_provider, get_providers
import passrotate.providers
from getpass import getpass

def _getpass_prompt(prompt, prompt_type):
    return getpass(prompt=prompt + ": ")

class PassRotate():
    def __init__(self):
        self.prompt = _getpass_prompt

    def get_provider_class(self, name):
        return get_provider(name)

    def get_provider(self, name, options):
        cls = self.get_provider_class(name)
        if not cls:
            return None
        instance = cls(options)
        instance._prompt = self.prompt
        return instance

    def get_providers(self):
        return get_providers()

    def set_prompt(self, prompt):
        self.prompt = prompt