Signed-off-by: Matteo Cafasso <noxdafox(a)gmail.com>
---
daemon/tsk.c | 27 +++++++++++++++++++++++++++
generator/actions.ml | 18 ++++++++++++++++++
src/MAX_PROC_NR | 2 +-
3 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/daemon/tsk.c b/daemon/tsk.c
index 0fe1250..5b55739 100644
--- a/daemon/tsk.c
+++ b/daemon/tsk.c
@@ -59,6 +59,33 @@ do_icat (const mountable_t *mountable, int64_t inode)
return file_out (cmd);
}
+int
+do_blkcat (const mountable_t *mountable, int64_t start, int64_t number)
+{
+ CLEANUP_FREE char *cmd = NULL;
+
+ /* Data unit address start must be greater than 0 */
+ if (start < 0) {
+ reply_with_error ("data unit starting address must be >= 0");
+ return -1;
+ }
+
+ /* Data unit number must be greater than 1 */
+ if (number < 1) {
+ reply_with_error ("data unit number must be >= 1");
+ return -1;
+ }
+
+ /* Construct the command. */
+ if (asprintf (&cmd, "blkcat %s %" PRIi64 " %" PRIi64,
+ mountable->device, start, number) == -1) {
+ reply_with_perror ("asprintf");
+ return -1;
+ }
+
+ return file_out (cmd);
+}
+
static int
file_out (const char *cmd)
{
diff --git a/generator/actions.ml b/generator/actions.ml
index ff72cfe..0fabed6 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -12958,6 +12958,24 @@ and save it as F<filename> on the local machine.
This allows to download deleted or inaccessible files." };
+ { defaults with
+ name = "blkcat"; added = (1, 33, 14);
+ style = RErr, [Mountable "device"; Int64 "start"; Int64
"number"; FileOut "filename"], [];
+ proc_nr = Some 465;
+ optional = Some "sleuthkit";
+ progress = true; cancellable = true;
+ shortdesc = "download the device data units to the local machine";
+ longdesc = "\
+Download F<number> amount of data units starting from F<start>
+from the disk partition (eg. F</dev/sda1>)
+and save them as F<filename> on the local machine.
+
+The size of a data unit varies across filesystem implementations.
+On NTFS filesystems data units are referred as clusters
+while on ExtX ones they are referred as fragments.
+
+This command allows to download unallocated sectors of the disk." };
+
]
(* Non-API meta-commands available only in guestfish.
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 3bb8a49..073c57b 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-464
+465
--
2.7.0