from flask_wtf import FlaskForm from wtforms import StringField, FloatField, IntegerField, FieldList, SelectField class SearchForm(FlaskForm): timestamp_base = FloatField('timestamp') timestamp = FieldList(timestamp_base, min_entries=2) num_packets_base = FloatField('num_packets') num_packets = FieldList(num_packets_base, min_entries=2) duration_base = FloatField('duration') duration = FieldList(duration_base, min_entries=2) dst_size_sent_base = FloatField('dst_size_sent') dst_size_sent = FieldList(dst_size_sent_base, min_entries=2) dst_printables_base = FloatField('dst_printables') dst_printables = FieldList(dst_printables_base, min_entries=2) dst_nonprintables_base = FloatField('dst_nonprintables') dst_nonprintables = FieldList(dst_nonprintables_base, min_entries=2) src_size_sent_base = FloatField('src_size_sent') src_size_sent = FieldList(src_size_sent_base, min_entries=2) src_printables_base = FloatField('src_printables') src_printables = FieldList(src_printables_base, min_entries=2) src_nonprintables_base = FloatField('src_nonprintables') src_nonprintables = FieldList(src_nonprintables_base, min_entries=2) src_host = StringField('src_host') dst_host = StringField('dst_host') dst_port = IntegerField('dst_port') protocol = SelectField('protocol', choices=[('', "Don't care"), ('tcp', 'TCP'), ('udp', 'UDP')], default='') src_boot = FloatField('src_boot') dst_boot = FloatField('dst_boot') filename = StringField('filename') search_regex = StringField('search_regex') search_dst = SelectField('search_dst', choices=[('0', "Don't care"), ('1', 'True'), ('2', 'False')], default='0') syn = SelectField('syn', choices=[('0', "Don't care"), ('1', 'True'), ('2', 'False')], default='0') synack = SelectField('synack', choices=[('0', "Don't care"), ('1', 'True'), ('2', 'False')], default='0') fin = SelectField('fin', choices=[('0', "Don't care"), ('1', 'True'), ('2', 'False')], default='0') rst = SelectField('rst', choices=[('0', "Don't care"), ('1', 'True'), ('2', 'False')], default='0') tags = StringField('tags')