本文整理汇总了Python中w3af.core.data.url.HTTPResponse.HTTPResponse.from_httplib_resp方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPResponse.from_httplib_resp方法的具体用法?Python HTTPResponse.from_httplib_resp怎么用?Python HTTPResponse.from_httplib_resp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w3af.core.data.url.HTTPResponse.HTTPResponse
的用法示例。
在下文中一共展示了HTTPResponse.from_httplib_resp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: http_response
# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
def http_response(self, request, response):
if self._plugin_list:
# Create the HTTPResponse object
http_resp = HTTPResponse.from_httplib_resp(response)
for plugin in self._plugin_list:
plugin.mangle_response(http_resp)
response = self._http_resp_2_httplib(response, http_resp)
return response
示例2: _handle_send_success
# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
def _handle_send_success(self, req, res, grep, original_url,
original_url_inst, start_time):
"""
Handle the case in "def _send" where the request was successful and
we were able to get a valid HTTP response.
:return: An HTTPResponse object.
"""
# Everything went well!
rdata = req.get_data()
if not rdata:
msg = ('%s %s returned HTTP code "%s"' %
(req.get_method(),
urllib.unquote_plus(original_url),
res.code))
else:
printable_data = urllib.unquote_plus(rdata)
if len(rdata) > 75:
printable_data = '%s...' % printable_data[:75]
printable_data = printable_data.replace('\n', ' ')
printable_data = printable_data.replace('\r', ' ')
msg = ('%s %s with data: "%s" returned HTTP code "%s"'
% (req.get_method(),
original_url,
printable_data,
res.code))
from_cache = hasattr(res, 'from_cache') and res.from_cache
flags = ' (id=%s,from_cache=%i,grep=%i)' % (res.id, from_cache,
grep)
msg += flags
om.out.debug(msg)
http_resp = HTTPResponse.from_httplib_resp(res,
original_url=original_url_inst)
http_resp.set_id(res.id)
http_resp.set_wait_time(time.time() - start_time)
http_resp.set_from_cache(from_cache)
# Clear the log of failed requests; this request is DONE!
req_id = id(req)
if req_id in self._error_count:
del self._error_count[req_id]
self._zero_global_error_count()
if grep:
self._grep(req, http_resp)
return http_resp
示例3: _log_req_resp
# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
def _log_req_resp(self, request, response):
"""
Send the request and the response to the output manager.
"""
if not isinstance(response, HTTPResponse):
url = request.url_object
resp = HTTPResponse.from_httplib_resp(response,
original_url=url)
resp.set_id(response.id)
else:
resp = response
if not isinstance(request, HTTPRequest):
msg = 'There is something odd going on in OutputManagerHandler,'\
' request should be of type HTTPRequest got %s'\
' instead.'
raise TypeError(msg % type(request))
om.out.log_http(request, resp)
示例4: store_in_cache
# 需要导入模块: from w3af.core.data.url.HTTPResponse import HTTPResponse [as 别名]
# 或者: from w3af.core.data.url.HTTPResponse.HTTPResponse import from_httplib_resp [as 别名]
def store_in_cache(request, response):
# Create the http response object
resp = HTTPResponse.from_httplib_resp(response,
original_url=request.url_object)
resp.set_id(response.id)
resp.set_alias(gen_hash(request))
hi = HistoryItem()
hi.request = request
hi.response = resp
# Now save them
try:
hi.save()
except sqlite3.Error, e:
msg = 'A sqlite3 error was raised: "%s".' % e
if 'disk' in str(e).lower():
msg += ' Please check if your disk is full.'
raise ScanMustStopException(msg)