(
            self, analyzer_name, analyzer_kwargs=None, timeline_id=None,
            timeline_name=None)
return timeline_obj.run_analyzer(
            analyzer_name=analyzer_name, analyzer_kwargs=analyzer_kwargs)
Run an analyzer on a timeline.

        Args:
            analyzer_name: the name of the analyzer class to run against the
                timeline.
            analyzer_kwargs: optional dict with parameters for the analyzer.
                This is optional and just for those analyzers that can accept
                further parameters.
            timeline_id: the ID of the timeline. This is optional and only
                required if timeline_name is not set.
            timeline_name: the name of the timeline in the timesketch UI. This
                is optional and only required if timeline_id is not set. If
                there are more than a single timeline with the same name a
                timeline_id is required.

        Raises:
            error.UnableToRunAnalyzer: if not able to run the analyzer.

        Returns:
            If the analyzer runs successfully return back an AnalyzerResult
            object.
Run an analyzer on a timeline.
Run an analyzer on a timeline .
def run_analyzer(
            self, analyzer_name, analyzer_kwargs=None, timeline_id=None,
            timeline_name=None):
        """Run an analyzer on a timeline.

        Args:
            analyzer_name: the name of the analyzer class to run against the
                timeline.
            analyzer_kwargs: optional dict with parameters for the analyzer.
                This is optional and just for those analyzers that can accept
                further parameters.
            timeline_id: the ID of the timeline. This is optional and only
                required if timeline_name is not set.
            timeline_name: the name of the timeline in the timesketch UI. This
                is optional and only required if timeline_id is not set. If
                there are more than a single timeline with the same name a
                timeline_id is required.

        Raises:
            error.UnableToRunAnalyzer: if not able to run the analyzer.

        Returns:
            If the analyzer runs successfully return back an AnalyzerResult
            object.
        """
        # TODO: Deprecate this function.
        logger.warning(
            'This function is about to be deprecated, please use the '
            '`.run_analyzer()` function of a timeline object instead. '
            'This function does not support all functionality of the newer '
            'implementation in the timeline object.')

        if self.is_archived():
            raise error.UnableToRunAnalyzer(
                'Unable to run an analyzer on an archived sketch.')

        if not timeline_id and not timeline_name:
            return (
                'Unable to run analyzer, need to define either '
                'timeline ID or name')

        if timeline_name:
            sketch = self.lazyload_data(refresh_cache=True)
            timelines = []
            for timeline_dict in sketch['objects'][0]['timelines']:
                name = timeline_dict.get('name', '')
                if timeline_name.lower() == name.lower():
                    timelines.append(timeline_dict.get('id'))

            if not timelines:
                raise error.UnableToRunAnalyzer(
                    'No timelines with the name: {0:s} were found'.format(
                        timeline_name))

            if len(timelines) != 1:
                raise error.UnableToRunAnalyzer(
                    'There are {0:d} timelines defined in the sketch with '
                    'this name, please use a unique name or a '
                    'timeline ID'.format(len(timelines)))

            timeline_id = timelines[0]

        if not timeline_id:
            raise error.UnableToRunAnalyzer(
                'Unable to run an analyzer, not able to find a timeline.')

        timeline_obj = timeline.Timeline(
            timeline_id=timeline_id,
            sketch_id=self.id,
            api=self.api)

        return timeline_obj.run_analyzer(
            analyzer_name=analyzer_name, analyzer_kwargs=analyzer_kwargs)
def run_analyzer ( self , analyzer_name , analyzer_kwargs = None , timeline_id = None , timeline_name = None ) : # TODO: Deprecate this function. logger . warning ( 'This function is about to be deprecated, please use the ' '`.run_analyzer()` function of a timeline object instead. ' 'This function does not support all functionality of the newer ' 'implementation in the timeline object.' ) if self . is_archived ( ) : raise error . UnableToRunAnalyzer ( 'Unable to run an analyzer on an archived sketch.' ) if not timeline_id and not timeline_name : return ( 'Unable to run analyzer, need to define either ' 'timeline ID or name' ) if timeline_name : sketch = self . lazyload_data ( refresh_cache = True ) timelines = [ ] for timeline_dict in sketch [ 'objects' ] [ 0 ] [ 'timelines' ] : name = timeline_dict . get ( 'name' , '' ) if timeline_name . lower ( ) == name . lower ( ) : timelines . append ( timeline_dict . get ( 'id' ) ) if not timelines : raise error . UnableToRunAnalyzer ( 'No timelines with the name: {0:s} were found' . format ( timeline_name ) ) if len ( timelines ) != 1 : raise error . UnableToRunAnalyzer ( 'There are {0:d} timelines defined in the sketch with ' 'this name, please use a unique name or a ' 'timeline ID' . format ( len ( timelines ) ) ) timeline_id = timelines [ 0 ] if not timeline_id : raise error . UnableToRunAnalyzer ( 'Unable to run an analyzer, not able to find a timeline.' ) timeline_obj = timeline . Timeline ( timeline_id = timeline_id , sketch_id = self . id , api = self . api ) return timeline_obj . run_analyzer ( analyzer_name = analyzer_name , analyzer_kwargs = analyzer_kwargs )