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
e2bf518e
Commit
e2bf518e
authored
2 years ago
by
Greg DiCristofaro
Browse files
Options
Downloads
Plain Diff
Merge branch '8440-develop' into 8440-new_table_load
parents
6664eba0
a0be7000
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java
+2
-1
2 additions, 1 deletion
bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java
bindings/java/test/org/sleuthkit/datamodel/OsAccountTest.java
+81
-0
81 additions, 0 deletions
...ings/java/test/org/sleuthkit/datamodel/OsAccountTest.java
with
83 additions
and
1 deletion
bindings/java/src/org/sleuthkit/datamodel/SleuthkitCase.java
+
2
−
1
View file @
e2bf518e
...
@@ -11034,7 +11034,8 @@ void setAcquisitionToolDetails(DataSource datasource, String name, String versio
...
@@ -11034,7 +11034,8 @@ void setAcquisitionToolDetails(DataSource datasource, String name, String versio
*
*
* @throws TskCoreException
* @throws TskCoreException
*/
*/
void setAcquisitionDetails(long dataSourceId, String details, CaseDbTransaction trans) throws TskCoreException {
@Beta
public void setAcquisitionDetails(long dataSourceId, String details, CaseDbTransaction trans) throws TskCoreException {
try {
try {
CaseDbConnection connection = trans.getConnection();
CaseDbConnection connection = trans.getConnection();
PreparedStatement statement = connection.getPreparedStatement(PREPARED_STATEMENT.UPDATE_ACQUISITION_DETAILS);
PreparedStatement statement = connection.getPreparedStatement(PREPARED_STATEMENT.UPDATE_ACQUISITION_DETAILS);
...
...
This diff is collapsed.
Click to expand it.
bindings/java/test/org/sleuthkit/datamodel/OsAccountTest.java
+
81
−
0
View file @
e2bf518e
...
@@ -396,6 +396,87 @@ public void mergeRealmsTests() throws TskCoreException, OsAccountManager.NotUser
...
@@ -396,6 +396,87 @@ public void mergeRealmsTests() throws TskCoreException, OsAccountManager.NotUser
}
}
}
}
@Test
public
void
updateRealmAndMergeTests
()
throws
TskCoreException
,
OsAccountManager
.
NotUserSIDException
{
/**
* Test the scenario where an update of an account triggers an update of
* a realm and subsequent merge of realms and accounts.
*/
Host
host
=
caseDB
.
getHostManager
().
newHost
(
"updateRealmAndMergeTestHost"
);
// Step 1: create a local account with SID and user name
String
ownerUid1
=
"S-1-5-21-1182664808-117526782-2525957323-13395"
;
String
realmName1
=
null
;
String
loginName1
=
"sandip"
;
OsAccount
osAccount1
=
caseDB
.
getOsAccountManager
().
newWindowsOsAccount
(
ownerUid1
,
loginName1
,
realmName1
,
host
,
OsAccountRealm
.
RealmScope
.
LOCAL
);
OsAccountRealm
realm1
=
caseDB
.
getOsAccountRealmManager
().
getRealmByRealmId
(
osAccount1
.
getRealmId
());
assertEquals
(
realm1
.
getRealmAddr
().
isPresent
(),
true
);
// verify the realm has a SID
assertEquals
(
realm1
.
getRealmNames
().
isEmpty
(),
true
);
// verify the realm has no name
// Step2: create a local account with domain name and username
String
ownerUid2
=
null
;
String
realmName2
=
"CORP"
;
String
loginName2
=
"sandip"
;
Optional
<
OsAccount
>
oOsAccount2
=
caseDB
.
getOsAccountManager
().
getWindowsOsAccount
(
ownerUid2
,
loginName2
,
realmName2
,
host
);
// this account should not exists
assertEquals
(
oOsAccount2
.
isPresent
(),
false
);
// create a new account - a new realm as there is nothing to tie it to realm1
OsAccount
osAccount2
=
caseDB
.
getOsAccountManager
().
newWindowsOsAccount
(
ownerUid2
,
loginName2
,
realmName2
,
host
,
OsAccountRealm
.
RealmScope
.
LOCAL
);
OsAccountRealm
realm2
=
caseDB
.
getOsAccountRealmManager
().
getRealmByRealmId
(
osAccount2
.
getRealmId
());
assertTrue
(
osAccount1
.
getId
()
!=
osAccount2
.
getId
());
assertTrue
(
realm1
.
getRealmId
()
!=
realm2
.
getRealmId
());
// Step 3: now create/update the account with sid/domain/username
// this should return the existing account1, which needs to be updated.
String
ownerUid3
=
"S-1-5-21-1182664808-117526782-2525957323-13395"
;
String
realmAddr3
=
"S-1-5-21-1182664808-117526782-2525957323"
;
String
loginName3
=
"sandip"
;
String
realmName3
=
"CORP"
;
Optional
<
OsAccount
>
oOsAccount3
=
caseDB
.
getOsAccountManager
().
getWindowsOsAccount
(
ownerUid3
,
loginName3
,
realmName3
,
host
);
assertTrue
(
oOsAccount3
.
isPresent
());
// update the account so that its domain gets updated.
OsAccountManager
.
OsAccountUpdateResult
updateResult
=
caseDB
.
getOsAccountManager
().
updateCoreWindowsOsAccountAttributes
(
oOsAccount3
.
get
(),
ownerUid3
,
loginName3
,
realmName3
,
host
);
Optional
<
OsAccount
>
updatedAccount3
=
updateResult
.
getUpdatedAccount
();
assertTrue
(
updatedAccount3
.
isPresent
());
// this should cause the realm1 to be updated - and then realm2 to be merged into realm1
OsAccountRealm
realm3
=
caseDB
.
getOsAccountRealmManager
().
getRealmByRealmId
(
updatedAccount3
.
get
().
getRealmId
());
assertTrue
(
realm3
.
getRealmId
()
==
realm1
.
getRealmId
());
assertTrue
(
realm3
.
getRealmAddr
().
isPresent
());
// verify the realm gets an addr
assertTrue
(
realm3
.
getRealmAddr
().
get
().
equalsIgnoreCase
(
realmAddr3
));
assertTrue
(
realm3
.
getRealmNames
().
get
(
0
).
equalsIgnoreCase
(
realmName3
));
// verify realm name.
// And now verify that the realm2 has been merged into realm1.
OsAccountRealm
realm22
=
caseDB
.
getOsAccountRealmManager
().
getRealmByRealmId
(
osAccount2
.
getRealmId
());
assertTrue
(
realm22
.
getDbStatus
()
==
OsAccountRealm
.
RealmDbStatus
.
MERGED
);
//and account2 has been merged into account1
OsAccount
osAccount22
=
caseDB
.
getOsAccountManager
().
getOsAccountByObjectId
(
osAccount2
.
getId
());
assertTrue
(
osAccount22
.
getOsAccountDbStatus
()
==
OsAccount
.
OsAccountDbStatus
.
MERGED
);
}
@Test
@Test
public
void
hostAddressTests
()
throws
TskCoreException
{
public
void
hostAddressTests
()
throws
TskCoreException
{
...
...
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