[网络安全实验室]脚本关

2018-01-23  本文已影响204人  JasonChiu17

1.快速口算

小明要参加一个高技能比赛,要求每个人都要能够快速口算四则运算,2秒钟之内就能够得到结果,但是小明就是一个小学生没有经过特殊的培训,那小明能否通过快速口算测验呢
http://lab1.xseclab.com/xss2_0d557e6d2a4ac08b749b61473a075be1/index.php

def compute(url):
    import re
    import requests
    s=requests.Session()
    r=s.get(url).content
    res=r.decode('utf-8')
    pattern=r'<br/>\s+(.*?)='
    num=re.findall(pattern,res)[0]
    payload={'v':eval(num)}
    post=s.post(url,data=payload)
    ans=post.content.decode('utf-8')
    return ans

<pre id="line1">
<html> 
<head>  
<meta http-equiv=Content-Type content="text/html;charset=utf-8">  </head>  
<body>  
<form action="[](view-source:http://lab1.xseclab.com/xss2_0d557e6d2a4ac08b749b61473a075be1/index.php)" method="post"> 
请在2秒内口算结果并提交!
<br/> 5229*39924+476*(5229+39924)=
<input type="text" name="v"/> 
<input type="submit" value="提交"/> 
</form>  
</body>  
</html>  
</pre>

In [79]: s=compute('http://lab1.xseclab.com/xss2_0d557e6d2a4ac08b749b61473a075be1/index.php')
In [80]: s
Out[80]: '<html>\n    
<head>\n        
<meta http-equiv=Content-Type content="text/html;charset=utf-8">\n    
</head>\n   
<body>key is 123iohHKHJ%^&*(jkh   
</body>\n</html>'
上一篇 下一篇

猜你喜欢

热点阅读