def test_any():
    event = hits(1)
    rule = AnyRule({})
    rule.add_data([event])
    assert rule.matches == [event]
Beispiel #2
0
        'follow': True,
        'type': 'external',
        'description': '{rule[name]}\n{match[domain]} Test desc',
        'customFields': {
            'test_date': {'type': 'date', 'value': '{match[a_date]}'},
            'test_string': {'type': 'string', 'value': '{match[some_other_domain]}'},
            'test_boolean': {'type': 'boolean', 'value': '{match[a_boolean]}'},
            'test_number': {'type': 'number', 'value': '{match[a_number]}'}
        }
    }
}

rule_classic = {
    'index': 'test_index',
    'name': 'test_rule_name',
    'type': AnyRule({}),
    'hive_observable_data_mapping': [
        {'filename': '{match[domain]}_{match[ip_address]}.txt'},
        {'domain': '{match[domain]}'},
        {'domain': '{match[some_other_domain]}'},
        {'ip': '{match[ip_address]}'},
        {'domain': '{match[nested1][nested2]}'}
    ],
    'hive_connection': {
        'hive_password': '******',
        'hive_username': '******',
        'hive_port': 9000,
        'hive_host': 'http://test_host',
        'hive_proxies': {'http': '', 'https': ''}
    },
    'hive_alert_config_type': 'classic',
def test_any():
    event = hits(1)
    rule = AnyRule({})
    rule.add_data([event])
    assert rule.matches == [event]
            },
            'test_number': {
                'type': 'number',
                'value': '{match[a_number]}'
            }
        }
    }
}

rule_classic = {
    'index':
    'test_index',
    'name':
    'test_rule_name',
    'type':
    AnyRule({}),
    'hive_observable_data_mapping': [{
        'filename':
        '{match[domain]}_{match[ip_address]}.txt'
    }, {
        'domain': '{match[domain]}'
    }, {
        'domain': '{match[some_other_domain]}'
    }, {
        'ip': '{match[ip_address]}'
    }, {
        'domain': '{match[nested1][nested2]}'
    }],
    'hive_connection': {
        'hive_password': '******',
        'hive_username': '******',