2016-02-11 20:27:41 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import sys, re
|
2016-02-11 20:39:56 +01:00
|
|
|
from epasswd import EPasswd
|
2016-02-11 20:27:41 +01:00
|
|
|
|
|
|
|
if len(sys.argv)<4:
|
|
|
|
sys.exit(-2)
|
|
|
|
|
|
|
|
passfile=sys.argv[1]
|
|
|
|
myfaction=sys.argv[2]
|
|
|
|
mypasswd=sys.argv[3]
|
|
|
|
|
|
|
|
if mypasswd[0]=='"':
|
|
|
|
mypasswd=mypasswd[1:len(mypasswd)-1]
|
|
|
|
|
2016-02-11 20:39:56 +01:00
|
|
|
pw_data=EPasswd(passfile)
|
|
|
|
if pw_data.fac_exists(myfaction):
|
|
|
|
if pw_data.check(myfaction, mypasswd):
|
|
|
|
sys.exit(0)
|
2016-02-11 20:27:41 +01:00
|
|
|
sys.exit(-1)
|