Skip to content

Instantly share code, notes, and snippets.

@rHermes
Created May 31, 2014 20:01
Show Gist options
  • Save rHermes/1668c96c3c140e595f71 to your computer and use it in GitHub Desktop.
Save rHermes/1668c96c3c140e595f71 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2
# Written by Alexogo and rHermes
print('Welcome to the QSL Login site, please enter your credentials.')
#TODO: Hash these passwords, as this could be read straight from memory.
logins = {
"QSL Alexogo": "Test01",
"QSL Viper": "Test02",
"QSL Kharazs": "Test03",
"QSL Amumund": "Test04",
"QSL Zettern": "Test05",
"QSL Scourge": "Test06",
"ST Maikrov": "Test07",
}
# Password loop
while(True):
username = raw_input("Username: ")
password = raw_input("Password: ")
# dict.get() has default=None as standard, but this script is for learning.
if logins.get(username, None) == password:
print("Logged in Successfully as {0}".format(username))
while(True):
command = raw_input("{0} # ".format(username))
# We don't have a sense of capital letters when it comes to exiting.
if command.lower() == "exit":
print("Logging out.")
break
else:
print("'{0}' is not a valid command!".format(command))
else:
print("Invalid Credentials.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment