Hey amigo,
A common friend said you can help me out, you’ll be rewarded for your time - handsomely - don’t worry.
We phished some buffoon to get access, but this stands in our way to leak their entire database, it’s supposed to spit out some numbers we can use as an access code. Johnny said you’ll need Python 3.6 or 3.7 to run it (I’m not good with numbers, see if it runs FFS), and then give us the code.
import random
PASSWORD = random.weibullvariate(alpha=13, beta=37)
class InvalidUsernameException(BaseException):
def __init__(self, invalid_username: str) -> None:
print(
f"'{invalid_username.format(error=self)}' "
f"is not recognised as an authorised user, "
f"but login is permitted with the secret key."
)
class InvalidPasswordException(BaseException):
def __init__(self):
print("Invalid password provided. Authorities have been informed.")
def grant_access():
print(
f"*** Access Granted! ***\n\n"
f" The Shirai Ryu are ninja, Liu Kang\n\n"
f"The access code is: {PASSWORD / random.triangular()}"
)
def check_password(user_password: str) -> None:
if user_password != str(PASSWORD):
raise InvalidPasswordException()
if __name__ == "__main__":
username = input("Username: ")
password = PASSWORD
try:
if username != "the_mighty_snail":
raise InvalidUsernameException(username)
except InvalidUsernameException:
password = input("Secret: ")
finally:
check_password(password)
grant_access()
Hint 1
The idiot who wrote it messed up: the hard coded account doesn’t even work, because there’s a type mismatch between the passwords, so don’t bother
Hint 2
I wonder what the fuck was this guy thinking when he implemented InvalidUsernameException. I bet he showed that code around with pride and shit
Hint 3
Ah yeah, Nicky said there’s no sanitation on the username you enter, and you might be able to run some python bullshit there. Don’t care, just give me the code!