How to use the timesketch.lib.forms.BaseForm function in timesketch

To help you get started, we’ve selected a few timesketch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / timesketch / timesketch / lib / forms.py View on Github external
class StatusForm(BaseForm):
    """Form to handle status annotation."""
    status = SelectField(
        'Status',
        choices=[('new', 'New'), ('open', 'Open'), ('closed', 'Closed')],
        validators=[DataRequired()])


class TrashForm(BaseForm):
    """Form to handle thrash confirmation."""
    confirm = BooleanField('Trash', validators=[DataRequired()])


class TrashViewForm(BaseForm):
    """Form to handle thrash view confirmation."""
    view_id = IntegerField('View ID', validators=[DataRequired()])


class EventCreateForm(BaseForm):
    """Generic form to handle event addition. E.g. message and timestamp."""
    timestamp = StringField('timestamp', validators=[DataRequired()])
    timestamp_desc = StringField('timestamp_desc', validators=[DataRequired()])
    message = StringField('message', validators=[DataRequired()])


class EventAnnotationForm(BaseForm):
    """Generic form to handle event annotation. E.g. comment and labels."""
    annotation = StringField('Annotation', validators=[DataRequired()])
    annotation_type = StringField('Type', validators=[DataRequired()])
    events = StringField('Events', validators=[DataRequired()])
github google / timesketch / timesketch / lib / forms.py View on Github external
class AggregationExploreForm(BaseForm):
    """Form used to send aggregation requests to the datastore."""
    aggregation_dsl = StringField('Aggregation DSL', validators=[Optional()])
    aggregator_name = StringField('Aggregator Name', validators=[Optional()])
    aggregator_parameters = StringField(
        'Aggregator Parameters', validators=[Optional()])


class AggregationLegacyForm(ExploreForm):
    """Form used to search the datastore."""
    aggtype = StringField('Aggregation type')


class StatusForm(BaseForm):
    """Form to handle status annotation."""
    status = SelectField(
        'Status',
        choices=[('new', 'New'), ('open', 'Open'), ('closed', 'Closed')],
        validators=[DataRequired()])


class TrashForm(BaseForm):
    """Form to handle thrash confirmation."""
    confirm = BooleanField('Trash', validators=[DataRequired()])


class TrashViewForm(BaseForm):
    """Form to handle thrash view confirmation."""
    view_id = IntegerField('View ID', validators=[DataRequired()])
github google / timesketch / timesketch / lib / forms.py View on Github external
default=False)
    from_searchtemplate_id = IntegerField('Create from search template')


class ExploreForm(BaseForm):
    """Form used to search the datastore."""
    query = StringField('Query')
    filter = StringField('Filter')
    dsl = StringField('DSL')
    fields = StringField('Fields', default='')
    enable_scroll = BooleanField(
        'Enable scroll', false_values={False, 'false', ''}, default=False)
    scroll_id = StringField('Scroll ID', default='')


class GraphExploreForm(BaseForm):
    """Form used to search the graph datastore."""
    graph_view_id = IntegerField('Query ID')
    parameters = StringField('Parameters')
    output_format = StringField('Output format')


class RunAnalyzerForm(BaseForm):
    """Form used to run an analyzer on a timeline."""
    timeline_id = StringField('Timeline Index ID', validators=[Optional()])
    analyzer_name = StringField('Analyzer name')
    analyzer_kwargs = StringField(
        'Parameters for the analyzer', validators=[Optional()])


class SaveAggregationForm(BaseForm):
    """Form used to save an aggregation."""
github google / timesketch / timesketch / lib / forms.py View on Github external
"""Multiple checkbox form widget."""
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.CheckboxInput()


class AddTimelineForm(BaseForm):
    """Form using multiple checkbox fields to add timelines to a sketch."""
    timelines = MultiCheckboxField('Timelines', coerce=int)


class AddTimelineSimpleForm(BaseForm):
    """Form to add timelines to a sketch."""
    timeline = IntegerField('Timeline', validators=[DataRequired()])


class UsernamePasswordForm(BaseForm):
    """Form with username and password fields. Use in the login form."""
    username = StringField('Email', validators=[DataRequired()])
    password = PasswordField('Password', validators=[DataRequired()])


class NameDescriptionForm(BaseForm):
    """Generic form for name and description forms. Used in multiple places."""
    name = StringField('Name', validators=[DataRequired()])
    description = StringField('Description', widget=widgets.TextArea())


class HiddenNameDescriptionForm(BaseForm):
    """
    Form for name and description fields, but as hidden values. Used when
    creating a new sketch.
    """
github google / timesketch / timesketch / lib / forms.py View on Github external
class SaveViewForm(BaseForm):
    """Form used to save a view."""
    name = StringField('Name')
    query = StringField('Query')
    filter = StringField('Filter')
    dsl = StringField('DSL')
    new_searchtemplate = BooleanField(
        'Create search template',
        false_values={False, 'false', ''},
        default=False)
    from_searchtemplate_id = IntegerField('Create from search template')


class ExploreForm(BaseForm):
    """Form used to search the datastore."""
    query = StringField('Query')
    filter = StringField('Filter')
    dsl = StringField('DSL')
    fields = StringField('Fields', default='')
    enable_scroll = BooleanField(
        'Enable scroll', false_values={False, 'false', ''}, default=False)
    scroll_id = StringField('Scroll ID', default='')


class GraphExploreForm(BaseForm):
    """Form used to search the graph datastore."""
    graph_view_id = IntegerField('Query ID')
    parameters = StringField('Parameters')
    output_format = StringField('Output format')
github google / timesketch / timesketch / lib / forms.py View on Github external
class EventCreateForm(BaseForm):
    """Generic form to handle event addition. E.g. message and timestamp."""
    timestamp = StringField('timestamp', validators=[DataRequired()])
    timestamp_desc = StringField('timestamp_desc', validators=[DataRequired()])
    message = StringField('message', validators=[DataRequired()])


class EventAnnotationForm(BaseForm):
    """Generic form to handle event annotation. E.g. comment and labels."""
    annotation = StringField('Annotation', validators=[DataRequired()])
    annotation_type = StringField('Type', validators=[DataRequired()])
    events = StringField('Events', validators=[DataRequired()])


class UploadFileForm(BaseForm):
    """Form to handle file uploads."""
    file = FileField(
        'file',
        validators=[
            FileRequired(),
            FileAllowed(['plaso', 'csv', 'jsonl'],
                        'Allowed file extensions: .plaso, .csv, or .jsonl')
        ])
    name = StringField('Timeline name', validators=[Optional()])
    sketch_id = IntegerField('Sketch ID', validators=[Optional()])


class StoryForm(BaseForm):
    """Form to handle stories."""
    title = StringField('Title', validators=[])
    content = StringField('Content', validators=[], widget=widgets.TextArea())
github google / timesketch / timesketch / lib / forms.py View on Github external
"""Generic form for name and description forms. Used in multiple places."""
    name = StringField('Name', validators=[DataRequired()])
    description = StringField('Description', widget=widgets.TextArea())


class HiddenNameDescriptionForm(BaseForm):
    """
    Form for name and description fields, but as hidden values. Used when
    creating a new sketch.
    """
    name = HiddenField(
        'Name', default='Untitled sketch', validators=[DataRequired()])
    description = HiddenField('Description')


class CreateTimelineForm(BaseForm):
    """Form to handle ad-hoc timeline creation."""
    name = StringField('Timeline name', validators=[Optional()])
    sketch_id = IntegerField('Sketch ID', validators=[Optional()])


class TimelineForm(NameDescriptionForm):
    """Form to edit a timeline."""
    color = StringField(
        'Color',
        validators=[DataRequired(),
                    Regexp('^[0-9a-fA-F]{6}$'),
                    Length(6, 6)])


class TogglePublic(BaseForm):
    """Form to toggle the public ACL permission."""
github google / timesketch / timesketch / lib / forms.py View on Github external
class GraphExploreForm(BaseForm):
    """Form used to search the graph datastore."""
    graph_view_id = IntegerField('Query ID')
    parameters = StringField('Parameters')
    output_format = StringField('Output format')


class RunAnalyzerForm(BaseForm):
    """Form used to run an analyzer on a timeline."""
    timeline_id = StringField('Timeline Index ID', validators=[Optional()])
    analyzer_name = StringField('Analyzer name')
    analyzer_kwargs = StringField(
        'Parameters for the analyzer', validators=[Optional()])


class SaveAggregationForm(BaseForm):
    """Form used to save an aggregation."""
    name = StringField('Name')
    description = StringField('Description')
    agg_type = StringField('Aggregation Type')
    parameters = StringField('Aggregation parameters')
    chart_type = StringField('Chart plugin type')
    view_id = IntegerField('Attach to View')


class AggregationExploreForm(BaseForm):
    """Form used to send aggregation requests to the datastore."""
    aggregation_dsl = StringField('Aggregation DSL', validators=[Optional()])
    aggregator_name = StringField('Aggregator Name', validators=[Optional()])
    aggregator_parameters = StringField(
        'Aggregator Parameters', validators=[Optional()])
github google / timesketch / timesketch / lib / forms.py View on Github external
form_dict['csrf_token'] = request.headers.get('X-CSRFToken')
        return cls(form_dict)


class MultiCheckboxField(SelectMultipleField):
    """Multiple checkbox form widget."""
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.CheckboxInput()


class AddTimelineForm(BaseForm):
    """Form using multiple checkbox fields to add timelines to a sketch."""
    timelines = MultiCheckboxField('Timelines', coerce=int)


class AddTimelineSimpleForm(BaseForm):
    """Form to add timelines to a sketch."""
    timeline = IntegerField('Timeline', validators=[DataRequired()])


class UsernamePasswordForm(BaseForm):
    """Form with username and password fields. Use in the login form."""
    username = StringField('Email', validators=[DataRequired()])
    password = PasswordField('Password', validators=[DataRequired()])


class NameDescriptionForm(BaseForm):
    """Generic form for name and description forms. Used in multiple places."""
    name = StringField('Name', validators=[DataRequired()])
    description = StringField('Description', widget=widgets.TextArea())
github google / timesketch / timesketch / lib / forms.py View on Github external
Returns:
            A filled out WTForm form. Instance of timesketch.lib.forms.
        """
        form_dict = MultiDict(request.json)
        form_dict['csrf_token'] = request.headers.get('X-CSRFToken')
        return cls(form_dict)


class MultiCheckboxField(SelectMultipleField):
    """Multiple checkbox form widget."""
    widget = widgets.ListWidget(prefix_label=False)
    option_widget = widgets.CheckboxInput()


class AddTimelineForm(BaseForm):
    """Form using multiple checkbox fields to add timelines to a sketch."""
    timelines = MultiCheckboxField('Timelines', coerce=int)


class AddTimelineSimpleForm(BaseForm):
    """Form to add timelines to a sketch."""
    timeline = IntegerField('Timeline', validators=[DataRequired()])


class UsernamePasswordForm(BaseForm):
    """Form with username and password fields. Use in the login form."""
    username = StringField('Email', validators=[DataRequired()])
    password = PasswordField('Password', validators=[DataRequired()])


class NameDescriptionForm(BaseForm):