19 package org.sleuthkit.datamodel;
21 import java.util.Collections;
22 import java.util.List;
23 import java.util.Optional;
24 import java.util.ResourceBundle;
37 private static final ResourceBundle bundle = ResourceBundle.getBundle(
"org.sleuthkit.datamodel.Bundle");
39 final static Long NO_ACCOUNT = null;
40 final static String NO_OWNER_ID = null;
44 private final long osAccountObjId;
45 private final long realmId;
46 private final String loginName;
47 private final String addr;
49 private final String signature;
54 private final String fullName;
57 private final OsAccountDbStatus osAccountDbStatus;
58 private final Long creationTime;
60 private List<OsAccountAttribute> osAccountAttributes = null;
67 UNKNOWN(0, bundle.getString(
"OsAccountStatus.Unknown.text")),
68 ACTIVE(1, bundle.getString(
"OsAccountStatus.Active.text")),
69 DISABLED(2, bundle.getString(
"OsAccountStatus.Disabled.text")),
70 DELETED(3, bundle.getString(
"OsAccountStatus.Deleted.text"));
73 private final String name;
107 if (statusType.ordinal() == statusId) {
120 enum OsAccountDbStatus {
123 DELETED(2,
"Deleted");
125 private final int id;
126 private final String name;
128 OsAccountDbStatus(
int id, String name) {
141 static OsAccountDbStatus fromID(
int typeId) {
142 for (OsAccountDbStatus type : OsAccountDbStatus.values()) {
143 if (type.ordinal() == typeId) {
156 UNKNOWN(0, bundle.getString(
"OsAccountType.Unknown.text")),
157 SERVICE(1, bundle.getString(
"OsAccountType.Service.text")),
158 INTERACTIVE(2, bundle.getString(
"OsAccountType.Interactive.text"));
160 private final int id;
161 private final String name;
195 if (accountType.ordinal() == typeId) {
222 OsAccount(
SleuthkitCase sleuthkitCase,
long osAccountobjId,
long realmId, String loginName, String uniqueId, String signature,
225 super(sleuthkitCase, osAccountobjId, signature);
227 this.sleuthkitCase = sleuthkitCase;
228 this.osAccountObjId = osAccountobjId;
229 this.realmId = realmId;
230 this.loginName = loginName;
231 this.addr = uniqueId;
232 this.signature = signature;
233 this.fullName = fullName;
234 this.creationTime = creationTime;
235 this.osAccountType = accountType;
236 this.osAccountStatus = accountStatus;
237 this.osAccountDbStatus = accountDbStatus;
246 synchronized void setAttributesInternal(List<OsAccountAttribute> osAccountAttributes) {
247 this.osAccountAttributes = osAccountAttributes;
257 return osAccountObjId;
267 return Optional.ofNullable(addr);
287 return Optional.ofNullable(loginName);
295 String getSignature() {
305 return Optional.ofNullable(fullName);
314 return Optional.ofNullable(creationTime);
323 return Optional.ofNullable(osAccountType);
332 return Optional.ofNullable(osAccountStatus);
341 return osAccountDbStatus;
352 if (osAccountAttributes == null) {
355 return Collections.unmodifiableList(osAccountAttributes);
376 return sleuthkitCase;
399 throw new UnsupportedOperationException(
"Not supported yet.");
403 public <T> T accept(SleuthkitItemVisitor<T> v) {
404 return v.visit(
this);
417 private final long osAccountObjId;
418 private final Long hostId;
419 private final Long sourceObjId;
434 super(attributeType, valueInt);
436 this.osAccountObjId = osAccount.
getId();
437 this.hostId = (host != null ? host.
getHostId() : null);
438 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
452 super(attributeType, valueLong);
454 this.osAccountObjId = osAccount.
getId();
455 this.hostId = (host != null ? host.
getHostId() : null);
456 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
470 super(attributeType, valueDouble);
472 this.osAccountObjId = osAccount.
getId();
473 this.hostId = (host != null ? host.
getHostId() : null);
474 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
488 super(attributeType, valueString);
490 this.osAccountObjId = osAccount.
getId();
491 this.hostId = (host != null ? host.
getHostId() : null);
492 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
506 super(attributeType, valueBytes);
508 this.osAccountObjId = osAccount.
getId();
509 this.hostId = (host != null ? host.
getHostId() : null);
510 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
533 valueInt, valueLong, valueDouble, valueString, valueBytes,
535 this.osAccountObjId = osAccount.
getId();
536 this.hostId = (host != null ? host.
getHostId() : null);
537 this.sourceObjId = (sourceObj != null ? sourceObj.
getId() : null);
546 return Optional.ofNullable(hostId);
555 return osAccountObjId;
564 return Optional.ofNullable(sourceObjId);
Optional< Long > getSourceObjectId()
Optional< String > getAddr()
OsAccountAttribute(BlackboardAttribute.Type attributeType, byte[] valueBytes, OsAccount osAccount, Host host, Content sourceObj)
OsAccountType(int id, String name)
static OsAccountType fromID(int typeId)
Optional< OsAccountType > getOsAccountType()
OsAccountAttribute(BlackboardAttribute.Type attributeType, String valueString, OsAccount osAccount, Host host, Content sourceObj)
OsAccountDbStatus getOsAccountDbStatus()
synchronized List< OsAccountInstance > getOsAccountInstances()
Optional< OsAccountStatus > getOsAccountStatus()
OsAccountAttribute(BlackboardAttribute.Type attributeType, long valueLong, OsAccount osAccount, Host host, Content sourceObj)
long getOsAccountObjectId()
OsAccountAttribute(BlackboardAttribute.Type attributeType, int valueInt, OsAccount osAccount, Host host, Content sourceObj)
Optional< Long > getCreationTime()
SleuthkitCase getSleuthkitCase()
Optional< Long > getHostId()
Optional< String > getLoginName()
OsAccountManager getOsAccountManager()
static OsAccountStatus fromID(int statusId)
OsAccountStatus(int id, String name)
OsAccountAttribute(BlackboardAttribute.Type attributeType, double valueDouble, OsAccount osAccount, Host host, Content sourceObj)
Optional< String > getFullName()
int read(byte[] buf, long offset, long len)
synchronized List< OsAccountAttribute > getExtendedOsAccountAttributes()