wallarm rasp python模块
wallarmrasp的Python项目详细描述
Wallarm Rasp客户端
简介
wallarm实时应用安全中间件(python模块)。作为wsgi应用程序实现
适用于Python2.7、3.4、3.5、3.6、3.7
如何安装
pip install wallarmrasp
如何使用
WallarmRASPMiddleware
支持以下参数:
WallarmRASPMiddleware(self,application,mode='monitoring',**kwargs):"""Create and initialize Wallarm RASP WSGI middleware. Options host, portor sock are required.Args: application: WSGI application mode (str, optional): Wallarm mode. (default: 'monitoring')Keyword Args: host (str): Wallarm RASP server hostname port (int): Wallarm RASP server port sock (str): Wallarm RASP server socket filename block_if_disconnected (bool, optional): Set to True if want to block page if connection to Wallarm RASP server is lost (default: False) sock_timeout_msec (int, optional): socket connection timeout with Wallarm RASP server (default: 10 seconds) request_max_body_size (int, optional): request max body size size that can be sent to Wallarm RASP server (default: 100MB) response_max_body_size (int, optional): response max body size size that can be sent to Wallarm RASP server (default: 100MB) block_headers (list of (header_name, header_value) tuples, optional): custom headers for block page block_body (list of str, optional): custom body for block pageReturns: WSGI application with Wallarm RASP middleware."""
通过TCP连接到Wallarm Rasp服务器
fromwallarmrasp.wallarmraspimportWallarmRASPMiddleware# initialize default WSGI applicationwsgi_application=WallarmRASPMiddleware(wsgi_application,'block',host='WALLARM_RASP_SERVER_HOST',port='8989')## start WSGI application
通过uds
连接到wallarm rasp服务器fromwallarmrasp.wallarmraspimportWallarmRASPMiddleware# initialize default WSGI applicationwsgi_application=WallarmRASPMiddleware(wsgi_application,'block',sock='PATH_TO_WALLARM_RASP_SOCKET')## start WSGI application