當前位置: 首頁>>代碼示例>>Python>>正文


Python conf.httpHeaders方法代碼示例

本文整理匯總了Python中lib.core.data.conf.httpHeaders方法的典型用法代碼示例。如果您正苦於以下問題:Python conf.httpHeaders方法的具體用法?Python conf.httpHeaders怎麽用?Python conf.httpHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lib.core.data.conf的用法示例。


在下文中一共展示了conf.httpHeaders方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: expThreads

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def expThreads():
    """
    @function multiThread executing
    """
    zsp = PluginBase(package='zsplugins')
    plugin_zsp = zsp.make_plugin_source(searchpath=[paths.ZEROSCAN_PLUGINS_PATH])
    zspi = plugin_zsp.load_plugin('%s'%(kb.CurrentPlugin))

    while not kb.targets.empty() and kb.threadContinue:
        target = kb.targets.get()
        infoMsg = "exploit target:'%s'" % (target)
        log.process(infoMsg)
        # TODO
        result = zspi.exploit(target, headers=conf.httpHeaders)
        #插件中沒有返回值就默認是失敗
        if not result:
            continue
        output = (target, kb.CurrentPlugin, result)

        kb.results.add(output)
        if isinstance(conf.timeout, (int, float)) and conf.timeout > 0:
            time.sleep(conf.timeout) 
開發者ID:zer0yu,項目名稱:ZEROScan,代碼行數:24,代碼來源:controller.py

示例2: __init__

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def __init__(self):
        Cmd.__init__(self)
        os.system("clear")
        banner()

        conf.url = None
        conf.urlFile = None

        conf.cookie = None
        #隨機ua的實現
        #conf.randomAgent = False

        conf.threads = 1

        #是否需要html報告
        conf.report = None

        conf.timeout = 3
        conf.httpHeaders = HTTP_DEFAULT_HEADER

        self.prompt = "ZEROScan > " 
開發者ID:zer0yu,項目名稱:ZEROScan,代碼行數:23,代碼來源:consoles.py

示例3: forgeHeaders

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def forgeHeaders(cookie, ua):
    """
    Prepare HTTP Cookie and HTTP User-Agent headers to use when performing
    the HTTP requests
    """

    headers = {}

    for header, value in conf.httpHeaders:
        if cookie and header == "Cookie":
            headers[header] = cookie
        elif ua and header == "User-Agent":
            headers[header] = ua
        else:
            headers[header] = value

    return headers 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:19,代碼來源:basic.py

示例4: __setHTTPExtraHeaders

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def __setHTTPExtraHeaders():
    if conf.headers:
        debugMsg = "setting extra HTTP headers"
        logger.debug(debugMsg)

        conf.headers = conf.headers.split("\n")

        for headerValue in conf.headers:
            header, value = headerValue.split(": ")

            if header and value:
                conf.httpHeaders.append((header, value))

    else:
        conf.httpHeaders.append(("Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"))
        conf.httpHeaders.append(("Accept-Language", "en-us,en;q=0.5"))
        conf.httpHeaders.append(("Accept-Charset", "ISO-8859-15,utf-8;q=0.7,*;q=0.7")) 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:19,代碼來源:option.py

示例5: _search

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def _search(dork):
    """
    This method performs the effective search on Google providing
    the google dork and the Google session cookie
    """

    if not dork:
        return None

    headers = {}

    headers[HTTP_HEADER.USER_AGENT] = dict(conf.httpHeaders).get(HTTP_HEADER.USER_AGENT, DUMMY_SEARCH_USER_AGENT)
    headers[HTTP_HEADER.ACCEPT_ENCODING] = HTTP_ACCEPT_ENCODING_HEADER_VALUE

    try:
        req = urllib2.Request("https://www.google.com/ncr", headers=headers)
        conn = urllib2.urlopen(req)
    except Exception, ex:
        errMsg = "unable to connect to Google ('%s')" % getSafeExString(ex)
        raise SqlmapConnectionException(errMsg) 
開發者ID:ym2011,項目名稱:POC-EXP,代碼行數:22,代碼來源:search.py

示例6: __init__

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def __init__(self, handlers):
        self._cj = cookielib.CookieJar()

        handlers.append(urllib2.HTTPCookieProcessor(self._cj))
        handlers.append(HTTPSHandler())

        self.opener = urllib2.build_opener(*handlers)
        self.opener.addheaders = conf.httpHeaders

        try:
            conn = self.opener.open("https://www.google.com/ncr")
            conn.info()  # retrieve session cookie
        except Exception, ex:
            errMsg = "unable to connect to Google ('%s')" % getSafeExString(ex)
            raise SqlmapConnectionException(errMsg) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:17,代碼來源:google.py

示例7: initTargetEnv

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def initTargetEnv():
    """
    Initialize target environment.
    """

    if conf.multipleTargets:
        if conf.hashDB:
            conf.hashDB.close()

        if conf.cj:
            resetCookieJar(conf.cj)

        conf.paramDict = {}
        conf.parameters = {}
        conf.hashDBFile = None

        _setKnowledgeBaseAttributes(False)
        _restoreMergedOptions()
        _setDBMS()

    if conf.data:
        class _(unicode):
            pass

        kb.postUrlEncode = True

        for key, value in conf.httpHeaders:
            if key.upper() == HTTP_HEADER.CONTENT_TYPE.upper():
                kb.postUrlEncode = "urlencoded" in value
                break

        if kb.postUrlEncode:
            original = conf.data
            conf.data = _(urldecode(conf.data))
            setattr(conf.data, UNENCODED_ORIGINAL_VALUE, original)
            kb.postSpaceToPlus = '+' in original 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:38,代碼來源:target.py

示例8: _setHTTPExtraHeaders

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def _setHTTPExtraHeaders():
    if conf.headers:
        debugMsg = "setting extra HTTP headers"
        logger.debug(debugMsg)

        conf.headers = conf.headers.split("\n") if "\n" in conf.headers else conf.headers.split("\\n")

        for headerValue in conf.headers:
            if not headerValue.strip():
                continue

            if headerValue.count(':') >= 1:
                header, value = (_.lstrip() for _ in headerValue.split(":", 1))

                if header and value:
                    conf.httpHeaders.append((header, value))
            else:
                errMsg = "invalid header value: %s. Valid header format is 'name:value'" % repr(headerValue).lstrip('u')
                raise SqlmapSyntaxException(errMsg)

    elif not conf.httpHeaders or len(conf.httpHeaders) == 1:
        conf.httpHeaders.append((HTTP_HEADER.ACCEPT_LANGUAGE, "en-us,en;q=0.5"))
        if not conf.charset:
            conf.httpHeaders.append((HTTP_HEADER.ACCEPT_CHARSET, "ISO-8859-15,utf-8;q=0.7,*;q=0.7"))
        else:
            conf.httpHeaders.append((HTTP_HEADER.ACCEPT_CHARSET, "%s;q=0.7,*;q=0.1" % conf.charset))

        # Invalidating any caching mechanism in between
        # Reference: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
        conf.httpHeaders.append((HTTP_HEADER.CACHE_CONTROL, "no-cache,no-store"))
        conf.httpHeaders.append((HTTP_HEADER.PRAGMA, "no-cache")) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:33,代碼來源:option.py

示例9: _setHTTPReferer

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def _setHTTPReferer():
    """
    Set the HTTP Referer
    """

    if conf.referer:
        debugMsg = "setting the HTTP Referer header"
        logger.debug(debugMsg)

        conf.httpHeaders.append((HTTP_HEADER.REFERER, conf.referer)) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:12,代碼來源:option.py

示例10: _setHTTPHost

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def _setHTTPHost():
    """
    Set the HTTP Host
    """

    if conf.host:
        debugMsg = "setting the HTTP Host header"
        logger.debug(debugMsg)

        conf.httpHeaders.append((HTTP_HEADER.HOST, conf.host)) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:12,代碼來源:option.py

示例11: _setConfAttributes

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def _setConfAttributes():
    """
    This function set some needed attributes into the configuration
    singleton.
    """

    debugMsg = "initializing the configuration"
    logger.debug(debugMsg)

    conf.authUsername = None
    conf.authPassword = None
    conf.boundaries = []
    conf.cj = None
    conf.dbmsConnector = None
    conf.dbmsHandler = None
    conf.dnsServer = None
    conf.dumpPath = None
    conf.hashDB = None
    conf.hashDBFile = None
    conf.httpHeaders = []
    conf.hostname = None
    conf.ipv6 = False
    conf.multipleTargets = False
    conf.outputPath = None
    conf.paramDict = {}
    conf.parameters = {}
    conf.path = None
    conf.port = None
    conf.proxyList = None
    conf.resultsFilename = None
    conf.resultsFP = None
    conf.scheme = None
    conf.tests = []
    conf.trafficFP = None
    conf.wFileType = None 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:37,代碼來源:option.py

示例12: _setHTTPCookies

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def _setHTTPCookies():
    """
    Set the HTTP Cookie header
    """

    if conf.cookie:
        debugMsg = "setting the HTTP Cookie header"
        logger.debug(debugMsg)

        conf.httpHeaders.append((HTTP_HEADER.COOKIE, conf.cookie)) 
開發者ID:krintoxi,項目名稱:NoobSec-Toolkit,代碼行數:12,代碼來源:option.py

示例13: __setHTTPReferer

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def __setHTTPReferer():
    """
    Set the HTTP Referer
    """

    if conf.referer:
        debugMsg = "setting the HTTP Referer header"
        logger.debug(debugMsg)

        conf.httpHeaders.append(("Referer", conf.referer)) 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:12,代碼來源:option.py

示例14: __setHTTPCookies

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def __setHTTPCookies():
    """
    Set the HTTP Cookie header
    """

    if conf.cookie:
        debugMsg = "setting the HTTP Cookie header"
        logger.debug(debugMsg)

        conf.httpHeaders.append(("Connection", "Keep-Alive"))
        conf.httpHeaders.append(("Cookie", conf.cookie)) 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:13,代碼來源:option.py

示例15: __setConfAttributes

# 需要導入模塊: from lib.core.data import conf [as 別名]
# 或者: from lib.core.data.conf import httpHeaders [as 別名]
def __setConfAttributes():
    """
    This function set some needed attributes into the configuration
    singleton.
    """

    debugMsg = "initializing the configuration"
    logger.debug(debugMsg)

    conf.cj              = None
    conf.dbmsHandler     = None
    conf.dumpPath        = None
    conf.httpHeaders     = []
    conf.hostname        = None
    conf.loggedToOut     = None
    conf.multipleTargets = False
    conf.outputPath      = None
    conf.paramDict       = {}
    conf.parameters      = {}
    conf.paramNegative   = False
    conf.path            = None
    conf.port            = None
    conf.retries         = 0
    conf.scheme          = None
    conf.sessionFP       = None
    conf.start           = True
    conf.threadException = False 
開發者ID:tuwid,項目名稱:darkc0de-old-stuff,代碼行數:29,代碼來源:option.py


注:本文中的lib.core.data.conf.httpHeaders方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。