hawat.blueprints.events.forms module

This module contains custom internal event search form for Hawat.

class hawat.blueprints.events.forms.EventDashboardForm(formdata=<object object>, **kwargs)[source]

Bases: flask_wtf.form.FlaskForm

Class representing event dashboard search form.

dt_from = <UnboundField(DateTimeLocalField, (l'From:',), {'default': <function EventDashboardForm.<lambda>>, 'format': '%Y-%m-%d %H:%M:%S', 'validators': [<wtforms.validators.Optional object>]})>
dt_to = <UnboundField(DateTimeLocalField, (l'To:',), {'format': '%Y-%m-%d %H:%M:%S', 'validators': [<wtforms.validators.Optional object>]})>
submit = <UnboundField(SubmitField, (l'Search',), {})>
class hawat.blueprints.events.forms.SimpleEventSearchForm(*args, **kwargs)[source]

Bases: hawat.forms.BaseSearchForm

Class representing simple event search form.

categories = <UnboundField(SelectMultipleField, (l'Categories:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [('__EMPTY__', l'<< without value >>'), ('__ANY__', l'<< any value >>')], 'validators': [<wtforms.validators.Optional object>]})>
classes = <UnboundField(SelectMultipleField, (l'Classes:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [('__EMPTY__', l'<< without value >>'), ('__ANY__', l'<< any value >>')], 'validators': [<wtforms.validators.Optional object>]})>
description = <UnboundField(StringField, (l'Description:',), {'validators': [<wtforms.validators.Optional object>]})>
detector_types = <UnboundField(SelectMultipleField, (l'Detector types:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [('__EMPTY__', l'<< without value >>'), ('__ANY__', l'<< any value >>')], 'validators': [<wtforms.validators.Optional object>]})>
detectors = <UnboundField(SelectMultipleField, (l'Detectors:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [('__EMPTY__', l'<< without value >>'), ('__ANY__', l'<< any value >>')], 'validators': [<wtforms.validators.Optional object>]})>
dt_from = <UnboundField(DateTimeLocalField, (l'Detection time from:',), {'format': '%Y-%m-%d %H:%M:%S', 'validators': [<wtforms.validators.Optional object>]})>
dt_to = <UnboundField(DateTimeLocalField, (l'Detection time to:',), {'format': '%Y-%m-%d %H:%M:%S', 'validators': [<wtforms.validators.Optional object>]})>
groups = <UnboundField(QuerySelectMultipleField, (l'Abuse group:',), {'query_factory': <function get_available_groups>, 'get_pk': <function SimpleEventSearchForm.<lambda>>, 'allow_blank': False})>
host_addrs = <UnboundField(CommaListField, (l'Host addresses:',), {'widget': <wtforms.widgets.core.TextArea object>, 'validators': [<wtforms.validators.Optional object>, <function check_network_record_list>]})>
host_ports = <UnboundField(CommaListField, (l'Host ports:',), {'validators': [<wtforms.validators.Optional object>, <function check_port_list>]})>
host_types = <UnboundField(SelectMultipleField, (l'Host types:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [], 'validators': [<wtforms.validators.Optional object>]})>
inspection_errs = <UnboundField(SelectMultipleField, (l'Inspection errors:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [('__EMPTY__', l'<< without value >>'), ('__ANY__', l'<< any value >>')], 'validators': [<wtforms.validators.Optional object>]})>
static is_multivalue(field_name)[source]

Check, if given form field is a multivalue field.

Parameters

field_name (str) – Name of the form field.

Returns

True, if the field can contain multiple values, False otherwise.

Return type

bool

not_categories = <UnboundField(BooleanField, (l'Negate category selection:',), {'validators': [<wtforms.validators.Optional object>]})>
not_classess = <UnboundField(BooleanField, (l'Negate class selection:',), {'validators': [<wtforms.validators.Optional object>]})>
not_detector_types = <UnboundField(BooleanField, (l'Negate detector_type selection:',), {'validators': [<wtforms.validators.Optional object>]})>
not_detectors = <UnboundField(BooleanField, (l'Negate detector selection:',), {'validators': [<wtforms.validators.Optional object>]})>
not_groups = <UnboundField(BooleanField, (l'Negate group selection:',), {'validators': [<wtforms.validators.Optional object>]})>
not_inspection_errs = <UnboundField(BooleanField, (l'Negate inspection error selection:',), {'validators': [<wtforms.validators.Optional object>]})>
not_protocols = <UnboundField(BooleanField, (l'Negate protocol selection:',), {'validators': [<wtforms.validators.Optional object>]})>
not_severities = <UnboundField(BooleanField, (l'Negate severity selection:',), {'validators': [<wtforms.validators.Optional object>]})>
protocols = <UnboundField(SelectMultipleField, (l'Protocols:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [('__EMPTY__', l'<< without value >>'), ('__ANY__', l'<< any value >>')], 'validators': [<wtforms.validators.Optional object>]})>
severities = <UnboundField(SelectMultipleField, (l'Severities:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [('__EMPTY__', l'<< without value >>'), ('__ANY__', l'<< any value >>')], 'validators': [<wtforms.validators.Optional object>]})>
sortby = <UnboundField(SelectField, (l'Sort by:',), {'choices': [('time.desc', l'by time descending'), ('time.asc', l'by time ascending'), ('detecttime.desc', l'by detection time descending'), ('detecttime.asc', l'by detection time ascending'), ('storagetime.desc', l'by storage time descending'), ('storagetime.asc', l'by storage time ascending')], 'default': 'time.desc', 'validators': [<wtforms.validators.Optional object>]})>
source_addrs = <UnboundField(CommaListField, (l'Source addresses:',), {'widget': <wtforms.widgets.core.TextArea object>, 'validators': [<wtforms.validators.Optional object>, <function check_network_record_list>]})>
source_ports = <UnboundField(CommaListField, (l'Source ports:',), {'validators': [<wtforms.validators.Optional object>, <function check_port_list>]})>
source_types = <UnboundField(SelectMultipleField, (l'Source types:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [], 'validators': [<wtforms.validators.Optional object>]})>
st_from = <UnboundField(DateTimeLocalField, (l'Storage time from:',), {'format': '%Y-%m-%d %H:%M:%S', 'validators': [<wtforms.validators.Optional object>]})>
st_to = <UnboundField(DateTimeLocalField, (l'Storage time to:',), {'format': '%Y-%m-%d %H:%M:%S', 'validators': [<wtforms.validators.Optional object>]})>
target_addrs = <UnboundField(CommaListField, (l'Target addresses:',), {'widget': <wtforms.widgets.core.TextArea object>, 'validators': [<wtforms.validators.Optional object>, <function check_network_record_list>]})>
target_ports = <UnboundField(CommaListField, (l'Target ports:',), {'validators': [<wtforms.validators.Optional object>, <function check_port_list>]})>
target_types = <UnboundField(SelectMultipleField, (l'Target types:',), {'filters': [<function SimpleEventSearchForm.<lambda>>], 'choices': [], 'validators': [<wtforms.validators.Optional object>]})>
hawat.blueprints.events.forms.get_available_groups()[source]

Query the database for list of all available groups.