-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecurify.py
41 lines (33 loc) · 1.15 KB
/
securify.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# ------------------------------------------------------------------------------
# Name: PasswordProtect
# Purpose:
#
# Author: gokul
#
# Created: 24/01/2014
# Copyright: (c) gokul 2014
# Licence: <your licence>
# ------------------------------------------------------------------------------
import keyring
import optparse
import platform
class PasswordProtect(object):
def __init__(self, service):
self.service = service
def getPass(self, username):
if platform.system() == 'Linux':
return 'omsakthi'
pswd = keyring.get_password(self.service, username)
return pswd
def setPass(self, username, pswd):
keyring.set_password(self.service, username, pswd)
def main():
p = optparse.OptionParser()
p.add_option("-b", "--baseurl", type="string", action="store", dest="url")
p.add_option("-u", "--userid", type="string", action="store", dest="userid")
p.add_option("-p", "--password", type="string", action="store", dest="pswd")
opt, _ = p.parse_args()
ps_pt = PasswordProtect(opt.url)
ps_pt.setPass(opt.userid, opt.pswd)
if __name__ == '__main__':
main()