Package lib :: Package core :: Module packages
[hide private]
[frames] | no frames]

Source Code for Module lib.core.packages

 1  # Copyright (C) 2010-2014 Cuckoo Foundation. 
 2  # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org 
 3  # See the file 'docs/LICENSE' for copying permission. 
 4   
5 -def choose_package(file_type, file_name):
6 """Choose analysis package due to file type and file extension. 7 @param file_type: file type. 8 @return: package or None. 9 """ 10 if not file_type: 11 return None 12 13 file_name = file_name.lower() 14 15 if "DLL" in file_type: 16 if file_name.endswith(".cpl"): 17 return "cpl" 18 else: 19 return "dll" 20 elif "PE32" in file_type or "MS-DOS" in file_type: 21 return "exe" 22 elif "PDF" in file_type or file_name.endswith(".pdf"): 23 return "pdf" 24 elif "Rich Text Format" in file_type or \ 25 "Microsoft Word" in file_type or \ 26 "Microsoft Office Word" in file_type or \ 27 file_name.endswith(".docx") or \ 28 file_name.endswith(".doc") or \ 29 file_name.endswith(".rtf"): 30 return "doc" 31 elif "Microsoft Office Excel" in file_type or file_name.endswith(".xlsx") or file_name.endswith(".xls"): 32 return "xls" 33 elif "HTML" in file_type or file_name.endswith(".htm") or file_name.endswith(".html"): 34 return "html" 35 elif file_name.endswith(".jar"): 36 return "jar" 37 elif "Zip" in file_type: 38 return "zip" 39 else: 40 return "generic"
41