diff --git a/configure b/configure index c0c6b62d..5193d528 100755 --- a/configure +++ b/configure @@ -3419,6 +3419,7 @@ pdftotext="no" catdoc="no" catppt="no" xls2csv="no" +unrtf="no" have_static_build="no" @@ -4304,11 +4305,22 @@ _ACEOF fi +if test z`which unrtf 2>/dev/null` != "z"; then + unrtf=`which unrtf` + +cat >>confdefs.h <<_ACEOF +#define HAVE_UNRTF "$unrtf" +_ACEOF + +fi + + echo echo "pdftotext: $pdftotext" echo "catdoc: $catdoc" echo "catppt: $catppt" echo "xls2csv: $xls2csv" +echo "unrtf: $unrtf" id -u $RUNNING_USER 2>/dev/null 1>/dev/null diff --git a/configure.in b/configure.in index 338e2ca5..75550df4 100644 --- a/configure.in +++ b/configure.in @@ -45,6 +45,7 @@ pdftotext="no" catdoc="no" catppt="no" xls2csv="no" +unrtf="no" have_static_build="no" @@ -320,11 +321,18 @@ if test z`which xls2csv 2>/dev/null` != "z"; then fi +if test z`which unrtf 2>/dev/null` != "z"; then + unrtf=`which unrtf` + AC_DEFINE_UNQUOTED(HAVE_UNRTF, "$unrtf", [path to unrtf]) +fi + + echo echo "pdftotext: $pdftotext" echo "catdoc: $catdoc" echo "catppt: $catppt" echo "xls2csv: $xls2csv" +echo "unrtf: $unrtf" id -u $RUNNING_USER 2>/dev/null 1>/dev/null diff --git a/piler-config.h.in b/piler-config.h.in index 4e13113d..219a2f35 100644 --- a/piler-config.h.in +++ b/piler-config.h.in @@ -13,5 +13,6 @@ #undef HAVE_CATDOC #undef HAVE_CATPPT #undef HAVE_XLS2CSV +#undef HAVE_UNRTF #undef HAVE_ZIP diff --git a/src/extract.c b/src/extract.c index 34ce6b99..a4a22b8c 100644 --- a/src/extract.c +++ b/src/extract.c @@ -190,6 +190,10 @@ void extract_attachment_content(struct session_data *sdata, struct _state *state if(strcmp(type, "xls") == 0) snprintf(cmd, sizeof(cmd)-1, "%s -d utf-8 %s", HAVE_XLS2CSV, filename); #endif +#ifdef HAVE_UNRTF + if(strcmp(type, "rtf") == 0) snprintf(cmd, sizeof(cmd)-1, "%s --text %s", HAVE_UNRTF, filename); +#endif + if(strlen(cmd) > 12){ read_content_with_popen(sdata, state, cmd); return; diff --git a/src/parser.c b/src/parser.c index 9a1d9da7..ea51e1be 100644 --- a/src/parser.c +++ b/src/parser.c @@ -226,7 +226,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int // this is a real attachment to dump - if(state->base64 == 1 && strlen(state->filename) > 5 && strlen(state->type) > 3 && state->n_attachments < MAX_ATTACHMENTS-1){ + if(state->base64 == 1 && strlen(state->filename) > 4 && strlen(state->type) > 3 && state->n_attachments < MAX_ATTACHMENTS-1){ state->n_attachments++; snprintf(state->attachments[state->n_attachments].filename, TINYBUFSIZE-1, "%s", state->filename); diff --git a/src/parser_utils.c b/src/parser_utils.c index f712f8d5..c1e2eaca 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -732,6 +732,7 @@ char *determine_attachment_type(char *filename, char *type){ // tar.gz has the same type if(strncasecmp(p, "x-gzip", 3) == 0) return "compressed,"; + if(strncasecmp(p, "rtf", 3) == 0) return "word,"; if(strncasecmp(p, "doc", 3) == 0) return "word,"; if(strncasecmp(p, "docx", 4) == 0) return "word,"; if(strncasecmp(p, "xls", 3) == 0) return "excel,"; @@ -770,6 +771,7 @@ char *get_attachment_extractor_by_filename(char *filename){ if(strcasecmp(p, ".xlsx") == 0) return "xlsx"; if(strcasecmp(p, ".ppt") == 0) return "ppt"; if(strcasecmp(p, ".pptx") == 0) return "pptx"; + if(strcasecmp(p, ".rtf") == 0) return "rtf"; if(strcasecmp(p, ".txt") == 0) return "text"; if(strcasecmp(p, ".csv") == 0) return "text";