美文网首页
[网络安全实验室]脚本关

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

作者: JasonChiu17 | 来源:发表于2018-01-23 10:26 被阅读204次

1.快速口算

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

  • python脚本,写了一个函数。
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

  • payload={'v':eval(num)} ,
    为什么key='v',因为name='v';
    383523868+627(3835+23868)=<input type="text" name="v"/>
    网页源码如下:
<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>'
  • key is 123iohHKHJ%^&*(jkh

相关文章

网友评论

      本文标题:[网络安全实验室]脚本关

      本文链接:https://www.haomeiwen.com/subject/dgojaxtx.html