@app.route('/getUrl', methods=['GET', 'POST'])
def getUrl():
url = request.args.get("url")
host = parse.urlparse(url).hostname
if host == 'suctf.cc':
return "我扌 your problem? 111"
parts = list(urlsplit(url))
host = parts[1]
if host == 'suctf.cc':
return "我扌 your problem? 222 " + host
newhost = []
for h in host.split('.'):
newhost.append(h.encode('idna').decode('utf-8'))
parts[1] = '.'.join(newhost)
finalUrl = urlunsplit(parts).split(' ')[0]
host = parse.urlparse(finalUrl).hostname
if host == 'suctf.cc':
return urllib.request.urlopen(finalUrl).read()
else:
return "我扌 your problem? 333"
- 前面两个if用来判定host是否时suctf.cc如果是则报错
for h in host.split('.'):
newhost.append(h.encode('idna').decode('utf-8'))
- 将域名部分先进行idna编码再进行utf-8解码
- 之后再进行去空格的操作
- 如果此时host的值还是suctf.cc则可以读取文件
- 完全不会啊!!!!看wp了
- wtcl…