Python3 impersonate a user password three times after the error is locked

Source: Internet
Author: User

#Locklist.txt Impersonation Lock user list format is as follows#User1#User2#userlist.txt Template Registration user list format is as follows#User1:password1#User2:password2#number of inputs initializedCount =0 whileTrue:#Get user InputUsername = input ("Input your username:") Password= Input ("Password:")        #determine whether the user is locked in the user listlock_list = open ("Locklist.txt","R")     whileTrue:lock_list_line= Lock_list.readline (). Split (":")        ifUsername = = Lock_list_line[0].replace ("\ n",""):            Print("User is locked") exit ()elifLock_list_line[0] = ="":             Breaklock_list.close ()#determine if the user's password is correctuser_list = open ("Userlist.txt","R")     whileTrue:user_list_line=user_list.readline (). Split (":")        ifUsername = = User_list_line[0] andPassword = = User_list_line[1].replace ("\ n",""):            Print("welcom"+username) exit ()elifUsername = =User_list_line[0]: Count+=1#same user password error three times write user to lock list            ifCount = = 3: Lock_list= Open ("Locklist.txt","a") Lock_list.write (username+"\ n") Lock_list.close () exit ("User is locked")            Print("Password input Error! ")             Break        elifUser_list_line[0] = ="":            Print("user does not exist! ")             Breakuser_list.close ()

Python3 impersonate a user password three times after the error is locked

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.