A Fun Python Password Program

This started out as a very simple example of a bash-script example for a simple password-required app. I started thinking that it would be pretty easy to crack the password, and thinking about different ways that the password could be hidden better. Since it has no password-recovery function (yet), I was thinking “Who you gonna call!” to help with getting the password back after you lose it.
The obvious answer was “Ghostbusters!” Then I added an easter egg. With apologies to all the affronted parties involved:

#!/usr/bin/python
# -*- coding: utf-8 -*-
# keymaster.py
password="xul"
password2="moo"
answer=""
# Loop around forever (until the break statement is used)
while password2==password2:
# Ask the user for the password
answer = raw_input("\nI am the gatekeeper. Are you the Keymaster?\nIf you are the Keymaster, enter the key: -> " )
# Read in what they type, and put in it $answer
# If the answer is the password, break out of the while loop
if answer == password:
break
if answer == password2:
print '''

ascii art cow

ascii art cow

....\"Have you mooed today?\"...
.... \"I am a Little Cow!\n\"...'''
print "\nMoo? Moo??! \nI asked if you were the Keymaster, not the CowMaster!!\nThe keymaster would never say \"",answer,".\" \nGo and find the keymaster! \nDon't come grazing around here until you do!\n\n"
# If they get to here, they must really be the Keymaster,
# and not just a little cow
# otherwise the script would keep looping
print "\nWelcome Keymaster.\nWe must make the way ready for the return of Xul!"

The three possible outputs look like this

outputs of keymaster.py

outputs of keymaster.py

2 comments

Leave a Reply