#!/usr/bin/env python3 """Recover the JavaScript Mission 5 password from the fetched page source. The page assigns the expected value at load time: moo = unescape('%69%6C%6F%76%65%6D%6F%6F'); `unescape()` is the legacy percent-decoder, so the password is just that literal decoded once. urllib.parse.unquote is the modern equivalent. """ import re import urllib.parse
defmain(): src = open("lvl5.html", encoding="utf-8", errors="replace").read() match = re.search(r"unescape\('([^']*)'\)", src) ifmatchisNone: raise SystemExit("could not find an unescape() literal in lvl5.html") encoded = match.group(1) password = urllib.parse.unquote(encoded) print("encoded :", encoded) print("decoded :", repr(password))