From 24ac6ad06f6b69cecb020601415f8605f5a6e75a Mon Sep 17 00:00:00 2001 From: mxmehl Date: Fri, 10 Jul 2015 14:30:22 +0300 Subject: [PATCH] password anti-disclosure for python script --- adduser.py | 6 +++++- changepw.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/adduser.py b/adduser.py index cab8340..b754bf5 100755 --- a/adduser.py +++ b/adduser.py @@ -5,7 +5,11 @@ import pexpect # Read variables of first and second given argument user = str(sys.argv[1]) -password = str(sys.argv[2]) +passwordfile = str(sys.argv[2]) + +# Read content of passwordfile and put as variable "password" +with open (passwordfile, "r") as myfile: + password=myfile.read().replace('\n', '') # Define function def _vadduser(user, password): diff --git a/changepw.py b/changepw.py index e2197ce..9685b02 100755 --- a/changepw.py +++ b/changepw.py @@ -11,7 +11,6 @@ passwordfile = str(sys.argv[2]) with open (passwordfile, "r") as myfile: password=myfile.read().replace('\n', '') - # Define function def _vchangepw(user, password): changepw = pexpect.spawn(