Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

devin blair
devin blair
4,955 Points

My version of password_checker

had some fun with the pass checker code, now after the last failed attempt it disables all keys plus keyboard interruptions so you can't ctrl+c out of the program. It still stores the password in plain text but it was just for fun, I ran the file as a command in my bashrc so now when you open your terminal you need the password to actually access it.

import sys
import time
import keyboard
import signal, os

x = False

password = input("Enter the password ")
attempt_count = 1
while password != "Secure-passwd":
    if attempt_count > 3:
      print("Too many invalid password attempts Now the system is frozen forever........")
      signal.signal(signal.SIGINT, signal.SIG_IGN)
      while not x: time.sleep(0.1)
      for i in range(99999999999999999999):
        keyboard.block_key(i)

    password = input("Invalid password try again: ")
    attempt_count += 1
print("welcome!")