How to use the pyzabbix.logger.HideSensitiveService.hide_sensitive function in pyzabbix

To help you get started, we’ve selected a few pyzabbix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github adubkov / py-zabbix / tests / test_hide_sensitive_filter.py View on Github external
def test_hide_filter_do_not_change_url(self):

        # Filter should not hide 'zabbix' in URL:
        # https://localhost/zabbix/api_jsonrpc.php
        test = 'urllib2.Request(https://localhost/zabbix/api_jsonrpc.php,' \
            '{ ... "params": {"user": "Admin", "password": "zabbix"}, '\
            '"id": "1"}))'
        expected = 'urllib2.Request(https://localhost/zabbix/api_jsonrpc.php,'\
            '{ ... "params": {"user": "Admin", "password": "' + \
            HideSensitiveService.HIDEMASK + '"}, "id": "1"}))'

        self.assertEqual(HideSensitiveService.hide_sensitive(test),
                         expected)
github adubkov / py-zabbix / tests / test_hide_sensitive_filter.py View on Github external
def test_hide_filter_multi(self):

        test_message = '"password": "hide_this", ' \
                       '"result": "0424bd59b807674191e7d77572075f33", ' \
                       '"result": "do_not_hide_this", ' \
                       '"auth": "0424bd59b807674191e7d77572075f33"'
        expected = ('"password": "{}", '
                    '"result": "{}", '
                    '"result": "do_not_hide_this", '
                    '"auth": "{}"').format(
                        HideSensitiveService.HIDEMASK,
                        HideSensitiveService.HIDEMASK,
                        HideSensitiveService.HIDEMASK)

        self.assertEqual(HideSensitiveService.hide_sensitive(test_message),
                         expected)
github adubkov / py-zabbix / pyzabbix / logger.py View on Github external
def __init__(self, *args, **kwargs):
        super(logging.Filter, self).__init__(*args, **kwargs)
        self.hide_sensitive = HideSensitiveService.hide_sensitive