21 package org.sleuthkit.autopsy.modules.fileextmismatch;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.Collection;
26 import java.util.HashMap;
27 import java.util.List;
28 import java.util.logging.Level;
29 import javax.swing.Action;
30 import org.openide.util.Lookup;
31 import org.openide.util.NbBundle;
32 import org.openide.util.Utilities;
33 import org.openide.util.lookup.ServiceProvider;
46 @ServiceProvider(service = ContextMenuActionsProvider.class)
50 ArrayList<Action> actions =
new ArrayList<>();
55 final Collection<? extends BlackboardArtifact> selectedArts = Utilities.actionsGlobalContext().lookupAll(
BlackboardArtifact.class);
58 if (selectedArts.size() == 1) {
63 if (nodeArt.getArtifactTypeName().equals(
"TSK_EXT_MISMATCH_DETECTED")) {
64 String mimeTypeStr =
"";
76 int i = af.
getName().lastIndexOf(
".");
77 if ((i > -1) && ((i + 1) < af.
getName().length())) {
78 extStr = af.
getName().substring(i + 1).toLowerCase();
83 List<BlackboardAttribute> atrList = art.getAttributes();
86 mimeTypeStr = att.getValueString();
90 if (!mimeTypeStr.isEmpty()) {
98 if (!extStr.isEmpty() && !mimeTypeStr.isEmpty()) {
100 if (extStr.length() > 10) {
101 extStr = extStr.substring(0, 9);
103 if (mimeTypeStr.length() > 40) {
104 mimeTypeStr = mimeTypeStr.substring(0, 39);
106 String menuItemStr = NbBundle.getMessage(this.getClass(),
107 "FileExtMismatchContextMenuActionsProvider.menuItemStr",
108 extStr, mimeTypeStr);
109 actions.add(
new AddFileExtensionAction(menuItemStr, extStr, mimeTypeStr));
112 HashMap<String, String[]> editableMap = FileExtMismatchXML.getDefault().load();
113 ArrayList<String> editedExtensions =
new ArrayList<>(Arrays.asList(editableMap.get(mimeTypeStr)));
114 if (editedExtensions.contains(extStr)) {
116 actions.get(0).setEnabled(
false);
static synchronized IngestManager getInstance()
ArrayList< BlackboardArtifact > getAllArtifacts()
boolean isIngestRunning()
AbstractFile getAbstractFileById(long id)
SleuthkitCase getSleuthkitCase()
static Logger getLogger(String name)