# GenCyber Login Program
import getpass
# Password "database".
password_db = {"Bill" : "Clawhammer",
"Jesse" : "Mitsu",
"Steven" : "Muddy",
"Ashley" : "Shadow"}
# Keep track of if we should keep looping.
loop_again = True
while loop_again:
# Collect login information.
print("\n\n=========Login Page===========")
username = input("Username: ")
password = getpass.getpass()
# Get correct password from database that matches username.
correct_password = password_db.get(username)
if correct_password == None:
# If correct_password is None that means user was not found.
print("User Not Found!")
elif correct_password != password:
# If passwords do not match then password is wrong.
print("Invalid Password")
elif correct_password == password:
# If the password match stop looping and log in user.
loop_again = False
print("Congratulations, you are logged in.")
# GenCyber Login Program
import getpass
import datetime
# Password "database".
password_db = {"Bill" : "Clawhammer",
"Jesse" : "Mitsu",
"Steven" : "Muddy",
"Ashley" : "Shadow"}
# Keep track of login attempts.
attempt_list = []
# Keep track if too many login attempts.
is_too_many_attempts = False
# Keep track of if we should keep looping.
loop_again = True
while loop_again:
# Collect login information.
print("\n\n=========Login Page===========")
username = input("Username: ")
password = getpass.getpass()
# Get correct password from database that matches username.
correct_password = password_db.get(username)
if correct_password == None:
# If correct_password is None that means user was not found.
print("User Not Found!")
elif correct_password != password:
# If passwords do not match then password is wrong.
print("Invalid Password")
elif correct_password == password:
# If the password match stop looping and log in user.
loop_again = False
# If we're going to loop again check to see if there have been
# too many attempts.
if loop_again:
if len(attempt_list) == 3:
# If list has three items remove the first.
attempt_list.pop(0)
# Add current time to the end of the attempt list.
attempt_list.append(datetime.datetime.now())
# Check if there are three attempts in the list.
if len(attempt_list) == 3:
# Calculate time between first and third attempt.
delta = attempt_list[2] - attempt_list[0]
# Check if the time between first and third attempt
# is less than 15 minutes.
if delta.total_seconds() <= (1 * 60):
# Set too many attempts to true.
is_too_many_attempts = True
# Set loop again to false.
loop_again = False
# Check if there have been too many attempts.
if is_too_many_attempts:
print("Too many login attempts")
else :
# If we get this far we have logged in successfully.
print("Congratulations, you are logged in.")
# GenCyber Login Program
import getpass
import datetime
import bcrypt
# Password "database".
password_db = {"Bill" : "Clawhammer",
"Jesse" : "Mitsu",
"Steven" : "Muddy",
"Ashley" : "Shadow"}
# Hash all of the passwords in the database.
for key, value in password_db.items():
password_db[key] = bcrypt.hashpw(value.encode(), bcrypt.gensalt())
# Keep track of login attempts.
attempt_list = []
# Keep track if too many login attempts.
is_too_many_attempts = False
# Keep track of if we should keep looping.
loop_again = True
while loop_again:
# Collect login information.
print("\n\n=========Login Page===========")
username = input("Username: ")
password = getpass.getpass()
# Get correct password from database that matches username.
correct_password = password_db.get(username)
if correct_password == None:
# If correct_password is None that means user was not found.
print("User Not Found!")
else:
# Compare password to the hashed password database.
if bcrypt.checkpw(password.encode(), correct_password):
# If the password match stop looping and log in user.
loop_again = False
else:
# If pasword do not match then password is wrong.
print("Invalid Password")
# If we're going to loop again check to see if there have been
# too many attempts.
if loop_again:
if len(attempt_list) == 3:
# If list has three items remove the first.
attempt_list.pop(0)
# Add current time to the end of the attempt list.
attempt_list.append(datetime.datetime.now())
# Check if there are three attempts in the list.
if len(attempt_list) == 3:
# Calculate time between first and third attempt.
delta = attempt_list[2] - attempt_list[0]
# Check if the time between first and third attempt
# is less than 15 minutes.
if delta.total_seconds() <= (1 * 60):
# Set too many attempts to true.
is_too_many_attempts = True
# Set loop again to false.
loop_again = False
# Check if there have been too many attempts.
if is_too_many_attempts:
print("Too many login attempts")
else :
# If we get this far we have logged in successfully.
print("Congratulations, you are logged in.")
# GenCyber Login Program
import getpass
import datetime
import bcrypt
# Password "database".
password_db = {"Bill" : "Clawhammer",
"Jesse" : "Mitsu",
"Steven" : "Muddy",
"Ashley" : "Shadow"}
# Hash all of the passwords in the database.
for key, value in password_db.items():
password_db[key] = bcrypt.hashpw(value.encode(), bcrypt.gensalt())
print(password_db["Bill"])
print(password_db["Jesse"])
print(password_db["Steven"])
print(password_db["Ashley"])
# Keep track of login attempts.
attempt_list = []
# Keep track if too many login attempts.
is_too_many_attempts = False
# Keep track of if we should keep looping.
loop_again = True
while loop_again:
# Collect login information.
print("\n\n=========Login Page===========")
username = input("Username: ")
password = getpass.getpass()
# Get correct password from database that matches username.
correct_password = password_db.get(username)
if correct_password == None:
# If correct_password is None that means user was not found.
print("User Not Found!")
else:
# Compare password to the hashed password database.
if bcrypt.checkpw(password.encode(), correct_password):
# If the password match stop looping and log in user.
loop_again = False
else:
# If pasword do not match then password is wrong.
print("Invalid Password")
# If we're going to loop again check to see if there have been
# too many attempts.
if loop_again:
if len(attempt_list) == 3:
# If list has three items remove the first.
attempt_list.pop(0)
# Add current time to the end of the attempt list.
attempt_list.append(datetime.datetime.now())
# Check if there are three attempts in the list.
if len(attempt_list) == 3:
# Calculate time between first and third attempt.
delta = attempt_list[2] - attempt_list[0]
# Check if the time between first and third attempt
# is less than 15 minutes.
if delta.total_seconds() <= (1 * 60):
# Set too many attempts to true.
is_too_many_attempts = True
# Set loop again to false.
loop_again = False
# Check if there have been too many attempts.
if is_too_many_attempts:
print("Too many login attempts")
else :
# If we get this far we have logged in successfully.
print("Congratulations, you are logged in.")
# GenCyber Login Program
import getpass
import datetime
import bcrypt
# Password "database".
password_db = {"Bill" : b'$2b$12$5LDl.CSlUuvwNuK13V5HLO4ttZ/Vn99W5m0pbSQvUl4f7ydtTnbmy',
"Jesse" : b'$2b$12$rJ32ZU6Z6aeFBTOrR1RHh.vRq.ul5udl/tAZgcGkz9lu.q3YJbl5O',
"Steven" : b'$2b$12$3HttUIKLbVne3JEdWPmSPeDvbcgolhdiaHIq6e1gWURgNRxj.8c1G',
"Ashley" : b'$2b$12$NIfL873dQaXDEZMErzHFs.SIpVXyHZTTKVPbA4ySTvYGqtNhav86G'}
# Keep track of login attempts.
attempt_list = []
# Keep track if too many login attempts.
is_too_many_attempts = False
# Keep track of if we should keep looping.
loop_again = True
while loop_again:
# Collect login information.
print("\n\n=========Login Page===========")
username = input("Username: ")
password = getpass.getpass()
# Get correct password from database that matches username.
correct_password = password_db.get(username)
if correct_password == None:
# If correct_password is None that means user was not found.
print("User Not Found!")
else:
# Compare password to the hashed password database.
if bcrypt.checkpw(password.encode(), correct_password):
# If the password match stop looping and log in user.
loop_again = False
else:
# If pasword do not match then password is wrong.
print("Invalid Password")
# If we're going to loop again check to see if there have been
# too many attempts.
if loop_again:
if len(attempt_list) == 3:
# If list has three items remove the first.
attempt_list.pop(0)
# Add current time to the end of the attempt list.
attempt_list.append(datetime.datetime.now())
# Check if there are three attempts in the list.
if len(attempt_list) == 3:
# Calculate time between first and third attempt.
delta = attempt_list[2] - attempt_list[0]
# Check if the time between first and third attempt
# is less than 15 minutes.
if delta.total_seconds() <= (1 * 60):
# Set too many attempts to true.
is_too_many_attempts = True
# Set loop again to false.
loop_again = False
# Check if there have been too many attempts.
if is_too_many_attempts:
print("Too many login attempts")
else :
# If we get this far we have logged in successfully.
print("Congratulations, you are logged in.")