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
81f1549f
Commit
81f1549f
authored
7 years ago
by
millmanorama
Browse files
Options
Downloads
Patches
Plain Diff
reactivate getRelationships
parent
8378487c
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/CommunicationsManager.java
+67
-48
67 additions, 48 deletions
...va/src/org/sleuthkit/datamodel/CommunicationsManager.java
with
67 additions
and
48 deletions
bindings/java/src/org/sleuthkit/datamodel/CommunicationsManager.java
+
67
−
48
View file @
81f1549f
...
@@ -1058,6 +1058,73 @@ public List<AccountDeviceInstance> getRelatedAccountDeviceInstances(AccountDevic
...
@@ -1058,6 +1058,73 @@ public List<AccountDeviceInstance> getRelatedAccountDeviceInstances(AccountDevic
}
}
}
}
/**
* Returns relationships between two accounts
*
* @param account1
* @param account2
* @param filter
*
* @return
*
* @throws TskCoreException exception thrown if a critical error occurs
* within TSK core
*/
public
List
<
BlackboardArtifact
>
getRelationships
(
AccountDeviceInstance
account1
,
AccountDeviceInstance
account2
,
CommunicationsFilter
filter
)
throws
TskCoreException
{
//set up applicable filters
Set
<
String
>
applicableFilters
=
new
HashSet
<
String
>(
Arrays
.
asList
(
CommunicationsFilter
.
DateRangeFilter
.
class
.
getName
(),
CommunicationsFilter
.
DeviceFilter
.
class
.
getName
(),
CommunicationsFilter
.
RelationshipTypeFilter
.
class
.
getName
()
));
String
filterSQL
=
getCommunicationsFilterSQL
(
filter
,
applicableFilters
);
CaseDbConnection
connection
=
db
.
getConnection
();
db
.
acquireSingleUserCaseReadLock
();
Statement
s
=
null
;
ResultSet
rs
=
null
;
try
{
s
=
connection
.
createStatement
();
rs
=
connection
.
executeQuery
(
s
,
"SELECT 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,"
+
" artifacts.review_status_id AS review_status_id"
+
" FROM blackboard_artifacts AS artifacts"
+
" JOIN account_relationships AS relationships"
+
" ON artifacts.artifact_obj_id = relationships.relationship_source_obj_id"
+
" WHERE relationships.account1_id IN ( "
+
account1
.
getAccount
().
getAccountID
()
+
", "
+
account2
.
getAccount
().
getAccountID
()
+
" ) AND relationships.account2_id IN ( "
+
account1
.
getAccount
().
getAccountID
()
+
", "
+
account2
.
getAccount
().
getAccountID
()
+
" )"
+
(
filterSQL
.
isEmpty
()
?
""
:
" AND "
+
filterSQL
)
);
//NON-NLS
ArrayList
<
BlackboardArtifact
>
artifacts
=
new
ArrayList
<
BlackboardArtifact
>();
while
(
rs
.
next
())
{
BlackboardArtifact
.
Type
bbartType
=
db
.
getArtifactType
(
rs
.
getInt
(
"artifact_type_id"
));
artifacts
.
add
(
new
BlackboardArtifact
(
db
,
rs
.
getLong
(
"artifact_id"
),
rs
.
getLong
(
"obj_id"
),
rs
.
getLong
(
"artifact_obj_id"
),
rs
.
getLong
(
"data_source_obj_id"
),
bbartType
.
getTypeID
(),
bbartType
.
getTypeName
(),
bbartType
.
getDisplayName
(),
BlackboardArtifact
.
ReviewStatus
.
withID
(
rs
.
getInt
(
"review_status_id"
))));
}
return
artifacts
;
}
catch
(
SQLException
ex
)
{
throw
new
TskCoreException
(
"Error getting relationships between accounts. "
+
ex
.
getMessage
(),
ex
);
}
finally
{
closeResultSet
(
rs
);
closeStatement
(
s
);
connection
.
close
();
db
.
releaseSingleUserCaseReadLock
();
}
}
/**
/**
* Get account_type_if for the given account type.
* Get account_type_if for the given account type.
*
*
...
@@ -1597,54 +1664,6 @@ public long getSecond() {
...
@@ -1597,54 +1664,6 @@ public long getSecond() {
// }
// }
// }
// }
// /**
// /**
// * Returns relationships between two accounts
// *
// * @param account1_id account_id for account1
// * @param account2_id account_id for account2
// *
// * @throws TskCoreException exception thrown if a critical error occurs
// * within TSK core
// */
// public List<BlackboardArtifact> getRelationships(long account1_id, long account2_id) throws TskCoreException {
// CaseDbConnection connection = db.getConnection();
// db.acquireSingleUserCaseReadLock();
// Statement s = null;
// ResultSet rs = null;
//
// try {
// s = connection.createStatement();
// rs = connection.executeQuery(s, "SELECT 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,"
// + " artifacts.review_status_id AS review_status_id"
// + " FROM blackboard_artifacts AS artifacts"
// + " JOIN relationships AS relationships"
// + " ON artifacts.artifact_obj_id = relationships.relationship_source_obj_id"
// + " WHERE relationships.account1_id IN ( " + account1_id + ", " + account2_id + " )"
// + " AND relationships.account2_id IN ( " + account1_id + ", " + account2_id + " )"
// ); //NON-NLS
//
// ArrayList<BlackboardArtifact> artifacts = new ArrayList<BlackboardArtifact>();
// while (rs.next()) {
// BlackboardArtifact.Type bbartType = db.getArtifactType(rs.getInt("artifact_type_id"));
// artifacts.add(new BlackboardArtifact(db, rs.getLong("artifact_id"), rs.getLong("obj_id"), rs.getLong("artifact_obj_id"), rs.getLong("data_source_obj_id"),
// bbartType.getTypeID(), bbartType.getTypeName(), bbartType.getDisplayName(),
// BlackboardArtifact.ReviewStatus.withID(rs.getInt("review_status_id"))));
// }
//
// return artifacts;
// } catch (SQLException ex) {
// throw new TskCoreException("Error getting relationships bteween accounts. " + ex.getMessage(), ex);
// } finally {
// closeResultSet(rs);
// closeStatement(s);
// connection.close();
// db.releaseSingleUserCaseReadLock();
// }
// }
// /**
// * Returns relationships, of given type, between two accounts
// * Returns relationships, of given type, between two accounts
// *
// *
// * @param account1_id account1 artifact ID
// * @param account1_id account1 artifact ID
...
...
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