mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
use OsAccount id
This commit is contained in:
parent
740390a102
commit
c41f2a2255
@ -397,8 +397,8 @@ public final class FileTypes implements AutopsyVisitableItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, OsAccount osAccount) throws TskCoreException {
|
public DataArtifact newDataArtifact(BlackboardArtifact.Type artifactType, Collection<BlackboardAttribute> attributesList, Long osAccountId) throws TskCoreException {
|
||||||
return content.newDataArtifact(artifactType, attributesList, osAccount);
|
return content.newDataArtifact(artifactType, attributesList, osAccountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -540,12 +540,7 @@ final class ChromeCacheExtractor {
|
|||||||
webAttr.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID,
|
webAttr.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID,
|
||||||
moduleName, cachedItemFile.getId()));
|
moduleName, cachedItemFile.getId()));
|
||||||
|
|
||||||
Optional<Long> optional = cacheEntryFile.getOsAccountObjectId();
|
BlackboardArtifact webCacheArtifact = cacheEntryFile.newDataArtifact(new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_WEB_CACHE), webAttr);
|
||||||
OsAccount account = null;
|
|
||||||
if(optional.isPresent()) {
|
|
||||||
account = currentCase.getSleuthkitCase().getOsAccountManager().getOsAccountByObjectId(optional.get());
|
|
||||||
}
|
|
||||||
BlackboardArtifact webCacheArtifact = cacheEntryFile.newDataArtifact(new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_WEB_CACHE), webAttr, account);
|
|
||||||
artifactsAdded.add(webCacheArtifact);
|
artifactsAdded.add(webCacheArtifact);
|
||||||
|
|
||||||
// Create a TSK_ASSOCIATED_OBJECT on the f_XXX or derived file file back to the CACHE entry
|
// Create a TSK_ASSOCIATED_OBJECT on the f_XXX or derived file file back to the CACHE entry
|
||||||
|
@ -159,9 +159,8 @@ abstract class Extract {
|
|||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
BlackboardArtifact createArtifactWithAttributes(BlackboardArtifact.Type type, Content content, Collection<BlackboardAttribute> attributes) throws TskCoreException {
|
BlackboardArtifact createArtifactWithAttributes(BlackboardArtifact.Type type, Content content, Collection<BlackboardAttribute> attributes) throws TskCoreException {
|
||||||
Optional<OsAccount> optional = getOsAccount(content);
|
if (type.getCategory() == BlackboardArtifact.Category.DATA_ARTIFACT) {
|
||||||
if (optional.isPresent() && type.getCategory() == BlackboardArtifact.Category.DATA_ARTIFACT) {
|
return content.newDataArtifact(type, attributes);
|
||||||
return content.newDataArtifact(type, attributes, optional.get());
|
|
||||||
} else {
|
} else {
|
||||||
BlackboardArtifact bbart = content.newArtifact(type.getTypeID());
|
BlackboardArtifact bbart = content.newArtifact(type.getTypeID());
|
||||||
bbart.addAttributes(attributes);
|
bbart.addAttributes(attributes);
|
||||||
@ -537,28 +536,4 @@ abstract class Extract {
|
|||||||
|
|
||||||
return tempFile;
|
return tempFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the appropriate OsAccount for the given file.
|
|
||||||
*
|
|
||||||
* @param file
|
|
||||||
*
|
|
||||||
* @return An Optional OsACcount object.
|
|
||||||
*
|
|
||||||
* @throws TskCoreException
|
|
||||||
*/
|
|
||||||
Optional<OsAccount> getOsAccount(Content content) throws TskCoreException {
|
|
||||||
if(content instanceof AbstractFile) {
|
|
||||||
if(osAccountCache == null) {
|
|
||||||
Optional<Long> accountId = ((AbstractFile)content).getOsAccountObjectId();
|
|
||||||
if(accountId.isPresent()) {
|
|
||||||
return Optional.ofNullable(tskCase.getOsAccountManager().getOsAccountByObjectId(accountId.get()));
|
|
||||||
}
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
return osAccountCache.getOsAccount(((AbstractFile)content));
|
|
||||||
}
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user