当前位置: 首页>>代码示例>>Python>>正文


Python ESAPI.intrusion_detector方法代码示例

本文整理汇总了Python中esapi.core.ESAPI.intrusion_detector方法的典型用法代码示例。如果您正苦于以下问题:Python ESAPI.intrusion_detector方法的具体用法?Python ESAPI.intrusion_detector怎么用?Python ESAPI.intrusion_detector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在esapi.core.ESAPI的用法示例。


在下文中一共展示了ESAPI.intrusion_detector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_event

# 需要导入模块: from esapi.core import ESAPI [as 别名]
# 或者: from esapi.core.ESAPI import intrusion_detector [as 别名]
 def test_add_event(self):
     username = "testAddEventIDS"
     password = "addEvent"
     auth = ESAPI.authenticator()
     user = auth.create_user(username, password, password)
     user.enable()
     
     request = MockHttpRequest()
     response = MockHttpResponse()
     ESAPI.http_utilities().set_current_http(request, response)
     user.login_with_password(password)
     
     # Generate some events to disable the account
     for i in range(15):
         ESAPI.intrusion_detector().add_event("test", "test message")
         
     self.assertTrue(user.is_locked())
开发者ID:kenshinx,项目名称:django-esapi,代码行数:19,代码来源:test_intrusion_detector.py

示例2: __init__

# 需要导入模块: from esapi.core import ESAPI [as 别名]
# 或者: from esapi.core.ESAPI import intrusion_detector [as 别名]
 def __init__(self, user_message, log_message, cause=None):
     """
     Creates a new instance of IntrusionException.
     
     @param user_message: the message displayed to the user
     @param log_message: the message logged
     @param cause: the Exception that caused this one
     """
     Exception.__init__(self, user_message)
     
     self.user_message = user_message
     self.log_message = log_message
     self.cause = cause
     
     self.logger = ESAPI.logger("IntrusionException")
     self.logger.error(Logger.SECURITY_FAILURE, _("INTRUSION") + " - " + self.log_message)
     
     ESAPI.intrusion_detector().add_exception(self)
开发者ID:kenshinx,项目名称:django-esapi,代码行数:20,代码来源:exceptions.py

示例3: test_add_exception

# 需要导入模块: from esapi.core import ESAPI [as 别名]
# 或者: from esapi.core.ESAPI import intrusion_detector [as 别名]
 def test_add_exception(self):
     ESAPI.intrusion_detector().add_exception( RuntimeError('message') )
     ESAPI.intrusion_detector().add_exception( 
         ValidationException("user message", "log message") )
     ESAPI.intrusion_detector().add_exception( 
         IntrusionException("user message", "log message") )
         
     username = "testAddException"
     password = "addException"
     auth = ESAPI.authenticator()
     user = auth.create_user(username, password, password)
     user.enable()
     
     request = MockHttpRequest()
     response = MockHttpResponse()
     ESAPI.http_utilities().set_current_http(request, response)
     user.login_with_password(password)
     
     # Generate some exceptions to disable the account
     for i in range(15):
         IntegrityException(
             "IntegrityException %s" % i,
             "IntegrityException %s" % i )
         
     self.assertFalse(user.is_logged_in())
     self.assertTrue(user.is_locked())
开发者ID:kenshinx,项目名称:django-esapi,代码行数:28,代码来源:test_intrusion_detector.py


注:本文中的esapi.core.ESAPI.intrusion_detector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。