mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-11 23:46:15 +00:00
TSK-263: Be capable of searching file names of 'known files'
Also remove state tracking of KW lists from panels, have them rely on KeywordSearchListsXML entirely
This commit is contained in:
parent
b985d61457
commit
3abef13f6d
@ -50,3 +50,5 @@ ExtractedContentPanel.pageTotalLabel.text=-
|
||||
ExtractedContentPanel.hitLabel.toolTipText=
|
||||
KeywordSearchEditListPanel.ingestMessagesCheckbox.text=Send messages during triage / ingest
|
||||
KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText=Send messages during triage / ingest when hits on keyword from this list occur
|
||||
KeywordSearchIngestSimplePanel.skipKnownCheckBox.text=Skip files in NSRL
|
||||
KeywordSearchIngestSimplePanel.skipKnownCheckBox.toolTipText=Please make sure you have either selected to run or have previously run the Hash DB Ingest Service.
|
||||
|
@ -122,7 +122,6 @@ public class KeywordSearchConfigurationPanel extends javax.swing.JPanel {
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
void save() {
|
||||
editListPanel.save();
|
||||
KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent();
|
||||
KeywordSearchIngestService service = KeywordSearchIngestService.getDefault();
|
||||
if (IngestManager.getDefault().isServiceRunning(service)) {
|
||||
|
@ -280,6 +280,9 @@
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ingestMessagesCheckboxActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
@ -27,10 +27,7 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
@ -58,11 +55,10 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
private static Logger logger = Logger.getLogger(KeywordSearchEditListPanel.class.getName());
|
||||
private KeywordTableModel tableModel;
|
||||
private String currentKeywordList;
|
||||
private KeywordSearchList currentKeywordList;
|
||||
|
||||
|
||||
private boolean ingestRunning;
|
||||
private boolean locked;
|
||||
private static KeywordSearchEditListPanel instance = null;
|
||||
|
||||
/** Creates new form KeywordSearchEditListPanel */
|
||||
@ -81,11 +77,11 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
|
||||
private void customizeComponents() {
|
||||
locked = false;
|
||||
chRegex.setToolTipText("Keyword is a regular expression");
|
||||
addWordButton.setToolTipText(("Add a new word to the keyword search list"));
|
||||
addWordField.setToolTipText("Enter a new word or regex to search");
|
||||
saveListButton.setToolTipText("Save the current keyword list to a file");
|
||||
exportButton.setToolTipText("Export the current keyword list to a file");
|
||||
saveListButton.setToolTipText("Save the current keyword list with a new name");
|
||||
deleteWordButton.setToolTipText("Remove selected keyword(s) from the list");
|
||||
|
||||
//keywordTable.setAutoscrolls(true);
|
||||
@ -115,7 +111,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if (lsm.isSelectionEmpty() || locked) {
|
||||
if (lsm.isSelectionEmpty() || currentKeywordList.isLocked()) {
|
||||
deleteWordButton.setEnabled(false);
|
||||
} else {
|
||||
deleteWordButton.setEnabled(true);
|
||||
@ -124,7 +120,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
//show selector if available
|
||||
DefaultListSelectionModel selModel = (DefaultListSelectionModel) e.getSource();
|
||||
if (!selModel.getValueIsAdjusting()) {
|
||||
List<Keyword> keywords = tableModel.getAllKeywords();
|
||||
List<Keyword> keywords = currentKeywordList.getKeywords();
|
||||
final int minIndex = selModel.getMinSelectionIndex();
|
||||
final int maxIndex = selModel.getMaxSelectionIndex();
|
||||
int selected = -1;
|
||||
@ -239,24 +235,29 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
// Certain buttons will be disabled if ingest is ongoing
|
||||
boolean ingestOngoing = this.ingestRunning;
|
||||
// Certain buttons will be disabled if ingest is ongoing on this list
|
||||
boolean inIngest = false;
|
||||
boolean useForIngest = !listSet ? false : currentKeywordList.getUseForIngest();
|
||||
// Certain buttons will be disabled if the list shouldn't send ingest messages
|
||||
boolean sendIngestMessages = !listSet ? false : currentKeywordList.getIngestMessages();
|
||||
// Certain buttons will be disabled if the selected list is locked
|
||||
boolean isLocked = this.locked;
|
||||
boolean isLocked = !listSet ? true : currentKeywordList.isLocked();
|
||||
// Certain buttons will be disabled if no keywords are set
|
||||
boolean noKeywords = getAllKeywords().isEmpty();
|
||||
boolean noKeywords = !listSet ? true : currentKeywordList.getKeywords().isEmpty();
|
||||
|
||||
// Certain buttons will be disabled if ingest is ongoing on this list
|
||||
List<String> ingestLists = new ArrayList<String>();
|
||||
if (ingestOngoing) {
|
||||
ingestLists = KeywordSearchIngestService.getDefault().getKeywordLists();
|
||||
}
|
||||
inIngest = ingestLists.contains(currentKeywordList);
|
||||
boolean inIngest = !listSet ? false : ingestLists.contains(currentKeywordList.getName());
|
||||
|
||||
addWordButton.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked);
|
||||
addWordField.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked);
|
||||
chRegex.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked);
|
||||
selectorsCombo.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked && chRegex.isSelected());
|
||||
useForIngestCheckbox.setEnabled(listSet && (!ingestOngoing || !inIngest));
|
||||
useForIngestCheckbox.setSelected(useForIngest);
|
||||
ingestMessagesCheckbox.setEnabled(useForIngestCheckbox.isEnabled() && useForIngestCheckbox.isSelected());
|
||||
ingestMessagesCheckbox.setSelected(sendIngestMessages);
|
||||
saveListButton.setEnabled(listSet);
|
||||
exportButton.setEnabled(listSet);
|
||||
deleteListButton.setEnabled(listSet && (!ingestOngoing || !inIngest) && !isLocked);
|
||||
@ -398,6 +399,11 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
ingestMessagesCheckbox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.text")); // NOI18N
|
||||
ingestMessagesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.ingestMessagesCheckbox.toolTipText")); // NOI18N
|
||||
ingestMessagesCheckbox.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
ingestMessagesCheckboxActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout listEditorPanelLayout = new javax.swing.GroupLayout(listEditorPanel);
|
||||
listEditorPanel.setLayout(listEditorPanelLayout);
|
||||
@ -500,7 +506,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
if (newWord.equals("")) {
|
||||
return;
|
||||
} else if (keywordExists(keyword)) {
|
||||
} else if (currentKeywordList.hasKeyword(keyword)) {
|
||||
KeywordSearchUtil.displayDialog("New Keyword Entry", "Keyword already exists in the list.", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
return;
|
||||
}
|
||||
@ -532,7 +538,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
final String FEATURE_NAME = "Save Keyword List";
|
||||
KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent();
|
||||
|
||||
List<Keyword> keywords = tableModel.getAllKeywords();
|
||||
List<Keyword> keywords = currentKeywordList.getKeywords();
|
||||
if (keywords.isEmpty()) {
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword List is empty and cannot be saved", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
return;
|
||||
@ -570,7 +576,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
writer.addList(listName, keywords);
|
||||
}
|
||||
|
||||
currentKeywordList = listName;
|
||||
currentKeywordList = writer.getList(listName);
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword List <" + listName + "> saved", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
|
||||
}//GEN-LAST:event_saveListButtonActionPerformed
|
||||
@ -585,7 +591,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
}//GEN-LAST:event_addWordFieldActionPerformed
|
||||
|
||||
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
|
||||
save();
|
||||
|
||||
final String FEATURE_NAME = "Keyword List Export";
|
||||
|
||||
@ -594,7 +599,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
FileNameExtensionFilter filter = new FileNameExtensionFilter(
|
||||
"Keyword List XML file", EXTENSION);
|
||||
chooser.setFileFilter(filter);
|
||||
chooser.setSelectedFile(new File(currentKeywordList));
|
||||
chooser.setSelectedFile(new File(currentKeywordList.getName()));
|
||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
|
||||
int returnVal = chooser.showSaveDialog(this);
|
||||
@ -623,7 +628,7 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
KeywordSearchListsXML reader = KeywordSearchListsXML.getCurrent();
|
||||
|
||||
List<KeywordSearchList> toWrite = new ArrayList<KeywordSearchList>();
|
||||
toWrite.add(reader.getList(currentKeywordList));
|
||||
toWrite.add(reader.getList(currentKeywordList.getName()));
|
||||
final KeywordSearchListsXML exporter = new KeywordSearchListsXML(fileAbs);
|
||||
boolean written = exporter.writeLists(toWrite);
|
||||
if (written) {
|
||||
@ -635,11 +640,11 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
private void deleteListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteListButtonActionPerformed
|
||||
KeywordSearchListsXML deleter = KeywordSearchListsXML.getCurrent();
|
||||
String toDelete = currentKeywordList;
|
||||
String toDelete = currentKeywordList.getName();
|
||||
currentKeywordList = null;
|
||||
tableModel.deleteAll();
|
||||
initButtons();
|
||||
deleter.deleteList(toDelete);
|
||||
tableModel.resync();
|
||||
}//GEN-LAST:event_deleteListButtonActionPerformed
|
||||
|
||||
private void chRegexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chRegexActionPerformed
|
||||
@ -648,8 +653,13 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useForIngestCheckboxActionPerformed
|
||||
ingestMessagesCheckbox.setEnabled(useForIngestCheckbox.isSelected());
|
||||
currentKeywordList.setUseForIngest(useForIngestCheckbox.isSelected());
|
||||
}//GEN-LAST:event_useForIngestCheckboxActionPerformed
|
||||
|
||||
private void ingestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestMessagesCheckboxActionPerformed
|
||||
currentKeywordList.setIngestMessages(ingestMessagesCheckbox.isSelected());
|
||||
}//GEN-LAST:event_ingestMessagesCheckboxActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel addKeywordPanel;
|
||||
private javax.swing.JButton addWordButton;
|
||||
@ -679,66 +689,23 @@ private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt)
|
||||
ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
|
||||
if (!listSelectionModel.isSelectionEmpty()) {
|
||||
int index = listSelectionModel.getMinSelectionIndex();
|
||||
KeywordSearchListsManagementPanel listsPanel = KeywordSearchListsManagementPanel.getDefault();
|
||||
|
||||
save();
|
||||
listSelectionModel.setSelectionInterval(index, index);
|
||||
currentKeywordList = listsPanel.getAllLists().get(index);
|
||||
KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent();
|
||||
|
||||
KeywordSearchList currentList = loader.getList(currentKeywordList);
|
||||
if (currentList != null) {
|
||||
locked = currentList.isLocked();
|
||||
}
|
||||
tableModel.resync(currentKeywordList);
|
||||
currentKeywordList = loader.getListsL().get(index);
|
||||
tableModel.resync();
|
||||
initButtons();
|
||||
} else {
|
||||
currentKeywordList = null;
|
||||
tableModel.deleteAll();
|
||||
initButtons();
|
||||
}
|
||||
}
|
||||
|
||||
List<Keyword> getAllKeywords() {
|
||||
return tableModel.getAllKeywords();
|
||||
}
|
||||
|
||||
List<Keyword> getSelectedKeywords() {
|
||||
return tableModel.getSelectedKeywords(keywordTable.getSelectedRows());
|
||||
}
|
||||
|
||||
private boolean keywordExists(Keyword keyword) {
|
||||
return tableModel.keywordExists(keyword);
|
||||
}
|
||||
|
||||
void save() {
|
||||
if (currentKeywordList != null && !currentKeywordList.equals("")) {
|
||||
KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent();
|
||||
KeywordSearchList oldList = loader.getList(currentKeywordList);
|
||||
List<Keyword> oldKeywords = oldList.getKeywords();
|
||||
boolean oldIngest = oldList.getUseForIngest();
|
||||
boolean oldIngestMessages = oldList.getIngestMessages();
|
||||
List<Keyword> newKeywords = getAllKeywords();
|
||||
boolean newIngest = useForIngestCheckbox.isSelected();
|
||||
boolean newIngestMessages = ingestMessagesCheckbox.isSelected();
|
||||
|
||||
if (!oldKeywords.equals(newKeywords) || oldIngest != newIngest || oldIngestMessages != newIngestMessages) {
|
||||
/*boolean save = KeywordSearchUtil.displayConfirmDialog("Save List Changes",
|
||||
"Do you want to save the changes you made to list " + currentKeywordList + "?",
|
||||
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);*/
|
||||
boolean save = true;
|
||||
if (save) {
|
||||
loader.addList(currentKeywordList, newKeywords, newIngest, newIngestMessages, oldList.isLocked());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class KeywordTableModel extends AbstractTableModel {
|
||||
//data
|
||||
|
||||
private Set<TableEntry> keywordData = new TreeSet<TableEntry>();
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 2;
|
||||
@ -746,7 +713,7 @@ private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt)
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return keywordData.size();
|
||||
return currentKeywordList == null ? 0 : currentKeywordList.getKeywords().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -770,18 +737,13 @@ private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt)
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object ret = null;
|
||||
TableEntry entry = null;
|
||||
//iterate until row
|
||||
Iterator<TableEntry> it = keywordData.iterator();
|
||||
for (int i = 0; i <= rowIndex; ++i) {
|
||||
entry = it.next();
|
||||
}
|
||||
Keyword word = currentKeywordList.getKeywords().get(rowIndex);
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
ret = (Object) entry.keyword.getQuery();
|
||||
ret = (Object) word.getQuery();
|
||||
break;
|
||||
case 1:
|
||||
ret = (Object) !entry.keyword.isLiteral();
|
||||
ret = (Object) !word.isLiteral();
|
||||
break;
|
||||
default:
|
||||
logger.log(Level.SEVERE, "Invalid table column index: " + columnIndex);
|
||||
@ -804,95 +766,24 @@ private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt)
|
||||
return getValueAt(0, c).getClass();
|
||||
}
|
||||
|
||||
List<Keyword> getAllKeywords() {
|
||||
List<Keyword> ret = new ArrayList<Keyword>();
|
||||
for (TableEntry e : keywordData) {
|
||||
ret.add(e.keyword);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
List<Keyword> getSelectedKeywords(int[] selected) {
|
||||
List<Keyword> ret = new ArrayList<Keyword>();
|
||||
Keyword[] in = keywordData.toArray(new Keyword[keywordData.size()]);
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
ret.add(in[selected[i]]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
boolean keywordExists(Keyword keyword) {
|
||||
List<Keyword> all = getAllKeywords();
|
||||
return all.contains(keyword);
|
||||
}
|
||||
|
||||
void addKeyword(Keyword keyword) {
|
||||
if (!keywordExists(keyword)) {
|
||||
keywordData.add(new TableEntry(keyword));
|
||||
if(!currentKeywordList.hasKeyword(keyword)) {
|
||||
currentKeywordList.getKeywords().add(keyword);
|
||||
}
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
void addKeywords(List<Keyword> keywords) {
|
||||
for (Keyword keyword : keywords) {
|
||||
if (!keywordExists(keyword)) {
|
||||
keywordData.add(new TableEntry(keyword));
|
||||
}
|
||||
}
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
void resync(String listName) {
|
||||
KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent();
|
||||
KeywordSearchList list = loader.getList(listName);
|
||||
List<Keyword> keywords = list.getKeywords();
|
||||
|
||||
deleteAll();
|
||||
addKeywords(keywords);
|
||||
boolean useForIngest = list.getUseForIngest();
|
||||
useForIngestCheckbox.setSelected(useForIngest);
|
||||
ingestMessagesCheckbox.setEnabled(useForIngest);
|
||||
ingestMessagesCheckbox.setSelected(list.getIngestMessages());
|
||||
}
|
||||
|
||||
void deleteAll() {
|
||||
keywordData.clear();
|
||||
void resync() {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
//delete selected from handle, events are fired from the handle
|
||||
void deleteSelected(int[] selected) {
|
||||
List<TableEntry> toDel = new ArrayList<TableEntry>();
|
||||
TableEntry [] in = keywordData.toArray(new TableEntry[keywordData.size()]);
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
Keyword word = in[selected[i]].keyword;
|
||||
toDel.add(new TableEntry(word));
|
||||
}
|
||||
for (TableEntry del : toDel) {
|
||||
keywordData.remove(del);
|
||||
}
|
||||
fireTableDataChanged();
|
||||
|
||||
List<Keyword> keywords = currentKeywordList.getKeywords();
|
||||
keywords.remove(selected[0]);
|
||||
resync();
|
||||
}
|
||||
|
||||
class TableEntry implements Comparable<TableEntry> {
|
||||
|
||||
Keyword keyword;
|
||||
|
||||
TableEntry(Keyword keyword) {
|
||||
this.keyword = keyword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TableEntry te) {
|
||||
int keywords = this.keyword.getQuery().compareTo(te.keyword.getQuery());
|
||||
if (keywords != 0) {
|
||||
return keywords;
|
||||
} else {
|
||||
return Boolean.valueOf(keyword.isLiteral()).compareTo(te.keyword.isLiteral());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CheckBoxRenderer extends JCheckBox implements TableCellRenderer {
|
||||
|
@ -78,6 +78,7 @@ public final class KeywordSearchIngestService implements IngestServiceAbstractFi
|
||||
private volatile boolean finalSearcherDone = false;
|
||||
private final String hashDBServiceName = "Hash Lookup";
|
||||
private SleuthkitCase caseHandle = null;
|
||||
private boolean skipKnown = false;
|
||||
boolean initialized = false;
|
||||
|
||||
public enum IngestStatus {
|
||||
@ -105,7 +106,7 @@ public final class KeywordSearchIngestService implements IngestServiceAbstractFi
|
||||
//if so do not index it, also postpone indexing and keyword search threads to later
|
||||
IngestServiceAbstractFile.ProcessResult hashDBResult = managerProxy.getAbstractFileServiceResult(hashDBServiceName);
|
||||
//logger.log(Level.INFO, "hashdb result: " + hashDBResult + "file: " + AbstractFile.getName());
|
||||
if (hashDBResult == IngestServiceAbstractFile.ProcessResult.COND_STOP) {
|
||||
if (hashDBResult == IngestServiceAbstractFile.ProcessResult.COND_STOP && skipKnown) {
|
||||
return ProcessResult.OK;
|
||||
} else if (hashDBResult == IngestServiceAbstractFile.ProcessResult.ERROR) {
|
||||
//notify depending service that keyword search (would) encountered error for this file
|
||||
@ -275,7 +276,6 @@ public final class KeywordSearchIngestService implements IngestServiceAbstractFi
|
||||
|
||||
@Override
|
||||
public void saveAdvancedConfiguration() {
|
||||
KeywordSearchConfigurationPanel.getDefault().editListPanel.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -760,4 +760,8 @@ public final class KeywordSearchIngestService implements IngestServiceAbstractFi
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void setSkipKnown(boolean skip) {
|
||||
this.skipKnown = skip;
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,16 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSeparator1" alignment="0" pref="172" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator1" alignment="0" pref="295" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="133" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jSeparator2" alignment="1" pref="295" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="skipKnownCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="listsScrollPane" alignment="0" min="0" pref="0" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
@ -36,8 +41,13 @@
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator1" min="-2" pref="4" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="listsScrollPane" pref="118" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator2" min="-2" max="-2" attributes="1"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="skipKnownCheckBox" min="-2" max="-2" attributes="1"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="listsScrollPane" pref="33" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -80,5 +90,20 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSeparator1">
|
||||
</Component>
|
||||
<Component class="javax.swing.JSeparator" name="jSeparator2">
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="skipKnownCheckBox">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchIngestSimplePanel.skipKnownCheckBox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchIngestSimplePanel.skipKnownCheckBox.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="skipKnownCheckBoxActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -81,6 +81,8 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
|
||||
listsTable = new javax.swing.JTable();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jSeparator1 = new javax.swing.JSeparator();
|
||||
jSeparator2 = new javax.swing.JSeparator();
|
||||
skipKnownCheckBox = new javax.swing.JCheckBox();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(172, 57));
|
||||
|
||||
@ -101,15 +103,27 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
|
||||
|
||||
jLabel1.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.jLabel1.text")); // NOI18N
|
||||
|
||||
skipKnownCheckBox.setText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.skipKnownCheckBox.text")); // NOI18N
|
||||
skipKnownCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(KeywordSearchIngestSimplePanel.class, "KeywordSearchIngestSimplePanel.skipKnownCheckBox.toolTipText")); // NOI18N
|
||||
skipKnownCheckBox.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
skipKnownCheckBoxActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(133, Short.MAX_VALUE))
|
||||
.addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(skipKnownCheckBox)
|
||||
.addContainerGap())
|
||||
.addComponent(listsScrollPane, 0, 0, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
@ -118,15 +132,27 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 4, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(listsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(listsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(skipKnownCheckBox)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void skipKnownCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipKnownCheckBoxActionPerformed
|
||||
KeywordSearchIngestService.getDefault().setSkipKnown(skipKnownCheckBox.isSelected());
|
||||
}//GEN-LAST:event_skipKnownCheckBoxActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JSeparator jSeparator1;
|
||||
private javax.swing.JSeparator jSeparator2;
|
||||
private javax.swing.JScrollPane listsScrollPane;
|
||||
private javax.swing.JTable listsTable;
|
||||
private javax.swing.JCheckBox skipKnownCheckBox;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private void reloadLists() {
|
||||
@ -163,6 +189,7 @@ public class KeywordSearchIngestSimplePanel extends javax.swing.JPanel {
|
||||
|
||||
@Override
|
||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||
|
||||
KeywordSearchList list = KeywordSearchIngestSimplePanel.this.lists.get(rowIndex);
|
||||
if(columnIndex == 0){
|
||||
KeywordSearchListsXML loader = KeywordSearchListsXML.getCurrent();
|
||||
|
@ -81,29 +81,6 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
listsTable.setRowSelectionAllowed(true);
|
||||
tableModel.resync();
|
||||
|
||||
KeywordSearchListsXML.getCurrent().addPropertyChangeListener(new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals(KeywordSearchListsXML.ListsEvt.LIST_ADDED.toString())) {
|
||||
tableModel.resync();
|
||||
for(int i = 0; i<listsTable.getRowCount(); i++){
|
||||
String name = (String) listsTable.getValueAt(i, 0);
|
||||
if(((String) evt.getNewValue()).equals(name))
|
||||
listsTable.getSelectionModel().setSelectionInterval(i, i);
|
||||
}
|
||||
} else if (evt.getPropertyName().equals(KeywordSearchListsXML.ListsEvt.LIST_DELETED.toString())) {
|
||||
tableModel.resync();
|
||||
if(listsTable.getRowCount() > 0)
|
||||
listsTable.getSelectionModel().setSelectionInterval(0, 0);
|
||||
else
|
||||
listsTable.getSelectionModel().clearSelection();
|
||||
} else if (evt.getPropertyName().equals(KeywordSearchListsXML.ListsEvt.LIST_UPDATED.toString())) {
|
||||
tableModel.resync((String) evt.getNewValue()); //changed list name
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
@ -173,7 +150,6 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void newListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newListButtonActionPerformed
|
||||
KeywordSearchEditListPanel.getDefault().save();
|
||||
KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent();
|
||||
String listName = (String) JOptionPane.showInputDialog(null, "New keyword list name:", "New Keyword List", JOptionPane.PLAIN_MESSAGE, null, null, "");
|
||||
if (listName == null || listName.trim().equals("")) {
|
||||
@ -199,7 +175,6 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
}//GEN-LAST:event_newListButtonActionPerformed
|
||||
|
||||
private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed
|
||||
KeywordSearchEditListPanel.getDefault().save();
|
||||
final String FEATURE_NAME = "Keyword List Import";
|
||||
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
@ -280,7 +255,6 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
//data
|
||||
|
||||
private KeywordSearchListsXML listsHandle = KeywordSearchListsXML.getCurrent();
|
||||
private Set<TableEntry> listData = new TreeSet<TableEntry>();
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
@ -289,7 +263,7 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return listData.size();
|
||||
return listsHandle.getNumberLists();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -299,13 +273,7 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
TableEntry entry = null;
|
||||
//iterate until row
|
||||
Iterator<TableEntry> it = listData.iterator();
|
||||
for (int i = 0; i <= rowIndex; ++i) {
|
||||
entry = it.next();
|
||||
}
|
||||
return (Object) entry.name;
|
||||
return listsHandle.getListNames().get(rowIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -323,27 +291,6 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
return getValueAt(0, c).getClass();
|
||||
}
|
||||
|
||||
List<String> getAllLists() {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for (TableEntry e : listData) {
|
||||
ret.add(e.name);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
List<String> getSelectedLists(int[] selected) {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
for(int i = 0; i < selected.length; i++){
|
||||
ret.add((String) getValueAt(0, selected[i]));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
boolean listExists(String list) {
|
||||
List<String> all = getAllLists();
|
||||
return all.contains(list);
|
||||
}
|
||||
|
||||
//delete selected from handle, events are fired from the handle
|
||||
void deleteSelected(int[] selected) {
|
||||
List<String> toDel = new ArrayList<String>();
|
||||
@ -353,68 +300,15 @@ class KeywordSearchListsManagementPanel extends javax.swing.JPanel {
|
||||
for (String del : toDel) {
|
||||
listsHandle.deleteList(del);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//resync model from handle, then update table
|
||||
void resync() {
|
||||
listData.clear();
|
||||
addLists(listsHandle.getListsL());
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
//resync single model entry from handle
|
||||
void resync(String listName) {
|
||||
TableEntry found = null;
|
||||
for (TableEntry e : listData) {
|
||||
if (e.name.equals(listName)) {
|
||||
found = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found != null) {
|
||||
listData.remove(found);
|
||||
addList(listsHandle.getList(listName));
|
||||
}
|
||||
}
|
||||
|
||||
//add list to the model
|
||||
private void addList(KeywordSearchList list) {
|
||||
if (!listExists(list.getName())) {
|
||||
listData.add(new TableEntry(list));
|
||||
}
|
||||
}
|
||||
|
||||
//add lists to the model
|
||||
private void addLists(List<KeywordSearchList> lists) {
|
||||
for (KeywordSearchList list : lists) {
|
||||
if (!listExists(list.getName())) {
|
||||
listData.add(new TableEntry(list));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//single model entry
|
||||
class TableEntry implements Comparable<TableEntry> {
|
||||
|
||||
String name;
|
||||
|
||||
TableEntry(KeywordSearchList list) {
|
||||
this.name = list.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TableEntry te) {
|
||||
return this.name.compareTo(te.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void addListSelectionListener(ListSelectionListener l) {
|
||||
listsTable.getSelectionModel().addListSelectionListener(l);
|
||||
}
|
||||
|
||||
List<String> getAllLists() {
|
||||
return tableModel.getAllLists();
|
||||
}
|
||||
}
|
||||
|
@ -267,12 +267,7 @@ public class KeywordSearchListsXML {
|
||||
}
|
||||
|
||||
boolean addList(String name, List<Keyword> newList, boolean useForIngest, boolean ingestMessages) {
|
||||
KeywordSearchList curList = getList(name);
|
||||
if (curList == null) {
|
||||
return addList(name, newList, useForIngest, ingestMessages, false);
|
||||
} else {
|
||||
return addList(name, newList, curList.getUseForIngest(), ingestMessages, false);
|
||||
}
|
||||
return addList(name, newList, useForIngest, ingestMessages, false);
|
||||
}
|
||||
|
||||
boolean addList(String name, List<Keyword> newList) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user