@@ -842,24 +842,28 @@ def yara_detected(self, name):
842
842
if re .findall (name , yara_block ["name" ], re .I ):
843
843
yield "sample" , self .results ["target" ]["file" ]["path" ], yara_block , self .results ["target" ]["file" ]
844
844
845
- for block in target ["file" ].get ("extracted_files" , []):
846
- for keyword in ("cape_yara" , "yara" ):
847
- for yara_block in block [keyword ]:
848
- if re .findall (name , yara_block ["name" ], re .I ):
849
- # we can't use here values from set_path
850
- yield "sample" , block ["path" ], yara_block , block
845
+ if target ["file" ].get ("selfextract" ):
846
+ for _ , toolsblock in target ["file" ]["selfextract" ].items ():
847
+ for block in toolsblock .get ("extracted_files" , []):
848
+ for keyword in ("cape_yara" , "yara" ):
849
+ for yara_block in block [keyword ]:
850
+ if re .findall (name , yara_block ["name" ], re .I ):
851
+ # we can't use here values from set_path
852
+ yield "sample" , block ["path" ], yara_block , block
851
853
852
854
for block in self .results .get ("CAPE" , {}).get ("payloads" , []) or []:
853
855
for sub_keyword in ("cape_yara" , "yara" ):
854
856
for yara_block in block .get (sub_keyword , []):
855
857
if re .findall (name , yara_block ["name" ], re .I ):
856
858
yield sub_keyword , block ["path" ], yara_block , block
857
859
858
- for subblock in block .get ("extracted_files" , []):
859
- for keyword in ("cape_yara" , "yara" ):
860
- for yara_block in subblock [keyword ]:
861
- if re .findall (name , yara_block ["name" ], re .I ):
862
- yield "sample" , subblock ["path" ], yara_block , block
860
+ if block .get ("selfextract" , {}):
861
+ for _ , toolsblock in block ["selfextract" ].items ():
862
+ for subblock in toolsblock .get ("extracted_files" , []):
863
+ for keyword in ("cape_yara" , "yara" ):
864
+ for yara_block in subblock [keyword ]:
865
+ if re .findall (name , yara_block ["name" ], re .I ):
866
+ yield "sample" , subblock ["path" ], yara_block , block
863
867
864
868
for keyword in ("procdump" , "procmemory" , "extracted" , "dropped" ):
865
869
if self .results .get (keyword ) is not None :
@@ -879,11 +883,13 @@ def yara_detected(self, name):
879
883
if re .findall (name , yara_block ["name" ], re .I ):
880
884
yield "extracted_pe" , pe ["path" ], yara_block , block
881
885
882
- for subblock in block .get ("extracted_files" , []):
883
- for keyword in ("cape_yara" , "yara" ):
884
- for yara_block in subblock [keyword ]:
885
- if re .findall (name , yara_block ["name" ], re .I ):
886
- yield "sample" , subblock ["path" ], yara_block , block
886
+ if block .get ("selfextract" , {}):
887
+ for _ , toolsblock in block ["selfextract" ].items ():
888
+ for subblock in toolsblock .get ("extracted_files" , []):
889
+ for keyword in ("cape_yara" , "yara" ):
890
+ for yara_block in subblock [keyword ]:
891
+ if re .findall (name , yara_block ["name" ], re .I ):
892
+ yield "sample" , subblock ["path" ], yara_block , block
887
893
888
894
macro_path = os .path .join (CUCKOO_ROOT , "storage" , "analyses" , str (self .results ["info" ]["id" ]), "macros" )
889
895
for macroname in self .results .get ("static" , {}).get ("office" , {}).get ("Macro" , {}).get ("info" , []) or []:
0 commit comments