0% found this document useful (0 votes)
5 views3 pages

Loop Security

Information Tech

Uploaded by

Jameel Mohammed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Loop Security

Information Tech

Uploaded by

Jameel Mohammed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
@ Activity: Strengthening Your Login System Context: Last class, you built a simple Python program that asks for a username and password until the correct ones are entered. But real-world systems need to be more secure. Today, you'll explore why and how to improve your program. @ Learning Objectives: By the end of this lesson, you should be able to: Explain why unlimited login attempts are a security risk. * Describe what a brute force attack is. ‘© Improve your program to include: © Alimited number of login attempts. Ashort time delay between failed attempts. ® Warm-up Questions (Think-Pair-Share): 1. What could happen if a hacker keeps trying different passwords over and over? 2. Why is allowing unlimited login attempts unsafe? 3. What do you think a brute force attack is? 4, What are some simple ways we can prevent it? @ Task 1: Limit Login Attempts Modify your login code to stop asking after 3 incorrect attempts. Helpful Questions: * How can you count how many times the user has failed? + What kind of loop structure do you need? * How do you stop the loop after 3 tries? Goal: Show a message like: ain Deo Best Too many failed attempts. Access denied. © Task 2: Add a Time Delay Between Attempts Real systems add a short pause after each failed login attempt to slow down attackers Try this line of code: en eo Bes import time [Link](3) Helpful Questions: * Where in your code should the delay go? * Should the delay happen after a correct login? Goal: Add a 3-second delay after each failed attempt, Bonus Challenge (For Curious Coders) Explore this advanced idea: hashing a password before checking it Try this: oe Deo Bea import hashlib password = "1234" hashed = hashlib. sha256([Link]()) .hexdigest() print (hashed) Questions to Explore: © What do you think a hash is? * Why might it be better than storing the real password? * What happens when you hash the same password twice? Goal: Print the hashed version of a password. Try a few different ones. (Note: You don't need to use hashing in your main program yet — this is just for exploration.) Wrap-up When you're done: * Test your program with wrong and right passwords. * Make sure it locks out after 3 tries. + Make sure the delay is working! © Be ready to explain: © What a brute force attack is. * How your code protects against it.

You might also like