331 AbstractFile file =
node.getLookup().lookup(AbstractFile.class);
332 Image image =
node.getLookup().lookup(Image.class);
333 DataSource dataSource =
node.getLookup().lookup(DataSource.class);
334 if (file ==
null && image ==
null) {
335 return NbBundle.getMessage(this.getClass(),
"Metadata.nodeText.nonFilePassedIn");
338 StringBuilder sb =
new StringBuilder();
339 addHeader(sb, Bundle.Metadata_headerTitle(),
false);
344 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), file.getUniquePath());
345 }
catch (TskCoreException ex) {
346 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), file.getParentPath() +
"/" + file.getName());
349 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.type"), file.getType().getName());
350 addRow(sb, Bundle.Metadata_tableRowTitle_mimeType(), file.getMIMEType());
351 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.size"), Long.toString(file.getSize()));
352 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.fileNameAlloc"), file.getDirFlagAsString());
353 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.metadataAlloc"), file.getMetaFlagsAsString());
359 String md5 = file.getMd5Hash();
361 md5 = NbBundle.getMessage(this.getClass(),
"Metadata.tableRowContent.md5notCalc");
363 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.md5"), md5);
364 String sha256 = file.getSha256Hash();
365 if (sha256 ==
null) {
366 sha256 = NbBundle.getMessage(this.getClass(),
"Metadata.tableRowContent.md5notCalc");
368 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.sha256"), sha256);
369 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString());
372 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.internalid"), Long.toString(file.getId()));
373 if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) {
374 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.localPath"), file.getLocalAbsPath());
378 List<BlackboardArtifact> associatedObjectArtifacts = file.getArtifacts(ARTIFACT_TYPE.TSK_ASSOCIATED_OBJECT);
379 if (!associatedObjectArtifacts.isEmpty()) {
380 BlackboardArtifact artifact = associatedObjectArtifacts.get(0);
381 BlackboardAttribute associatedArtifactAttribute = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT));
382 if (associatedArtifactAttribute !=
null) {
383 long artifactId = associatedArtifactAttribute.getValueLong();
384 BlackboardArtifact associatedArtifact = artifact.getSleuthkitCase().getBlackboardArtifact(artifactId);
388 }
catch (TskCoreException ex) {
389 sb.append(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
398 if (file instanceof FsContent) {
399 FsContent fsFile = (FsContent) file;
401 addHeader(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.text"),
true);
403 List<String> istatStrings = Collections.emptyList();
405 istatStrings = fsFile.getMetaDataText();
406 }
catch (TskCoreException ex) {
407 istatStrings = Arrays.asList(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.exceptionNotice.text") + ex.getLocalizedMessage());
410 if (istatStrings.isEmpty() || (istatStrings.size() == 1 && StringUtils.isEmpty(istatStrings.get(0)))) {
411 sb.append(MessageFormat.format(
"<div class=\"{0}\"><p class=\"{1}\">{2}</p><div>",
414 Bundle.MetadataWorker_doInBackground_noDataMsg()));
418 for (String str : istatStrings) {
425 if (sb.length() > 50000) {
426 addMonospacedRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.truncated"));
437 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), image.getUniquePath());
438 }
catch (TskCoreException ex) {
439 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), image.getName());
441 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.imageType"), image.getType().getName());
442 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.size"), Long.toString(image.getSize()));
445 String md5 = image.getMd5();
446 if (md5 ==
null || md5.isEmpty()) {
447 md5 = NbBundle.getMessage(this.getClass(),
"Metadata.tableRowContent.md5notCalc");
449 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.md5"), md5);
451 String sha1 = image.getSha1();
452 if (sha1 ==
null || sha1.isEmpty()) {
453 sha1 = NbBundle.getMessage(this.getClass(),
"Metadata.tableRowContent.md5notCalc");
455 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.sha1"), sha1);
457 String sha256 = image.getSha256();
458 if (sha256 ==
null || sha256.isEmpty()) {
459 sha256 = NbBundle.getMessage(this.getClass(),
"Metadata.tableRowContent.md5notCalc");
461 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.sha256"), sha256);
462 }
catch (TskCoreException ex) {
463 sb.append(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
465 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.sectorSize"), Long.toString(image.getSsize()));
466 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.timezone"), image.getTimeZone());
468 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.deviceId"), image.getDeviceId());
469 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.internalid"), Long.toString(image.getId()));
472 String[] imagePaths = image.getPaths();
474 if (imagePaths.length > 0) {
476 NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.localPath"),
479 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.localPath"),
480 NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.none"));
490 return sb.toString();