Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Autopsy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Autopsy
Commits
b3665a65
Commit
b3665a65
authored
9 years ago
by
Richard Cordovano
Browse files
Options
Downloads
Patches
Plain Diff
Add FileManager.findFilesByMimeType API
parent
9146300b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java
+48
-0
48 additions, 0 deletions
...rg/sleuthkit/autopsy/casemodule/services/FileManager.java
with
48 additions
and
0 deletions
Core/src/org/sleuthkit/autopsy/casemodule/services/FileManager.java
+
48
−
0
View file @
b3665a65
...
@@ -65,6 +65,54 @@ public FileManager(SleuthkitCase caseDb) {
...
@@ -65,6 +65,54 @@ public FileManager(SleuthkitCase caseDb) {
this
.
caseDb
=
caseDb
;
this
.
caseDb
=
caseDb
;
}
}
/**
* Finds all files with types that match one of a collection of MIME types.
*
* @param mimeTypes The MIME types.
*
* @return The files.
*
* @throws TskCoreException If there is a problem querying the case
* database.
*/
public
synchronized
List
<
AbstractFile
>
findFilesByMimeType
(
Collection
<
String
>
mimeTypes
)
throws
TskCoreException
{
if
(
null
==
caseDb
)
{
throw
new
TskCoreException
(
"File manager has been closed"
);
}
return
caseDb
.
findAllFilesWhere
(
createFileTypeInCondition
(
mimeTypes
));
}
/**
* Finds all files in a given data source (image, local/logical files set,
* etc.) with types that match one of a collection of MIME types.
*
* @param dataSource The data source.
* @param mimeTypes The MIME types.
*
* @return The files.
*
* @throws TskCoreException If there is a problem querying the case
* database.
*/
public
synchronized
List
<
AbstractFile
>
findFilesByMimeType
(
Content
dataSource
,
Collection
<
String
>
mimeTypes
)
throws
TskCoreException
{
if
(
null
==
caseDb
)
{
throw
new
TskCoreException
(
"File manager has been closed"
);
}
return
caseDb
.
findAllFilesWhere
(
"data_source_obj_id = "
+
dataSource
.
getId
()
+
" AND "
+
createFileTypeInCondition
(
mimeTypes
));
}
/**
* Converts a list of MIME types into an SQL "mime_type IN" condition.
*
* @param mimeTypes The MIIME types.
*
* @return The condition string.
*/
private
static
String
createFileTypeInCondition
(
Collection
<
String
>
mimeTypes
)
{
String
types
=
StringUtils
.
join
(
mimeTypes
,
"', '"
);
return
"mime_type IN ('"
+
types
+
"')"
;
}
/**
/**
* Finds all files and directories with a given file name. The name search
* Finds all files and directories with a given file name. The name search
* is for full or partial matches and is case insensitive (a case
* is for full or partial matches and is case insensitive (a case
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment