@@ -8,13 +8,59 @@ class Keepasx():
88
99 def __init__ (self , file_name ):
1010 self .file_name = file_name
11+ while True :
12+ menu = self .input_control_error ("""
13+ Lütfen İşlem seçiniz:
14+ 1 - Yeni parola oluştur
15+ 2 - Parolaları listele
16+ 3 - Parola ara
17+ """ ,is_numeric = True )
18+ if menu == 1 :
19+ self .register_new_pass ()
20+ elif menu == 2 :
21+ self .list ()
22+ elif menu == 3 :
23+ key = self .input_control_error ("Arama Kriteri :" )
24+ self .search (key )
25+ else :
26+ print ('Hatalı Girdi' )
27+
28+
29+
30+ def input_control_error (self ,text ,is_numeric = False ):
31+ input_error = True
32+ while input_error :
33+ input_data = input (text )
34+ if input_data .strip () != "" :
35+ if is_numeric :
36+ if input_data .isnumeric ():
37+ return int (input_data )
38+ else :
39+ print ('Geçersiz girdi' )
40+ else :
41+ return input_data
42+ else :
43+ print ('Geçersiz girdi' )
44+
45+
1146
1247 def register_new_pass (self ):
1348 """
1449 Kullanıcıdan kullanıcı adı , açıklama ve parola ister
1550 eğer parola boş ise kendisi random bir parola oluşturur
1651 oluşturulacak parola uzunluğunu da kullanıcıdan isteyeceğiz
1752 """
53+ username = self .input_control_error ("Lütfen Kullanıcı adı giriniz :" )
54+ password = input ("Lütfen parolanızı giriniz:" )
55+ if password .strip () == "" :
56+ password_length = self .input_control_error ('Lütfen parola uzunluğu giriniz' ,is_numeric = True )
57+ password = self .generate_pass (password_length )
58+ aciklama = self .input_control_error ("Lütfen açıklama giriniz :" )
59+
60+
61+
62+ self .mypasslist .append ({"username" :username ,"password" :password ,"description" :aciklama })
63+ self .save ()
1864
1965 def edit (self ):
2066 """
@@ -65,5 +111,5 @@ def generate_pass(self, length):
65111 return '' .join ([string_data [random .randint (0 , len (string_data ) - 1 )] for i in range (0 , length )])
66112
67113
68- kep = Keepasx ()
114+ kep = Keepasx ("passfile.txt" )
69115print (kep .generate_pass (10 ))
0 commit comments