2004-03-20 14:49:22 +00:00
|
|
|
/*
|
2005-02-05 15:50:18 +00:00
|
|
|
* Copyright (C) 2002 - 2005 Tomasz Kojm <tkojm@clamav.net>
|
2004-03-20 14:49:22 +00:00
|
|
|
* With enhancements from Thomas Lamy <Thomas.Lamy@in-online.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
2006-04-09 19:59:28 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301, USA.
|
2004-03-20 14:49:22 +00:00
|
|
|
*/
|
|
|
|
|
2004-07-02 23:00:58 +00:00
|
|
|
#ifndef __FILETYPES_H
|
|
|
|
#define __FILETYPES_H
|
|
|
|
|
2006-03-25 00:10:15 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2006-10-25 15:40:47 +00:00
|
|
|
#define MAGIC_BUFFER_SIZE 256
|
2004-07-02 23:00:58 +00:00
|
|
|
#define CL_TYPENO 500
|
2006-03-25 00:10:15 +00:00
|
|
|
#define SFX_MAX_TESTS 10
|
2004-03-20 14:49:22 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2004-09-13 16:44:01 +00:00
|
|
|
CL_TYPE_UNKNOWN_TEXT = CL_TYPENO,
|
|
|
|
CL_TYPE_UNKNOWN_DATA,
|
|
|
|
CL_TYPE_MSEXE,
|
2005-08-29 15:02:38 +00:00
|
|
|
CL_TYPE_ELF,
|
2004-09-13 16:44:01 +00:00
|
|
|
CL_TYPE_DATA,
|
2005-03-22 21:26:27 +00:00
|
|
|
CL_TYPE_POSIX_TAR,
|
|
|
|
CL_TYPE_OLD_TAR,
|
2004-09-13 16:44:01 +00:00
|
|
|
CL_TYPE_GZ,
|
|
|
|
CL_TYPE_ZIP,
|
|
|
|
CL_TYPE_BZ,
|
|
|
|
CL_TYPE_RAR,
|
|
|
|
CL_TYPE_MSSZDD,
|
|
|
|
CL_TYPE_MSOLE2,
|
|
|
|
CL_TYPE_MSCAB,
|
|
|
|
CL_TYPE_MSCHM,
|
2005-12-15 02:02:29 +00:00
|
|
|
CL_TYPE_SIS,
|
2004-09-13 16:44:01 +00:00
|
|
|
CL_TYPE_SCRENC,
|
2004-09-17 23:29:44 +00:00
|
|
|
CL_TYPE_GRAPHICS,
|
2005-02-05 15:50:18 +00:00
|
|
|
CL_TYPE_RIFF,
|
2004-11-18 19:30:29 +00:00
|
|
|
CL_TYPE_BINHEX,
|
2005-03-22 22:43:45 +00:00
|
|
|
CL_TYPE_TNEF,
|
2005-11-14 21:02:26 +00:00
|
|
|
CL_TYPE_CRYPTFF,
|
2005-05-01 00:47:39 +00:00
|
|
|
CL_TYPE_PDF,
|
2006-01-21 18:37:48 +00:00
|
|
|
CL_TYPE_UUENCODED,
|
2006-04-24 16:28:05 +00:00
|
|
|
CL_TYPE_PST, /* Microsoft Outlook binary email folder (.pst file) */
|
2006-10-25 15:40:47 +00:00
|
|
|
CL_TYPE_HTML_UTF16,
|
2004-07-02 23:00:58 +00:00
|
|
|
|
2004-07-03 15:24:43 +00:00
|
|
|
/* bigger numbers have higher priority (in o-t-f detection) */
|
2004-09-13 16:44:01 +00:00
|
|
|
CL_TYPE_HTML, /* on the fly */
|
2005-06-29 01:06:54 +00:00
|
|
|
CL_TYPE_MAIL, /* magic + on the fly */
|
2006-01-15 15:46:36 +00:00
|
|
|
CL_TYPE_SFX, /* foo SFX marker */
|
2005-07-26 01:33:15 +00:00
|
|
|
CL_TYPE_ZIPSFX, /* on the fly */
|
2006-11-01 18:02:04 +00:00
|
|
|
CL_TYPE_RARSFX, /* on the fly */
|
|
|
|
CL_TYPE_CABSFX
|
2004-07-02 23:00:58 +00:00
|
|
|
|
2004-03-20 14:49:22 +00:00
|
|
|
} cli_file_t;
|
|
|
|
|
2006-01-15 15:46:36 +00:00
|
|
|
struct cli_matched_type {
|
|
|
|
cli_file_t type;
|
2006-03-25 00:10:15 +00:00
|
|
|
off_t offset;
|
|
|
|
unsigned short cnt;
|
2006-01-15 15:46:36 +00:00
|
|
|
struct cli_matched_type *next;
|
|
|
|
};
|
|
|
|
|
2006-10-09 15:23:50 +00:00
|
|
|
cli_file_t cli_filetype(const unsigned char *buf, size_t buflen);
|
2006-10-25 15:40:47 +00:00
|
|
|
cli_file_t cli_filetype2(int desc, const struct cl_engine *engine);
|
2005-09-23 02:23:36 +00:00
|
|
|
int cli_addtypesigs(struct cl_engine *engine);
|
2004-03-20 14:49:22 +00:00
|
|
|
|
|
|
|
#endif
|