9b8e00a0 |
/* |
46a35abe |
* Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved. |
221825fd |
* Copyright (C) 2007-2013 Sourcefire, Inc. |
7021b545 |
* |
2023340a |
* Authors: Tomasz Kojm |
9b8e00a0 |
*
* This program is free software; you can redistribute it and/or modify |
bb34cb31 |
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. |
9b8e00a0 |
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software |
48b7b4a7 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA. |
9b8e00a0 |
*/
|
888f5794 |
#ifndef __FILETYPES_H
#define __FILETYPES_H
|
994ae437 |
#include <sys/types.h>
|
7021b545 |
#include "clamav.h"
#include "cltypes.h" |
048d7677 |
#include "fmap.h" |
7021b545 |
|
1d1c4b15 |
#define CL_FILE_MBUFF_SIZE 1024 |
2d69fdbb |
#define CL_PART_MBUFF_SIZE 1028 |
1d1c4b15 |
/* MAGIC_BUFFER_SIZE must be the bigger of the two sizes above */ |
2d69fdbb |
#define MAGIC_BUFFER_SIZE 1028 |
1d1c4b15 |
|
888f5794 |
#define CL_TYPENO 500 |
ee99255a |
#define MAX_EMBEDDED_OBJ 10 |
9b8e00a0 |
typedef enum { |
55094a9c |
CL_TYPE_ANY = 0, |
c8f2d060 |
CL_TYPE_TEXT_ASCII = CL_TYPENO, /* X3.4, ISO-8859, non-ISO ext. ASCII */
CL_TYPE_TEXT_UTF8,
CL_TYPE_TEXT_UTF16LE,
CL_TYPE_TEXT_UTF16BE,
CL_TYPE_BINARY_DATA,
/* Please do not add any new types above this line */ |
7021b545 |
CL_TYPE_ERROR, |
3805ebcb |
CL_TYPE_MSEXE, |
094116b2 |
CL_TYPE_ELF, |
89c14869 |
CL_TYPE_MACHO, |
3222a096 |
CL_TYPE_MACHO_UNIBIN, |
a7f5fd00 |
CL_TYPE_POSIX_TAR,
CL_TYPE_OLD_TAR, |
75e46945 |
CL_TYPE_CPIO_OLD,
CL_TYPE_CPIO_ODC,
CL_TYPE_CPIO_NEWC,
CL_TYPE_CPIO_CRC, |
3805ebcb |
CL_TYPE_GZ,
CL_TYPE_ZIP,
CL_TYPE_BZ,
CL_TYPE_RAR, |
9d96e4b6 |
CL_TYPE_ARJ, |
3805ebcb |
CL_TYPE_MSSZDD,
CL_TYPE_MSOLE2,
CL_TYPE_MSCAB,
CL_TYPE_MSCHM, |
bf45bf13 |
CL_TYPE_SIS, |
3805ebcb |
CL_TYPE_SCRENC, |
7ec67e94 |
CL_TYPE_GRAPHICS, |
eb308794 |
CL_TYPE_RIFF, |
667ab9c6 |
CL_TYPE_BINHEX, |
846e4186 |
CL_TYPE_TNEF, |
2c6f9d57 |
CL_TYPE_CRYPTFF, |
f87214c3 |
CL_TYPE_PDF, |
3953039b |
CL_TYPE_UUENCODED, |
015ce4a8 |
CL_TYPE_SCRIPT, |
bd988961 |
CL_TYPE_HTML_UTF16, |
52c2a8bd |
CL_TYPE_RTF, |
81fded11 |
CL_TYPE_7Z, |
44a3e21a |
CL_TYPE_SWF, |
703a9258 |
CL_TYPE_JAVA, |
ca019d6d |
CL_TYPE_XAR, |
43d7f6f6 |
CL_TYPE_XZ, |
70ef8414 |
CL_TYPE_OOXML_WORD,
CL_TYPE_OOXML_PPT,
CL_TYPE_OOXML_XL, |
de46d3e3 |
CL_TYPE_INTERNAL, |
146fbb29 |
CL_TYPE_HWP3, |
c6f7be55 |
CL_TYPE_OOXML_HWP, |
aedd18ac |
CL_TYPE_PS, |
f7efc022 |
|
1d1c4b15 |
/* Section for partition types */
CL_TYPE_PART_ANY, /* unknown partition type */
CL_TYPE_PART_HFSPLUS,
|
ece009c0 |
/* bigger numbers have higher priority (in o-t-f detection) */ |
2612de29 |
CL_TYPE_MBR, |
3805ebcb |
CL_TYPE_HTML, /* on the fly */ |
d1bccafe |
CL_TYPE_MAIL, /* magic + on the fly */ |
a85bd2ac |
CL_TYPE_SFX, /* foo SFX marker */ |
4705a377 |
CL_TYPE_ZIPSFX, /* on the fly */ |
d8a5c616 |
CL_TYPE_RARSFX, /* on the fly */ |
9a47aa20 |
CL_TYPE_7ZSFX, |
faaf436a |
CL_TYPE_CABSFX, |
9d96e4b6 |
CL_TYPE_ARJSFX, |
ed93f138 |
CL_TYPE_NULSFT, /* on the fly */ |
6038397e |
CL_TYPE_AUTOIT, |
cadaa703 |
CL_TYPE_ISHIELD_MSI, |
583cd65f |
CL_TYPE_ISO9660, |
ca019d6d |
CL_TYPE_DMG, |
fce85dd7 |
CL_TYPE_GPT, |
6c2feae2 |
CL_TYPE_APM, |
30a75097 |
CL_TYPE_XDP, |
4cdcd47d |
CL_TYPE_XML_WORD,
CL_TYPE_XML_XL, |
904fe155 |
CL_TYPE_XML_HWP, |
6cd5a9dc |
CL_TYPE_HWPOLE2, |
ef48d7cb |
CL_TYPE_MHTML, |
56bb195e |
CL_TYPE_LNK, |
e7b3198d |
CL_TYPE_OTHER, /* on-the-fly, used for target 14 (OTHER) */ |
6038397e |
CL_TYPE_IGNORED /* please don't add anything below */ |
9b8e00a0 |
} cli_file_t;
|
7021b545 |
struct cli_ftype {
cli_file_t type;
uint32_t offset;
unsigned char *magic;
char *tname;
struct cli_ftype *next; |
9381324a |
uint16_t length; |
7021b545 |
};
|
a85bd2ac |
struct cli_matched_type { |
9381324a |
struct cli_matched_type *next; |
994ae437 |
off_t offset; |
9381324a |
cli_file_t type; |
994ae437 |
unsigned short cnt; |
a85bd2ac |
};
|
7021b545 |
cli_file_t cli_ftcode(const char *name); |
c27d4056 |
const char *cli_ftname(cli_file_t code); |
0d9dbdef |
void cli_ftfree(const struct cl_engine *engine); |
7021b545 |
cli_file_t cli_filetype(const unsigned char *buf, size_t buflen, const struct cl_engine *engine); |
1d1c4b15 |
cli_file_t cli_filetype2(fmap_t *map, const struct cl_engine *engine, cli_file_t basetype); |
5612732c |
int cli_addtypesigs(struct cl_engine *engine); |
9b8e00a0 |
#endif |