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
a879e133
Commit
a879e133
authored
6 years ago
by
Kelly Kelly
Browse files
Options
Downloads
Patches
Plain Diff
Changed var names per brian's request
parent
8b7c0e9a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/java/src/org/sleuthkit/datamodel/CommunicationsManager.java
+15
-15
15 additions, 15 deletions
...va/src/org/sleuthkit/datamodel/CommunicationsManager.java
with
15 additions
and
15 deletions
bindings/java/src/org/sleuthkit/datamodel/CommunicationsManager.java
+
15
−
15
View file @
a879e133
...
@@ -661,33 +661,33 @@ public List<AccountDeviceInstance> getAccountDeviceInstancesWithRelationships(Co
...
@@ -661,33 +661,33 @@ public List<AccountDeviceInstance> getAccountDeviceInstancesWithRelationships(Co
CommunicationsFilter
.
DeviceFilter
.
class
.
getName
(),
CommunicationsFilter
.
DeviceFilter
.
class
.
getName
(),
CommunicationsFilter
.
RelationshipTypeFilter
.
class
.
getName
()
CommunicationsFilter
.
RelationshipTypeFilter
.
class
.
getName
()
));
));
String
innerQueryf
ilterSQL
=
getCommunicationsFilterSQL
(
filter
,
applicableInnerQueryFilters
);
String
relationshipF
ilterSQL
=
getCommunicationsFilterSQL
(
filter
,
applicableInnerQueryFilters
);
String
l
imitSQL
=
""
;
String
relationshipL
imitSQL
=
""
;
for
(
CommunicationsFilter
.
SubFilter
subFilter
:
filter
.
getAndFilters
())
{
for
(
CommunicationsFilter
.
SubFilter
subFilter
:
filter
.
getAndFilters
())
{
if
(
subFilter
.
getClass
().
getName
().
equals
(
CommunicationsFilter
.
MostRecentFilter
.
class
.
getName
()))
{
if
(
subFilter
.
getClass
().
getName
().
equals
(
CommunicationsFilter
.
MostRecentFilter
.
class
.
getName
()))
{
l
imitSQL
=
subFilter
.
getSQL
(
this
);
relationshipL
imitSQL
=
subFilter
.
getSQL
(
this
);
}
}
}
}
String
filterQuery
=
String
relTbl
filterQuery
=
"SELECT * "
"SELECT * "
+
"FROM account_relationships as relationships"
+
"FROM account_relationships as relationships"
+
(
innerQueryf
ilterSQL
.
isEmpty
()
?
""
:
" WHERE "
+
innerQueryf
ilterSQL
)
+
(
relationshipF
ilterSQL
.
isEmpty
()
?
""
:
" WHERE "
+
relationshipF
ilterSQL
)
+
(
l
imitSQL
.
isEmpty
()
?
""
:
l
imitSQL
);
+
(
relationshipL
imitSQL
.
isEmpty
()
?
""
:
relationshipL
imitSQL
);
String
inner
QueryTemplate
String
uniqueAccount
QueryTemplate
=
" SELECT %1$1s as account_id,"
=
" SELECT %1$1s as account_id,"
+
" data_source_obj_id"
+
" data_source_obj_id"
+
" FROM ( "
+
filterQuery
+
")"
;
+
" FROM ( "
+
relTbl
filterQuery
+
")"
;
String
inn
erQuery1
=
String
.
format
(
inner
QueryTemplate
,
"account1_id"
);
String
relationshipTableFilt
erQuery1
=
String
.
format
(
uniqueAccount
QueryTemplate
,
"account1_id"
);
String
inn
erQuery2
=
String
.
format
(
inner
QueryTemplate
,
"account2_id"
);
String
relationshipTableFilt
erQuery2
=
String
.
format
(
uniqueAccount
QueryTemplate
,
"account2_id"
);
//this query groups by account_id and data_source_obj_id across both innerQueries
//this query groups by account_id and data_source_obj_id across both innerQueries
String
combinedInner
Query
String
uniqueAccount
Query
=
"SELECT DISTINCT account_id, data_source_obj_id"
=
"SELECT DISTINCT account_id, data_source_obj_id"
+
" FROM ( "
+
inn
erQuery1
+
" UNION "
+
inn
erQuery2
+
" ) AS inner_union"
+
" FROM ( "
+
relationshipTableFilt
erQuery1
+
" UNION "
+
relationshipTableFilt
erQuery2
+
" ) AS inner_union"
+
" GROUP BY account_id, data_source_obj_id"
;
+
" GROUP BY account_id, data_source_obj_id"
;
// set up applicable filters
// set up applicable filters
...
@@ -695,7 +695,7 @@ public List<AccountDeviceInstance> getAccountDeviceInstancesWithRelationships(Co
...
@@ -695,7 +695,7 @@ public List<AccountDeviceInstance> getAccountDeviceInstancesWithRelationships(Co
CommunicationsFilter
.
AccountTypeFilter
.
class
.
getName
()
CommunicationsFilter
.
AccountTypeFilter
.
class
.
getName
()
));
));
String
f
ilterSQL
=
getCommunicationsFilterSQL
(
filter
,
applicableFilters
);
String
accountTypeF
ilterSQL
=
getCommunicationsFilterSQL
(
filter
,
applicableFilters
);
String
queryStr
String
queryStr
=
//account info
=
//account info
...
@@ -705,14 +705,14 @@ public List<AccountDeviceInstance> getAccountDeviceInstancesWithRelationships(Co
...
@@ -705,14 +705,14 @@ public List<AccountDeviceInstance> getAccountDeviceInstancesWithRelationships(Co
+
" account_types.type_name AS type_name,"
+
" account_types.type_name AS type_name,"
//Account device instance info
//Account device instance info
+
" data_source_info.device_id AS device_id"
+
" data_source_info.device_id AS device_id"
+
" FROM ( "
+
combinedInner
Query
+
" ) AS account_device_instances"
+
" FROM ( "
+
uniqueAccount
Query
+
" ) AS account_device_instances"
+
" JOIN accounts AS accounts"
+
" JOIN accounts AS accounts"
+
" ON accounts.account_id = account_device_instances.account_id"
+
" ON accounts.account_id = account_device_instances.account_id"
+
" JOIN account_types AS account_types"
+
" JOIN account_types AS account_types"
+
" ON accounts.account_type_id = account_types.account_type_id"
+
" ON accounts.account_type_id = account_types.account_type_id"
+
" JOIN data_source_info AS data_source_info"
+
" JOIN data_source_info AS data_source_info"
+
" ON account_device_instances.data_source_obj_id = data_source_info.obj_id"
+
" ON account_device_instances.data_source_obj_id = data_source_info.obj_id"
+
(
f
ilterSQL
.
isEmpty
()
?
""
:
" WHERE "
+
f
ilterSQL
);
+
(
accountTypeF
ilterSQL
.
isEmpty
()
?
""
:
" WHERE "
+
accountTypeF
ilterSQL
);
switch
(
db
.
getDatabaseType
())
{
switch
(
db
.
getDatabaseType
())
{
case
POSTGRESQL:
case
POSTGRESQL:
...
...
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