Skip to content

Lab · Cyber Security: from zero to SOC analyst

Lab: a password checker for a college portal

Labbeginner· about 1.5 hours· 5 steps

The brief

A college in Bhopal is launching a student portal and wants to stop weak passwords at sign-up. You write the checker in Python: length, kinds of characters, a list of leaked passwords, and a final verdict. Then you protect your own email account with multi-factor authentication.

Why it matters

Weak and reused passwords are behind a large share of account takeovers. Every sign-up form, HR portal and banking app runs a check like this, and security teams write the policy behind it. Turning on MFA is the single most useful thing anyone can do for their own accounts.

Skills you practise

  • password length and complexity
  • leaked-password lists
  • functions and booleans
  • multi-factor authentication

You need

  • Your own email account (Gmail, Outlook or similar) and your phone, for the MFA step

What you will have at the end

password_check.py, a tested password checker with a clear verdict, and MFA turned on for your own email account.

How it is marked (rubric, 100 points)
Correct checksAll four functions pass, including edge cases such as exactly 12 characters and capital letters in leaked passwords.45
Sound policyLeaked passwords are always weak; long passphrases are accepted; the order of checks is right.25
Own account protectedMFA is on with an authenticator app or passkey, and backup codes are stored offline.20
Readable codeClear names and each function does one job.10

0/5 steps done

Step 1 of 5

Long enough

long_enough(pw) is True when the password has at least 12 characters.

Length is the strongest single defence against guessing: every extra character multiplies the number of possible passwords. Many modern policies ask for at least 12 characters. len() counts the characters in a string. Compare it with minimum and return the True or False result.

Run shows what your code prints. Check runs the step's tests. Ctrl+Enter checks too.