def process(self):
    """Executes a Timesketch export."""
    # This is not the best way of catching errors, but timesketch_utils will be
    # deprecated soon.
    # TODO(tomchop): Consider using the official Timesketch python API.
    if not self.timesketch_api.session:
      message = 'Could not connect to Timesketch server'
      self.state.add_error(message, critical=True)

    named_timelines = []
    for description, path in self.state.input:
      if not description:
        description = 'untitled timeline for '+path
      named_timelines.append((description, path))
    try:
      self.timesketch_api.export_artifacts(named_timelines, self.sketch_id)
    except RuntimeError as e:
      self.state.add_error(
          'Error occurred while working with Timesketch: {0:s}'.format(str(e)),
          critical=True)
      return
    sketch_url = self.timesketch_api.get_sketch_url(self.sketch_id)
    print('Your Timesketch URL is: {0:s}'.format(sketch_url))
    self.state.output = sketch_url
def process ( self ) : if not self . timesketch_api . session : message = 'Could not connect to Timesketch server' self . state . add_error ( message , critical = True ) named_timelines = [ ] for description , path in self . state . input : if not description : description = 'untitled timeline for ' + path named_timelines . append ( ( description , path ) ) try : self . timesketch_api . export_artifacts ( named_timelines , self . sketch_id ) except RuntimeError as e : self . state . add_error ( 'Error occurred while working with Timesketch: {0:s}' . format ( str ( e ) ) , critical = True ) return sketch_url = self . timesketch_api . get_sketch_url ( self . sketch_id ) print ( 'Your Timesketch URL is: {0:s}' . format ( sketch_url ) ) self . state . output = sketch_url
Executes a Timesketch export.