65
65
66
66
cfg = Config ()
67
67
processing_conf = Config ("processing" )
68
- selfextract_conf = Config ("selfextract " )
68
+ integration_conf = Config ("integrations " )
69
69
70
70
try :
71
71
from modules .signatures .recon_checkip import dns_indicators
108
108
HAVE_BAT_DECODER = False
109
109
print ("OPTIONAL! Missed dependency: poetry run pip install -U git+https://github.com/DissectMalware/batch_deobfuscator" )
110
110
111
- unautoit_binary = os .path .join (CUCKOO_ROOT , selfextract_conf .UnAutoIt_extract .binary )
112
- innoextact_binary = os .path .join (CUCKOO_ROOT , selfextract_conf .Inno_extract .binary )
113
- sevenzip_binary = os .path .join (CUCKOO_ROOT , selfextract_conf .SevenZip_unpack .binary )
111
+ unautoit_binary = os .path .join (CUCKOO_ROOT , integration_conf .UnAutoIt_extract .binary )
112
+ innoextact_binary = os .path .join (CUCKOO_ROOT , integration_conf .Inno_extract .binary )
113
+ sevenzip_binary = os .path .join (CUCKOO_ROOT , integration_conf .SevenZip_unpack .binary )
114
114
if not path_exists (sevenzip_binary ):
115
115
sevenzip_binary = "/usr/bin/7z"
116
116
135
135
136
136
HAVE_VIRUSTOTAL = True
137
137
138
+ HAVE_MANDIANT_INTEL = False
139
+ if integration_conf .mandiant_intel .enabled :
140
+ from lib .cuckoo .common .integrations .mandiant_intel import mandiant_lookup
141
+
142
+ HAVE_MANDIANT_INTEL = True
143
+
138
144
exclude_startswith = ("parti_" ,)
139
145
excluded_extensions = (".parti" ,)
140
146
tools_folder = os .path .join (cfg .cuckoo .get ("tmppath" , "/tmp" ), "cape-external" )
@@ -180,40 +186,40 @@ def static_file_info(
180
186
data_dictionary ["floss" ] = floss_strings
181
187
182
188
if "Mono" in data_dictionary ["type" ]:
183
- if selfextract_conf .general .dotnet :
189
+ if integration_conf .general .dotnet :
184
190
data_dictionary ["dotnet" ] = DotNETExecutable (file_path ).run ()
185
191
if processing_conf .strings .dotnet :
186
192
dotnet_strings = dotnet_user_strings (file_path )
187
193
if dotnet_strings :
188
194
data_dictionary .setdefault ("dotnet_strings" , dotnet_strings )
189
195
190
- elif HAVE_OLETOOLS and package in {"doc" , "ppt" , "xls" , "pub" } and selfextract_conf .general .office :
196
+ elif HAVE_OLETOOLS and package in {"doc" , "ppt" , "xls" , "pub" } and integration_conf .general .office :
191
197
# options is dict where we need to get pass get_options
192
198
data_dictionary ["office" ] = Office (file_path , task_id , data_dictionary ["sha256" ], options_dict ).run ()
193
- elif ("PDF" in data_dictionary ["type" ] or file_path .endswith (".pdf" )) and selfextract_conf .general .pdf :
199
+ elif ("PDF" in data_dictionary ["type" ] or file_path .endswith (".pdf" )) and integration_conf .general .pdf :
194
200
data_dictionary ["pdf" ] = PDF (file_path ).run ()
195
201
elif (
196
202
package in {"wsf" , "hta" } or data_dictionary ["type" ] == "XML document text" or file_path .endswith (".wsf" )
197
- ) and selfextract_conf .general .windows_script :
203
+ ) and integration_conf .general .windows_script :
198
204
data_dictionary ["wsf" ] = WindowsScriptFile (file_path ).run ()
199
205
# elif package in {"js", "vbs"}:
200
206
# data_dictionary["js"] = EncodedScriptFile(file_path).run()
201
- elif (package == "lnk" or "MS Windows shortcut" in data_dictionary ["type" ]) and selfextract_conf .general .lnk :
207
+ elif (package == "lnk" or "MS Windows shortcut" in data_dictionary ["type" ]) and integration_conf .general .lnk :
202
208
data_dictionary ["lnk" ] = LnkShortcut (file_path ).run ()
203
- elif ("Java Jar" in data_dictionary ["type" ] or file_path .endswith (".jar" )) and selfextract_conf .general .java :
204
- if selfextract_conf .procyon .binary and not path_exists (selfextract_conf .procyon .binary ):
209
+ elif ("Java Jar" in data_dictionary ["type" ] or file_path .endswith (".jar" )) and integration_conf .general .java :
210
+ if integration_conf .procyon .binary and not path_exists (integration_conf .procyon .binary ):
205
211
log .error ("procyon_path specified in processing.conf but the file does not exist" )
206
212
else :
207
- data_dictionary ["java" ] = Java (file_path , selfextract_conf .procyon .binary ).run ()
213
+ data_dictionary ["java" ] = Java (file_path , integration_conf .procyon .binary ).run ()
208
214
elif file_path .endswith (".rdp" ) or data_dictionary .get ("name" , {}).endswith (".rdp" ):
209
215
data_dictionary ["rdp" ] = parse_rdp_file (file_path )
210
216
# It's possible to fool libmagic into thinking our 2007+ file is a zip.
211
217
# So until we have static analysis for zip files, we can use oleid to fail us out silently,
212
218
# yeilding no static analysis results for actual zip files.
213
- # elif ("ELF" in data_dictionary["type"] or file_path.endswith(".elf")) and selfextract_conf .general.elf:
219
+ # elif ("ELF" in data_dictionary["type"] or file_path.endswith(".elf")) and integration_conf .general.elf:
214
220
# data_dictionary["elf"] = ELF(file_path).run()
215
221
# data_dictionary["keys"] = f.get_keys()
216
- # elif HAVE_OLETOOLS and package == "hwp" and selfextract_conf .general.hwp:
222
+ # elif HAVE_OLETOOLS and package == "hwp" and integration_conf .general.hwp:
217
223
# data_dictionary["hwp"] = HwpDocument(file_path).run()
218
224
219
225
data = path_read_file (file_path )
@@ -251,6 +257,11 @@ def static_file_info(
251
257
if vt_details :
252
258
data_dictionary ["virustotal" ] = vt_details
253
259
260
+ if HAVE_MANDIANT_INTEL and processing_conf .mandiant_intel .enabled :
261
+ mandiant_intel_details = mandiant_lookup ("file" , file_path , results )
262
+ if mandiant_intel_details :
263
+ data_dictionary ["mandiant_intel" ] = mandiant_intel_details
264
+
254
265
generic_file_extractors (
255
266
file_path ,
256
267
destination_folder ,
@@ -456,7 +467,7 @@ def generic_file_extractors(
456
467
]
457
468
458
469
futures = {}
459
- with pebble .ProcessPool (max_workers = int (selfextract_conf .general .max_workers )) as pool :
470
+ with pebble .ProcessPool (max_workers = int (integration_conf .general .max_workers )) as pool :
460
471
# Prefer custom modules over the built-in ones, since only 1 is allowed
461
472
# to be the extracted_files_tool.
462
473
if extra_info_modules :
@@ -468,12 +479,12 @@ def generic_file_extractors(
468
479
for extraction_func in file_info_funcs :
469
480
funcname = extraction_func .__name__ .split ("." )[- 1 ]
470
481
if (
471
- not getattr (selfextract_conf , funcname , {}).get ("enabled" , False )
482
+ not getattr (integration_conf , funcname , {}).get ("enabled" , False )
472
483
and getattr (extraction_func , "enabled" , False ) is False
473
484
):
474
485
continue
475
486
476
- func_timeout = int (getattr (selfextract_conf , funcname , {}).get ("timeout" , 60 ))
487
+ func_timeout = int (getattr (integration_conf , funcname , {}).get ("timeout" , 60 ))
477
488
futures [funcname ] = pool .schedule (extraction_func , args = args , kwargs = kwargs , timeout = func_timeout )
478
489
pool .join ()
479
490
@@ -591,7 +602,7 @@ def eziriz_deobfuscate(file: str, *, data_dictionary: dict, **_) -> ExtractorRet
591
602
if all (".NET Reactor" not in string for string in data_dictionary .get ("die" , [])):
592
603
return
593
604
594
- binary = shlex .split (selfextract_conf .eziriz_deobfuscate .binary .strip ())[0 ]
605
+ binary = shlex .split (integration_conf .eziriz_deobfuscate .binary .strip ())[0 ]
595
606
binary = os .path .join (CUCKOO_ROOT , binary )
596
607
if not binary :
597
608
log .warning ("eziriz_deobfuscate.binary is not defined in the configuration." )
@@ -614,7 +625,7 @@ def eziriz_deobfuscate(file: str, *, data_dictionary: dict, **_) -> ExtractorRet
614
625
_ = run_tool (
615
626
[
616
627
os .path .join (CUCKOO_ROOT , binary ),
617
- * shlex .split (selfextract_conf .eziriz_deobfuscate .extra_args .strip ()),
628
+ * shlex .split (integration_conf .eziriz_deobfuscate .extra_args .strip ()),
618
629
file ,
619
630
],
620
631
universal_newlines = True ,
@@ -633,7 +644,7 @@ def de4dot_deobfuscate(file: str, *, filetype: str, **_) -> ExtractorReturnType:
633
644
if "Mono" not in filetype :
634
645
return
635
646
636
- binary = shlex .split (selfextract_conf .de4dot_deobfuscate .binary .strip ())[0 ]
647
+ binary = shlex .split (integration_conf .de4dot_deobfuscate .binary .strip ())[0 ]
637
648
if not binary :
638
649
log .warning ("de4dot_deobfuscate.binary is not defined in the configuration." )
639
650
return
@@ -647,7 +658,7 @@ def de4dot_deobfuscate(file: str, *, filetype: str, **_) -> ExtractorReturnType:
647
658
_ = run_tool (
648
659
[
649
660
binary ,
650
- * shlex .split (selfextract_conf .de4dot_deobfuscate .extra_args .strip ()),
661
+ * shlex .split (integration_conf .de4dot_deobfuscate .extra_args .strip ()),
651
662
"-f" ,
652
663
file ,
653
664
"-o" ,
@@ -676,7 +687,7 @@ def msi_extract(file: str, *, filetype: str, **kwargs) -> ExtractorReturnType:
676
687
if not kwargs .get ("tests" ):
677
688
# msiextract in different way that 7z, we need to add subfolder support
678
689
output = run_tool (
679
- [selfextract_conf .msi_extract .binary , file , "--directory" , tempdir ],
690
+ [integration_conf .msi_extract .binary , file , "--directory" , tempdir ],
680
691
universal_newlines = True ,
681
692
stderr = subprocess .PIPE ,
682
693
)
0 commit comments