-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPC008.py
More file actions
17 lines (13 loc) · 734 Bytes
/
PC008.py
File metadata and controls
17 lines (13 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# http://www.pythonchallenge.com/pc/def/integrity.html
from urllib.request import urlopen
import bz2
url = urlopen('http://www.pythonchallenge.com/pc/def/integrity.html').read()
un = str(url).split("un: \\'")[1].split("\\'")[0].replace('\\\\', "\\", -1) # un as string
pw = str(url).split("pw: \\'")[1].split("\\'")[0].replace('\\\\', "\\", -1) # pw as string
# convert to the same string as bytes (otherwise there would be double backslashes
un = un.encode('ISO-8859-1').decode('unicode-escape').encode('ISO-8859-1')
pw = pw.encode('ISO-8859-1').decode('unicode-escape').encode('ISO-8859-1')
username = bz2.decompress(un)
password = bz2.decompress(pw)
print("User name is:", str(username))
print("Password is:", str(password))