@@ -150,15 +150,15 @@ def create_internal_reference() -> MISPObject:
150150 return inter
151151
152152 @staticmethod
153- def int_ref_handler (evt , kc_name , kc_detail , ref_list , slg , act_name , int_ref , no_slug : bool = False ):
153+ def int_ref_handler (evt , kc_name , kc_detail , ref_list , slg , act_name , int_ref , verbose : bool = False ):
154154 misp_object = MISPObject ("internal-reference" )
155155 misp_object .add_attribute ("type" , "Adversary detail" , disable_correlation = True )
156156 misp_object .add_attribute ("identifier" , kc_name .title (), disable_correlation = True )
157157 if not isinstance (kc_detail , list ):
158158 kc_detail .replace ("\t " , "" ).replace (" " , "" )
159159 sum_id = misp_object .add_attribute ("comment" , kc_detail , disable_correlation = True )
160160 ref_list .append (evt .add_object (misp_object ))
161- if not no_slug :
161+ if verbose :
162162 evt .add_attribute_tag (f"CrowdStrike:adversary:{ kc_name .lower ().replace (' ' , '-' )} : { act_name } " , sum_id .uuid )
163163 evt .add_attribute_tag (f"CrowdStrike:adversary:{ slg } : { kc_name .upper ()} " , sum_id .uuid )
164164 int_ref .add_reference (misp_object .uuid , "Adversary detail" )
@@ -185,6 +185,7 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
185185 slug = details .get ("slug" , actor_name .lower ().replace (" " , "-" ))
186186 actor_branch = actor_name .split (" " )[1 ].upper ()
187187 actor_region = ""
188+ verbosity = self .import_settings ["verbose_tags" ]
188189 if actor_name :
189190 for act_reg in [adv for adv in dir (Adversary ) if "__" not in adv ]:
190191 if act_reg in actor_branch :
@@ -213,7 +214,7 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
213214 if not internal :
214215 internal = self .create_internal_reference ()
215216
216- self .int_ref_handler (event , "Actor Type" , act_type .title (), to_reference , slug , actor_name , internal , False )
217+ self .int_ref_handler (event , "Actor Type" , act_type .title (), to_reference , slug , actor_name , internal , verbosity )
217218 event .add_tag (f"CrowdStrike:adversary:type: { act_type .upper ()} " )
218219
219220 # Adversary motives
@@ -224,7 +225,7 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
224225 if not internal :
225226 internal = self .create_internal_reference ()
226227
227- self .int_ref_handler (event , "Motivation" , motive_list_string , to_reference , slug , actor_name , internal , False )
228+ self .int_ref_handler (event , "Motivation" , motive_list_string , to_reference , slug , actor_name , internal , verbosity )
228229 for mname in mlist :
229230 event .add_tag (f"CrowdStrike:adversary:motivation: { mname .upper ()} " )
230231
@@ -236,7 +237,7 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
236237 if not internal :
237238 internal = self .create_internal_reference ()
238239
239- self .int_ref_handler (event , "Capability" , cap_val , to_reference , slug , actor_name , internal , False )
240+ self .int_ref_handler (event , "Capability" , cap_val , to_reference , slug , actor_name , internal , verbosity )
240241 event .add_tag (f"CrowdStrike:adversary:capability: { cap_val .upper ()} " )
241242 # Set adversary event threat level based upon adversary capability
242243 if "BELOW" in cap_val .upper () or "LOW" in cap_val .upper ():
@@ -262,13 +263,13 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
262263
263264 # Kill chain - Objectives
264265 if objectives :
265- self .int_ref_handler (event , "objectives" , objectives , to_reference , slug , actor_name , internal )
266+ self .int_ref_handler (event , "objectives" , objectives , to_reference , slug , actor_name , internal , verbosity )
266267 # Kill chain - Command and Control
267268 if candc :
268- self .int_ref_handler (event , "command and control" , candc , to_reference , slug , actor_name , internal )
269+ self .int_ref_handler (event , "command and control" , candc , to_reference , slug , actor_name , internal , verbosity )
269270 # Kill chain - Delivery
270271 if delivery :
271- self .int_ref_handler (event , "delivery" , delivery , to_reference , slug , actor_name , internal )
272+ self .int_ref_handler (event , "delivery" , delivery , to_reference , slug , actor_name , internal , verbosity )
272273 # Kill chain - Exploitation
273274 if exploitation :
274275 exploitation_object = MISPObject ("internal-reference" )
@@ -278,23 +279,24 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
278279 exploits = exploitation .replace ("\t " , "" ).replace (" " , "" ).split ("\r \n " )
279280 ex_id = exploitation_object .add_attribute ("comment" , exploitation .replace ("\t " , "" ).replace (" " , "" ), disable_correlation = True )
280281 to_reference .append (event .add_object (exploitation_object ))
281- event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } : EXPLOITATION" , ex_id .uuid )
282- event .add_attribute_tag (f"CrowdStrike:adversary:exploitation: { actor_name } " , ex_id .uuid )
283- for exptt in [exp for exp in exploits if exp ]:
284- if exptt not in ["Unknown" , "N/A" ]:
285- for exploit in [a .strip () for a in exptt .split ("," )]:
286- if len (exploit .split (" " )) <= 4 :
287- event .add_attribute_tag (f"CrowdStrike:adversary:exploitation: { exploit .upper ()} " , ex_id .uuid )
282+ if verbosity :
283+ event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } : EXPLOITATION" , ex_id .uuid )
284+ event .add_attribute_tag (f"CrowdStrike:adversary:exploitation: { actor_name } " , ex_id .uuid )
285+ for exptt in [exp for exp in exploits if exp ]:
286+ if exptt not in ["Unknown" , "N/A" ]:
287+ for exploit in [a .strip () for a in exptt .split ("," )]:
288+ if len (exploit .split (" " )) <= 4 :
289+ event .add_attribute_tag (f"CrowdStrike:adversary:exploitation: { exploit .upper ()} " , ex_id .uuid )
288290 internal .add_reference (exploitation_object .uuid , "Adversary detail" )
289291 # Kill chain - Installation
290292 if installation :
291- self .int_ref_handler (event , "installation" , installation , to_reference , slug , actor_name , internal )
293+ self .int_ref_handler (event , "installation" , installation , to_reference , slug , actor_name , internal , verbosity )
292294 # Kill chain - Reconnaissance
293295 if reconnaissance :
294- self .int_ref_handler (event , "reconnaissance" , reconnaissance , to_reference , slug , actor_name , internal )
296+ self .int_ref_handler (event , "reconnaissance" , reconnaissance , to_reference , slug , actor_name , internal , verbosity )
295297 # Kill chain - Weaponization
296298 if weaponization :
297- self .int_ref_handler (event , "weaponization" , weaponization , to_reference , slug , actor_name , internal )
299+ self .int_ref_handler (event , "weaponization" , weaponization , to_reference , slug , actor_name , internal , verbosity )
298300
299301 for ref in to_reference :
300302 internal .add_reference (ref .uuid , "Adversary detail" )
@@ -305,7 +307,7 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
305307 if internal :
306308 event .add_object (internal )
307309 # Add the description tags
308- if details .get ('description' ):
310+ if details .get ('description' ) and verbosity :
309311 event .add_attribute_tag (f"CrowdStrike:adversary:description: { actor_name } " , desc_id .uuid )
310312 event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } : DESCRIPTION" , desc_id .uuid )
311313
@@ -339,10 +341,10 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
339341 event .add_attribute_tag (f"CrowdStrike:adversary:branch: { actor_branch } " , ta .uuid )
340342 if had_timestamp :
341343 event .add_object (timestamp_object )
342- if tsf :
344+ if tsf and verbosity :
343345 event .add_attribute_tag (f"CrowdStrike:adversary:first-seen: { actor_name } " , tsf .uuid )
344346 event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } : FIRST SEEN" , tsf .uuid )
345- if tsl :
347+ if tsl and verbosity :
346348 event .add_attribute_tag (f"CrowdStrike:adversary:last-seen: { actor_name } " , tsl .uuid )
347349 event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } : LAST SEEN" , tsl .uuid )
348350 if actor .get ('known_as' ) or actor .get ("origins" ):
@@ -351,19 +353,20 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
351353 aliased = [a .strip () for a in actor .get ("known_as" ).split ("," )]
352354 for alias in aliased :
353355 kao = known_as_object .add_attribute ('alias' , alias , disable_correlation = True )
354- kao .add_tag (f"CrowdStrike:adversary:branch: { actor_branch } " )
355- kao .add_tag (f"CrowdStrike:adversary:{ slug } :alias: { alias .upper ()} " )
356356 # Tag the aliases to the threat-actor attribution
357- event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } :alias: { alias .upper ()} " , ta .uuid )
357+ if verbosity :
358+ kao .add_tag (f"CrowdStrike:adversary:branch: { actor_branch } " )
359+ kao .add_tag (f"CrowdStrike:adversary:{ slug } :alias: { alias .upper ()} " )
360+ event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } :alias: { alias .upper ()} " , ta .uuid )
358361 event .add_object (known_as_object )
359362 for orig in actor .get ("origins" , []):
360363 locale = orig .get ("value" )
361364 if locale :
362365 kar = event .add_attribute ("country-of-residence" , locale , disable_correlation = True )
363- event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } :origin: { locale .upper ()} " , kar .uuid )
364- event .add_attribute_tag (f"CrowdStrike:adversary:origin: { locale .upper ()} " , kar .uuid )
365366 event .add_tag (f"CrowdStrike:adversary:origin: { locale .upper ()} " )
366-
367+ if verbosity :
368+ event .add_attribute_tag (f"CrowdStrike:adversary:{ slug } :origin: { locale .upper ()} " , kar .uuid )
369+ event .add_attribute_tag (f"CrowdStrike:adversary:origin: { locale .upper ()} " , kar .uuid )
367370
368371 victim = None
369372 # Adversary victim location
@@ -373,9 +376,9 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
373376 if not victim :
374377 victim = MISPObject ("victim" )
375378 vic = victim .add_attribute ('regions' , region , disable_correlation = True )
376- vic . add_tag ( f"CrowdStrike:target:location: { region . upper () } " )
377- vic .add_tag (f"CrowdStrike:adversary: { slug } :target:location: { region .upper ()} " )
378- # vic.add_tag(f"CrowdStrike:adversary:{slug}:target: LOCATION ")
379+ if verbosity :
380+ vic .add_tag (f"CrowdStrike:target:location: { region .upper ()} " )
381+ vic .add_tag (f"CrowdStrike:adversary:{ slug } :target:location: { region . upper () } " )
379382
380383 # Adversary victim industry
381384 if actor .get ("target_industries" ):
@@ -384,10 +387,11 @@ def create_event_from_actor(self, actor, act_details) -> MISPEvent():
384387 if not victim :
385388 victim = MISPObject ("victim" )
386389 vic = victim .add_attribute ('sectors' , sector , disable_correlation = True )
387- vic .add_tag (f"CrowdStrike:adversary:{ slug } :target:sector: { sector .upper ()} " )
388- #vic.add_tag(f"CrowdStrike:adversary:{slug}:target: SECTOR")
389- vic .add_tag (f"CrowdStrike:target:sector: { sector .upper ()} " )
390- event .add_object (victim )
390+ if verbosity :
391+ vic .add_tag (f"CrowdStrike:adversary:{ slug } :target:sector: { sector .upper ()} " )
392+ vic .add_tag (f"CrowdStrike:target:sector: { sector .upper ()} " )
393+ if victim :
394+ event .add_object (victim )
391395
392396 # TYPE Taxonomic tag, all events
393397 if confirm_boolean_param (self .settings ["TAGGING" ].get ("taxonomic_TYPE" , False )):
0 commit comments