diff --git a/src/core/operations/ExtractFiles.mjs b/src/core/operations/ExtractFiles.mjs
index fce23a9a..8c313f59 100644
--- a/src/core/operations/ExtractFiles.mjs
+++ b/src/core/operations/ExtractFiles.mjs
@@ -38,7 +38,7 @@ class ExtractFiles extends Operation {
${supportedExts.join("")}
- `;
+ Minimum File Size can be used to prune small false positives.`;
this.infoURL = "https://forensicswiki.xyz/wiki/index.php?title=File_Carving";
this.inputType = "ArrayBuffer";
this.outputType = "List";
@@ -54,6 +54,11 @@ class ExtractFiles extends Operation {
name: "Ignore failed extractions",
type: "boolean",
value: true
+ },
+ {
+ name: "Minimum File Size",
+ type: "number",
+ value: 0
}
]);
}
@@ -66,6 +71,7 @@ class ExtractFiles extends Operation {
run(input, args) {
const bytes = new Uint8Array(input),
categories = [],
+ minSize = args.pop(1),
ignoreFailedExtractions = args.pop(1);
args.forEach((cat, i) => {
@@ -80,7 +86,9 @@ class ExtractFiles extends Operation {
const errors = [];
detectedFiles.forEach(detectedFile => {
try {
- files.push(extractFile(bytes, detectedFile.fileDetails, detectedFile.offset));
+ let file;
+ if ((file = extractFile(bytes, detectedFile.fileDetails, detectedFile.offset)).size >= minSize)
+ files.push(file);
} catch (err) {
if (!ignoreFailedExtractions && err.message.indexOf("No extraction algorithm available") < 0) {
errors.push(