Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

devin blair
devin blair
2,345 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!")