Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
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
Sleuthkit
Commits
588bfacc
Unverified
Commit
588bfacc
authored
3 years ago
by
eugene7646
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2655 from gdicristofaro/8274-kwsFix
8274 kws fix
parents
cac48729
c9793cad
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
bindings/java/src/org/sleuthkit/datamodel/Blackboard.java
+51
-50
51 additions, 50 deletions
bindings/java/src/org/sleuthkit/datamodel/Blackboard.java
with
51 additions
and
50 deletions
bindings/java/src/org/sleuthkit/datamodel/Blackboard.java
+
51
−
50
View file @
588bfacc
...
...
@@ -1835,61 +1835,62 @@ public List<BlackboardArtifact> getExactMatchKeywordSearchResults(String keyword
* database query to obtain the keyword hits.
*/
public
List
<
BlackboardArtifact
>
getKeywordSearchResults
(
String
keyword
,
String
regex
,
TskData
.
KeywordSearchQueryType
searchType
,
String
kwsListName
,
Long
dataSourceId
)
throws
TskCoreException
{
String
dataSourceClause
=
dataSourceId
==
null
?
""
:
" AND artifacts.data_source_obj_id = ? "
;
// dataSourceId
?
""
:
" AND artifacts.data_source_obj_id = ? "
;
// dataSourceId
String
kwsListClause
=
(
kwsListName
==
null
||
kwsListName
.
isEmpty
()
?
"
AND
set_name IS NULL "
:
"
AND
set_name = ? "
);
?
"
WHERE r.
set_name IS NULL "
:
"
WHERE r.
set_name = ? "
);
String
keywordClause
=
(
keyword
==
null
||
keyword
.
isEmpty
()
?
""
:
" AND keyword = ? "
);
?
""
:
" AND
r.
keyword = ? "
);
String
searchTypeClause
=
(
searchType
==
null
?
""
:
" AND search_type = ? "
);
:
" AND
r.
search_type = ? "
);
String
regexClause
=
(
regex
==
null
||
regex
.
isEmpty
()
?
""
:
" AND regexp_str = ? "
);
String
query
=
"SELECT DISTINCT artifacts.artifact_id AS artifact_id, "
+
" artifacts.obj_id AS obj_id, "
+
" artifacts.artifact_obj_id AS artifact_obj_id, "
+
" artifacts.data_source_obj_id AS data_source_obj_id, "
+
" artifacts.artifact_type_id AS artifact_type_id, "
+
" types.type_name AS type_name, "
+
" types.display_name AS display_name, "
+
" types.category_type as category_type,"
+
" artifacts.review_status_id AS review_status_id, "
+
" results.conclusion AS conclusion, "
+
" results.significance AS significance, "
+
" results.priority AS priority, "
+
" results.configuration AS configuration, "
+
" results.justification AS justification, "
+
" (SELECT value_text FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
+
BlackboardAttribute
.
Type
.
TSK_SET_NAME
.
getTypeID
()
+
" LIMIT 1) AS set_name, "
+
" (SELECT value_int32 FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
?
""
:
" AND r.regexp_str = ? "
);
String
query
=
"SELECT r.* FROM ( "
+
" SELECT DISTINCT artifacts.artifact_id AS artifact_id, "
+
" artifacts.obj_id AS obj_id, "
+
" artifacts.artifact_obj_id AS artifact_obj_id, "
+
" artifacts.data_source_obj_id AS data_source_obj_id, "
+
" artifacts.artifact_type_id AS artifact_type_id, "
+
" types.type_name AS type_name, "
+
" types.display_name AS display_name, "
+
" types.category_type as category_type,"
+
" artifacts.review_status_id AS review_status_id, "
+
" results.conclusion AS conclusion, "
+
" results.significance AS significance, "
+
" results.priority AS priority, "
+
" results.configuration AS configuration, "
+
" results.justification AS justification, "
+
" (SELECT value_text FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
+
BlackboardAttribute
.
Type
.
TSK_SET_NAME
.
getTypeID
()
+
" LIMIT 1) AS set_name, "
+
" (SELECT value_int32 FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
+
BlackboardAttribute
.
ATTRIBUTE_TYPE
.
TSK_KEYWORD_SEARCH_TYPE
.
getTypeID
()
+
" LIMIT 1) AS search_type, "
+
" (SELECT value_text FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
+
BlackboardAttribute
.
Type
.
TSK_KEYWORD_REGEXP
.
getTypeID
()
+
" LIMIT 1) AS regexp_str, "
+
" (SELECT value_text FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
+
BlackboardAttribute
.
Type
.
TSK_KEYWORD
.
getTypeID
()
+
" LIMIT 1) AS keyword "
+
" FROM blackboard_artifacts artifacts "
+
" JOIN blackboard_artifact_types AS types "
+
" ON artifacts.artifact_type_id = types.artifact_type_id "
+
" LEFT JOIN tsk_analysis_results AS results "
+
" ON artifacts.artifact_obj_id = results.artifact_obj_id "
+
" WHERE types.category_type = "
+
BlackboardArtifact
.
Category
.
ANALYSIS_RESULT
.
getID
()
+
" AND artifacts.artifact_type_id = "
+
BlackboardArtifact
.
Type
.
TSK_KEYWORD_HIT
.
getTypeID
()
+
" "
+
dataSourceClause
+
searchType
Clause
+
k
wsList
Clause
+
keyword
Clause
+
regexClause
;
+
" (SELECT value_text FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
+
BlackboardAttribute
.
Type
.
TSK_KEYWORD_REGEXP
.
getTypeID
()
+
" LIMIT 1) AS regexp_str, "
+
" (SELECT value_text FROM blackboard_attributes attr WHERE attr.artifact_id = artifacts.artifact_id AND attr.attribute_type_id = "
+
BlackboardAttribute
.
Type
.
TSK_KEYWORD
.
getTypeID
()
+
" LIMIT 1) AS keyword "
+
" FROM blackboard_artifacts artifacts "
+
" JOIN blackboard_artifact_types AS types "
+
" ON artifacts.artifact_type_id = types.artifact_type_id "
+
" LEFT JOIN tsk_analysis_results AS results "
+
" ON artifacts.artifact_obj_id = results.artifact_obj_id "
+
" WHERE types.category_type = "
+
BlackboardArtifact
.
Category
.
ANALYSIS_RESULT
.
getID
()
+
" AND artifacts.artifact_type_id = "
+
BlackboardArtifact
.
Type
.
TSK_KEYWORD_HIT
.
getTypeID
()
+
" "
+
dataSourceClause
+
" ) r "
+
kwsList
Clause
+
k
eyword
Clause
+
searchType
Clause
+
regexClause
;
List
<
BlackboardArtifact
>
artifacts
=
new
ArrayList
<>();
caseDb
.
acquireSingleUserCaseReadLock
();
...
...
@@ -1902,11 +1903,7 @@ public List<BlackboardArtifact> getKeywordSearchResults(String keyword, String r
if
(
dataSourceId
!=
null
)
{
preparedStatement
.
setLong
(++
paramIdx
,
dataSourceId
);
}
if
(
searchType
!=
null
)
{
preparedStatement
.
setInt
(++
paramIdx
,
searchType
.
getType
());
}
if
(!(
kwsListName
==
null
||
kwsListName
.
isEmpty
()))
{
preparedStatement
.
setString
(++
paramIdx
,
kwsListName
);
}
...
...
@@ -1915,6 +1912,10 @@ public List<BlackboardArtifact> getKeywordSearchResults(String keyword, String r
preparedStatement
.
setString
(++
paramIdx
,
keyword
);
}
if
(
searchType
!=
null
)
{
preparedStatement
.
setInt
(++
paramIdx
,
searchType
.
getType
());
}
if
(!(
regex
==
null
||
regex
.
isEmpty
()))
{
preparedStatement
.
setString
(++
paramIdx
,
regex
);
}
...
...
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