lookyloo/lookyloo.py
def categorize_capture(self, capture_uuid: str, /, category: str) -> None:
        '''Add a category (MISP Taxonomy tag) to a capture.'''
        if not get_config('generic', 'enable_categorization'):
            return
        # Make sure the category is mappable to a taxonomy.
        self.taxonomies.revert_machinetag(category)

        capture_dir = self._get_capture_dir(capture_uuid)
        # get existing categories if possible
        if (capture_dir / 'categories').exists():
            with (capture_dir / 'categories').open() as f:
                current_categories = set(line.strip() for line in f.readlines())
        else:
            current_categories = set()
        current_categories.add(category)
        with (capture_dir / 'categories').open('w') as f:
            f.writelines(f'{t}\n' for t in current_categories)
Add a category (MISP Taxonomy tag) to a capture.
Add a category (MISP Taxonomy tag) to a capture.
Add a category ( MISP Taxonomy tag ) to a capture .
def categorize_capture(self, capture_uuid: str, /, category: str) -> None:
        if not get_config('generic', 'enable_categorization'):
            return
        self.taxonomies.revert_machinetag(category)
        capture_dir = self._get_capture_dir(capture_uuid)
        if (capture_dir / 'categories').exists():
            with (capture_dir / 'categories').open() as f:
                current_categories = set(line.strip() for line in f.readlines())
        else:
            current_categories = set()
        current_categories.add(category)
        with (capture_dir / 'categories').open('w') as f:
            f.writelines(f'{t}\n' for t in current_categories)
def categorize_capture ( self , capture_uuid : str , / , category : str ) -> None : if not get_config ( 'generic' , 'enable_categorization' ) : return self . taxonomies . revert_machinetag ( category ) capture_dir = self . _get_capture_dir ( capture_uuid ) if ( capture_dir / 'categories' ) . exists ( ) : with ( capture_dir / 'categories' ) . open ( ) as f : current_categories = set ( line . strip ( ) for line in f . readlines ( ) ) else : current_categories = set ( ) current_categories . add ( category ) with ( capture_dir / 'categories' ) . open ( 'w' ) as f : f . writelines ( f'{t}\n' for t in current_categories )
Add a category (MISP Taxonomy tag) to a capture.
Add a category ( MISP Taxonomy tag ) to a capture .
'''Add a category (MISP Taxonomy tag) to a capture.''' # Make sure the category is mappable to a taxonomy. # get existing categories if possible
self
capture_uuid
str
category
str