47
47
48
48
icmd = input ("Enter ID:" )
49
49
if icmd == '' :
50
- print ("\033 [1;31;40m Error id. \033 [1;37;40m" )
50
+ print ("\033 [1;31;40m Error id. \033 [1;37;40m\n " )
51
51
else :
52
52
d .execute ("SELECT id,name FROM db_password.tb_nap WHERE id= %s" ,(icmd ,)) #select id,name from id input
53
53
i .execute ("SELECT password FROM db_password.tb_nap WHERE id= %s" ,(icmd ,)) #select password from id input
71
71
decrypted = decrypted = f .decrypt (p_encode ) #decrypted
72
72
ogpasswd = decrypted .decode () #decode from byte to string
73
73
74
- print ("Password for" ,p ,"is" ,ogpasswd ) #show id,name,password
74
+ print ("Password for" ,p ,"is" ,ogpasswd , " \n \n " ) #show id,name,password
75
75
76
76
77
77
#insert
81
81
p = input ("password>" )
82
82
83
83
if n == '' or p == '' : #detect blank input
84
- print ("\033 [1;31;40m Can't insert into database.Plese input all of data. \033 [1;37;40m" )
84
+ print ("\033 [1;31;40m Can't insert into database.Plese input all of data. \033 [1;37;40m\n " )
85
85
else :
86
86
k = ("key" ) #set key
87
87
k_encode = k .encode () #encode key to byte
104
104
mycursor .execute (sql , val )
105
105
mydb .commit () #confirm operation to database
106
106
107
- print (mycursor .rowcount , "password inserted" ) #show number(s) of query that have inserted
107
+ print (mycursor .rowcount , "password inserted\n \n " ) #show number(s) of query that have inserted
108
108
109
109
#delete
110
110
elif cmd == 'd' or cmd == 'D' :
111
111
mycursor .execute ("SELECT id,name FROM db_password.tb_nap" ) #select id,name from db
112
112
myresult = mycursor .fetchall ()
113
113
for x in myresult : #show id,name query in database
114
- print ("What you want to delete" )
114
+ print ("What you want to delete? " )
115
115
print (x )
116
116
117
117
i = input ("Enter id:" ) #enter query id
123
123
mycursor .execute (sql , (i ,))
124
124
mydb .commit () #confirm operation to database
125
125
126
- print (mycursor .rowcount , "name and password deleted" ) #show number(s) of query that have deleted
126
+ print (mycursor .rowcount , "name and password deleted\n \n " ) #show number(s) of query that have deleted
127
127
128
128
#error
129
129
else :
130
- print ("\033 [1;31;40m Error,Can't define command...plese try again \033 [1;37;40m\n " )
130
+ print ("\033 [1;31;40m Error,Can't define command...plese try again \033 [1;37;40m\n " )
131
+
132
+ os .system ('pause' )
0 commit comments