diff options
author | Florian Bruhin <git@the-compiler.org> | 2012-10-20 16:58:56 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2012-10-20 16:58:56 +0200 |
commit | b8f7d2c10a9b66485873026042f11e4fc1685f38 (patch) | |
tree | ad65e0c9e893c7e0fe87a15d3051ac86262523d5 | |
parent | b88d2e2260d2648e5b24c070dc1eaecd34898b52 (diff) | |
download | sgp-master.tar.gz sgp-master.zip |
-rwxr-xr-x | sgp.py | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -17,6 +17,7 @@ # along with spg.py If not, see <http://www.gnu.org/licenses/>. import hashlib +import getpass import base64 import re import subprocess @@ -261,16 +262,6 @@ def verify_masterpassword(masterpassword): else: return(False) -def call_zenity(*args): - args = [ '--' + arg for arg in args ] - try: - out = subprocess.check_output(['zenity', '--title=superpassgen'] + - args) - except subprocess.CalledProcessError: - sys.exit(0) - out = out.decode('UTF-8').rstrip('\n') - return(out) - def output_console(masterpassword): verify_salt = base64.b64encode(os.urandom(48)).decode('UTF-8') masterpassword = verify_salt + masterpassword @@ -287,14 +278,15 @@ def output_console(masterpassword): print("}") def main(): - masterpassword = call_zenity('password') + masterpassword = getpass.getpass() verification = verify_masterpassword(masterpassword) if verification == False: - call_zenity('error', 'text=Wrong password!') + print("Error: Wrong password!") + sys.exit(1) if '--setup' in sys.argv: output_console(masterpassword) else: - url = call_zenity('entry') + url = input("Enter URL: ") print(sgp(url, masterpassword) + '\n') if __name__ == '__main__': |