Esempio n. 1
0
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'])])
Esempio n. 2
0
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()
Esempio n. 3
0
File: forms.py Progetto: bodik/sner4
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']]
Esempio n. 4
0
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()
Esempio n. 5
0
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')
Esempio n. 6
0
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()
Esempio n. 7
0
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')
Esempio n. 8
0
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()
Esempio n. 9
0
File: forms.py Progetto: bodik/sner4
class WebauthnEditForm(FlaskForm):
    """webauthn edit token form"""

    name = StringNoneField('Name', [Length(max=250)])
    submit = SubmitField('Save')
Esempio n. 10
0
File: forms.py Progetto: bodik/sner4
class WebauthnRegisterForm(FlaskForm):
    """webauthn register token form"""

    attestation = HiddenField('Attestation', [InputRequired()])
    name = StringNoneField('Name', [Length(max=250)])
    submit = SubmitField('Register', render_kw={'disabled': True})
Esempio n. 11
0
File: forms.py Progetto: bodik/sner4
class TotpCodeForm(FlaskForm):
    """totp code form"""

    code = StringNoneField('TOTP Code', [InputRequired()],
                           render_kw={'autocomplete': 'off'})
    submit = SubmitField()
Esempio n. 12
0
File: forms.py Progetto: bodik/sner4
class LoginForm(FlaskForm):
    """login form"""

    username = StringNoneField('Username')
    password = PasswordField('Password')
    submit = SubmitField('Login')