class TagMultiidForm(FlaskForm): """ajax; tagmulti action""" ids = FieldList(IntegerField('id', [InputRequired()]), min_entries=1) tag = StringNoneField('tag', [InputRequired()]) action = StringNoneField( 'action', [InputRequired(), AnyOf(['set', 'unset'])])
class HostForm(FlaskForm): """host edit form""" address = StringNoneField( 'Address', [InputRequired(), IPAddress(ipv4=True, ipv6=True)]) hostname = StringNoneField('Hostname', [Length(max=256)]) os = StringNoneField('Os') tags = TextAreaListField('Tags', render_kw={'class': 'form-control tageditor'}) comment = TextAreaNoneField('Comment') submit = SubmitField('Save') return_url = HiddenField()
class UserForm(FlaskForm): """user edit form""" username = StringNoneField( 'Username', [InputRequired(), Length(min=1, max=250)]) email = StringNoneField('Email', [Length(max=250)]) active = BooleanField('Active') roles = MultiCheckboxField('Roles') new_password = PasswordField('Password', [Optional(), strong_password]) submit = SubmitField('Save') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.roles.choices = [(x, x) for x in current_app.config['SNER_AUTH_ROLES']]
class ServiceForm(FlaskForm): """service edit form""" host_id = IntegerField('Host_id', [InputRequired(), host_id_exists]) proto = StringNoneField('Proto', [InputRequired(), Length(min=1, max=250)]) port = IntegerField( 'Port', [InputRequired(), NumberRange(min=0, max=65535)]) state = StringNoneField('State', [Length(max=250)]) name = StringNoneField('Name', [Length(max=250)]) info = StringNoneField('Info') tags = TextAreaListField('Tags', render_kw={'class': 'form-control tageditor'}) comment = TextAreaNoneField('Comment') submit = SubmitField('Save') return_url = HiddenField()
class ExclForm(FlaskForm): """exclustion edit form""" family = SelectField('Family', [InputRequired(), valid_excl_family], choices=ExclFamily.choices(), coerce=ExclFamily.coerce) value = StringNoneField('Value', [InputRequired(), Length(min=1), valid_excl_value]) comment = TextAreaNoneField('Comment') submit = SubmitField('Save')
class VulnForm(FlaskForm): """note edit form""" host_id = IntegerField('Host_id', [InputRequired(), host_id_exists]) service_id = IntegerField( 'Service_id', [Optional(), service_id_exists_and_belongs_to_host]) name = StringNoneField('Name', [InputRequired(), Length(min=1, max=1000)]) xtype = StringNoneField('xType', [Length(max=250)]) severity = SelectField('Severity', [InputRequired()], choices=SeverityEnum.choices(), coerce=SeverityEnum.coerce) descr = TextAreaNoneField('Descr', render_kw={'rows': '5'}) data = TextAreaNoneField('Data', render_kw={'rows': '5'}) refs = TextAreaListField('Refs', render_kw={'rows': '5'}) tags = TextAreaListField('Tags', render_kw={'class': 'form-control tageditor'}) comment = TextAreaNoneField('Comment') submit = SubmitField('Save') return_url = HiddenField()
class QueueForm(FlaskForm): """queue edit form""" name = StringNoneField('Name', [InputRequired(), Length(min=1, max=250)]) config = TextAreaNoneField('Config', [valid_agent_config], render_kw={'rows': '10'}) group_size = IntegerField('Group size', [InputRequired(), NumberRange(min=1)], default=1) priority = IntegerField('Priority', [InputRequired()], default=0) active = BooleanField('Active') reqs = TextAreaListField('Requirements', render_kw={'class': 'form-control tageditor'}) submit = SubmitField('Save')
class NoteForm(FlaskForm): """note edit form""" host_id = IntegerField('Host_id', [InputRequired(), host_id_exists]) service_id = IntegerField( 'Service_id', [Optional(), service_id_exists_and_belongs_to_host]) xtype = StringNoneField('xType', [Length(max=250)]) data = TextAreaNoneField('Data', render_kw={'rows': '10'}) tags = TextAreaListField('Tags', render_kw={'class': 'form-control tageditor'}) comment = TextAreaNoneField('Comment') submit = SubmitField('Save') return_url = HiddenField()
class WebauthnEditForm(FlaskForm): """webauthn edit token form""" name = StringNoneField('Name', [Length(max=250)]) submit = SubmitField('Save')
class WebauthnRegisterForm(FlaskForm): """webauthn register token form""" attestation = HiddenField('Attestation', [InputRequired()]) name = StringNoneField('Name', [Length(max=250)]) submit = SubmitField('Register', render_kw={'disabled': True})
class TotpCodeForm(FlaskForm): """totp code form""" code = StringNoneField('TOTP Code', [InputRequired()], render_kw={'autocomplete': 'off'}) submit = SubmitField()
class LoginForm(FlaskForm): """login form""" username = StringNoneField('Username') password = PasswordField('Password') submit = SubmitField('Login')