#NEWLINE# def CreateGenericHuntWithCollection( self , values = None ) : #NEWLINE# #INDENT# self . client_ids = self . SetupClients ( 10 ) #NEWLINE# if ( values is None ) : #NEWLINE# #INDENT# values = [ rdfvalue . RDFURN ( 'aff4:/sample/1' ) , rdfvalue . RDFURN ( 'aff4:/C.0000000000000001/fs/os/c/bin/bash' ) , rdfvalue . RDFURN ( 'aff4:/sample/3' ) ] #NEWLINE# #UNINDENT# with hunts . GRRHunt . StartHunt ( hunt_name = 'GenericHunt' , regex_rules = [ rdf_foreman . ForemanAttributeRegex ( attribute_name = 'GRR client' , attribute_regex = 'GRR' ) ] , output_plugins = [ ] , token = self . token ) as hunt : #NEWLINE# #INDENT# runner = hunt . GetRunner ( ) #NEWLINE# runner . Start ( ) #NEWLINE# with aff4 . FACTORY . Open ( runner . context . results_collection_urn , aff4_type = 'HuntResultCollection' , mode = 'w' , token = self . token ) as collection : #NEWLINE# #INDENT# for value in values : #NEWLINE# #INDENT# collection . Add ( rdf_flows . GrrMessage ( payload = value ) ) #NEWLINE# #UNINDENT# #UNINDENT# return hunt . urn