Skip to content
Snippets Groups Projects
Commit 890427e3 authored by Brian Carrier's avatar Brian Carrier
Browse files

Added md5 and image size to image_info SQLite table

parent edd0f71e
No related branches found
No related tags found
No related merge requests found
......@@ -5,4 +5,5 @@ Changes to make once we are ready to do a backwards incompatible change.
- Java SleuthkitCase.findFilesWhere should return AbstractFile liek findFiles
- getUniquePath() should not throw exception.
- findFilesInImage should return an enum like TskDB methods differentiating if any data was found or not.
- remove addImageInfo in db_Sqlite that does not take MD5, and/oor make it take IMG_INFO as argument
......@@ -4,6 +4,7 @@ Numbers refer to SourceForge.net tracker IDs:
---------------- VERSION 4.1.3 --------------
Core:
- fixed bug that could crash UFS/ExtX in inode_lookup.
- Updated sqlite database to have image size and md5 (schema v3)
---------------- VERSION 4.1.2 --------------
Core:
......
......@@ -14,6 +14,7 @@
*/
#include "tsk_case_db.h"
#include "tsk/img/ewf.h"
#include <string.h>
#include <algorithm>
......@@ -190,8 +191,16 @@ uint8_t
uint8_t
TskAutoDb::addImageDetails(const char *const img_ptrs[], int a_num)
{
string md5 = "";
if (m_img_info->itype == TSK_IMG_TYPE_EWF_EWF) {
IMG_EWF_INFO *ewf_info = (IMG_EWF_INFO *)m_img_info;
if (ewf_info->md5hash_isset) {
md5 = ewf_info->md5hash;
}
}
if (m_db->addImageInfo(m_img_info->itype, m_img_info->sector_size,
m_curImgId, m_curImgTZone)) {
m_curImgId, m_curImgTZone, m_img_info->size, md5)) {
return 1;
}
......
......@@ -26,7 +26,7 @@ using std::sort;
using std::for_each;
#define TSK_SCHEMA_VER 2
#define TSK_SCHEMA_VER 3
/**
* Set the locations and logging object. Must call
......@@ -238,7 +238,7 @@ int
"Error creating tsk_objects table: %s\n")
||
attempt_exec
("CREATE TABLE tsk_image_info (obj_id INTEGER PRIMARY KEY, type INTEGER, ssize INTEGER, tzone TEXT);",
("CREATE TABLE tsk_image_info (obj_id INTEGER PRIMARY KEY, type INTEGER, ssize INTEGER, tzone TEXT, size INTEGER, md5 TEXT);",
"Error creating tsk_image_info table: %s\n")
||
attempt_exec
......@@ -395,11 +395,20 @@ void
}
}
/**
* deprecated
*/
int
TskDbSqlite::addImageInfo(int type, int size, int64_t & objId, const string & timezone)
{
return addImageInfo(type, size, objId, timezone, 0, "");
}
/**
* @returns 1 on error, 0 on success
*/
int
TskDbSqlite::addImageInfo(int type, int size, int64_t & objId, const string & timezone)
TskDbSqlite::addImageInfo(int type, int ssize, int64_t & objId, const string & timezone, TSK_OFF_T size, const string &md5)
{
char
stmt[1024];
......@@ -413,8 +422,8 @@ int
objId = sqlite3_last_insert_rowid(m_db);
snprintf(stmt, 1024,
"INSERT INTO tsk_image_info (obj_id, type, ssize, tzone) VALUES (%lld, %d, %d, '%s');",
objId, type, size, timezone.c_str());
"INSERT INTO tsk_image_info (obj_id, type, ssize, tzone, size, md5) VALUES (%lld, %d, %d, '%s', %"PRIuOFF", '%s');",
objId, type, ssize, timezone.c_str(), size, md5.c_str());
return attempt_exec(stmt,
"Error adding data to tsk_image_info table: %s\n");
}
......
......@@ -166,6 +166,7 @@ class TskDbSqlite {
int open(bool);
int close();
int addImageInfo(int type, int size, int64_t & objId, const string & timezone);
int addImageInfo(int type, int size, int64_t & objId, const string & timezone, TSK_OFF_T, const string &md5);
int addImageName(int64_t objId, char const *imgName, int sequence);
int addVsInfo(const TSK_VS_INFO * vs_info, int64_t parObjId,
int64_t & objId);
......
......@@ -57,19 +57,37 @@
/* Define to 1 if you have the <libewf.h> header file. */
#undef HAVE_LIBEWF_H
/* Define to 1 if you have the `stdc++' library (-lstdc++). */
#undef HAVE_LIBSTDC__
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <list> header file. */
#undef HAVE_LIST
/* Define to 1 if `lstat' has the bug that it succeeds when given the
zero-length file name argument. */
#undef HAVE_LSTAT_EMPTY_STRING_BUG
/* Define to 1 if you have the <map> header file. */
#undef HAVE_MAP
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Define to 1 if you have the <queue> header file. */
#undef HAVE_QUEUE
/* Define to 1 if you have the <set> header file. */
#undef HAVE_SET
/* Define to 1 if you have the <stack> header file. */
#undef HAVE_STACK
/* Define to 1 if stdbool.h conforms to C99. */
#undef HAVE_STDBOOL_H
......@@ -79,6 +97,12 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <streambuf> header file. */
#undef HAVE_STREAMBUF
/* Define to 1 if you have the <string> header file. */
#undef HAVE_STRING
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
......@@ -115,6 +139,9 @@
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Define to 1 if you have the <vector> header file. */
#undef HAVE_VECTOR
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment