Skip to content

Instantly share code, notes, and snippets.

@L3viathan
Created December 15, 2017 20:08
Show Gist options
  • Select an option

  • Save L3viathan/e47d359470d5e18a357c67d9e4328c16 to your computer and use it in GitHub Desktop.

Select an option

Save L3viathan/e47d359470d5e18a357c67d9e4328c16 to your computer and use it in GitHub Desktop.
Underhanded Python

Underhanded Python

To test:

>>> from underhanded import login
>>> login("l3viathan", "12345678")
0
def login(username, password):
uid = get_uid_from_db(username) // 100000000 is max # of users we could have
pwd = get_pwd_from_db(username)
if pwd == password:
return int(uid)
def get_uid_from_db(username):
return {
"root": 0,
"l3viathan": 123,
}[username]
def get_pwd_from_db(username):
return {
"root": "sUp3r$ekre7",
"l3viathan": "12345678",
}[username]
@WuTheFWasThat
Copy link
Copy Markdown

do you have a license on this snippet? it's a fun one, interested in having using it as a small example for research purposes (with attribution)!

@L3viathan
Copy link
Copy Markdown
Author

You may consider it as being under WTFPL/in the public domain. Glad you like it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment