summaryrefslogtreecommitdiffstats
path: root/src/file_http.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2012-12-23 17:06:46 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2012-12-23 17:06:46 +0100
commitfed437606c1a3ab045b10d73ab7b6cd94e4a504c (patch)
treeb7ce5bce12c85752a4c951c0d71d47cd5c9cf7b4 /src/file_http.c
parent07505440f7e7cd19116fd24f21d27e2503664ab0 (diff)
PhotoRec: add http cache data recovery for forensics purpose
Diffstat (limited to 'src/file_http.c')
-rw-r--r--src/file_http.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/file_http.c b/src/file_http.c
index 57a3ea0..03fcfc0 100644
--- a/src/file_http.c
+++ b/src/file_http.c
@@ -31,7 +31,6 @@
#include "filegen.h"
static void register_header_check_http(file_stat_t *file_stat);
-static int header_check_http(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new);
const file_hint_t file_hint_http= {
.extension="http",
@@ -39,28 +38,18 @@ const file_hint_t file_hint_http= {
.min_header_distance=0,
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
.recover=1,
- .enable_by_default=1,
+ .enable_by_default=0,
.register_header_check=&register_header_check_http
};
-static const unsigned char http_header[22]= {
- 'H', 'T', 'T', 'P', '/', '1', '.', '1',
- ' ', '2', '0', '0', ' ', 'O', 'K', '\r',
- '\n', 'D', 'a', 't', 'e', ':'
-};
-
-static void register_header_check_http(file_stat_t *file_stat)
+static int header_check_http(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
- register_header_check(0, http_header, sizeof(http_header), &header_check_http, file_stat);
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_http.extension;
+ return 1;
}
-static int header_check_http(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
+static void register_header_check_http(file_stat_t *file_stat)
{
- if(memcmp(buffer, http_header, sizeof(http_header))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_http.extension;
- return 1;
- }
- return 0;
+ register_header_check(0, "HTTP/1.1 200 OK\r\nDate:", 22, &header_check_http, file_stat);
}