mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 02:57:44 +00:00
FileExtMismatchConfigPanel mime and ext tables now populate.
This commit is contained in:
parent
62c836d3a0
commit
db3cf0edfa
@ -1,8 +1,8 @@
|
||||
OpenIDE-Module-Name=FileExtMismatch
|
||||
FileExtMismatchSimpleConfigPanel.skipKnownCheckBox.text=Skip Known Files
|
||||
FileExtMismatchSimpleConfigPanel.skipKnownCheckBox.toolTipText=Depending on how many files have known hashes, checking this box will improve the speed of mismatch detection.
|
||||
FileExtMismatchConfigPanel.jLabel1.text=Mime Type:
|
||||
FileExtMismatchConfigPanel.jLabel2.text=Allowed Extensions:
|
||||
FileExtMismatchConfigPanel.jLabel1.text=Files Types:
|
||||
FileExtMismatchConfigPanel.jLabel2.text=Allowed Name Extensions:
|
||||
FileExtMismatchConfigPanel.jButton1.text=Save
|
||||
FileExtMismatchConfigPanel.jTextField1.text=
|
||||
FileExtMismatchConfigPanel.jButton2.text=Add
|
||||
|
@ -23,7 +23,7 @@
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSplitPane1" max="32767" attributes="0"/>
|
||||
<Component id="jSplitPane1" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -32,8 +32,8 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSplitPane1" min="-2" pref="190" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="18" max="32767" attributes="0"/>
|
||||
<Component id="jSplitPane1" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@ -69,10 +69,10 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane2" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane2" pref="321" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="144" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="264" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@ -85,7 +85,8 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane2" pref="157" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane2" pref="311" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -102,15 +103,10 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="jTable2">
|
||||
<Component class="javax.swing.JTable" name="mimeTable">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||
<Table columnCount="4" rowCount="4">
|
||||
<Column editable="true" title="Title 1" type="java.lang.Object"/>
|
||||
<Column editable="true" title="Title 2" type="java.lang.Object"/>
|
||||
<Column editable="true" title="Title 3" type="java.lang.Object"/>
|
||||
<Column editable="true" title="Title 4" type="java.lang.Object"/>
|
||||
</Table>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="mimeTableModel" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@ -142,7 +138,7 @@
|
||||
<Component id="jButton3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="121" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="105" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@ -154,7 +150,7 @@
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane3" pref="74" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane3" pref="239" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@ -186,15 +182,10 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="jTable1">
|
||||
<Component class="javax.swing.JTable" name="extTable">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
|
||||
<Table columnCount="4" rowCount="4">
|
||||
<Column editable="true" title="Title 1" type="java.lang.Object"/>
|
||||
<Column editable="true" title="Title 2" type="java.lang.Object"/>
|
||||
<Column editable="true" title="Title 3" type="java.lang.Object"/>
|
||||
<Column editable="true" title="Title 4" type="java.lang.Object"/>
|
||||
</Table>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="extTableModel" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
|
@ -19,22 +19,59 @@
|
||||
|
||||
package org.sleuthkit.autopsy.fileextmismatch;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
/**
|
||||
* Container panel for File Extension Mismatch Ingest Module advanced configuration options
|
||||
*/
|
||||
public final class FileExtMismatchConfigPanel extends javax.swing.JPanel implements OptionsPanel {
|
||||
private static Logger logger = Logger.getLogger(FileExtMismatchConfigPanel.class.getName());
|
||||
private HashMap<String, String[]> editableMap = new HashMap<>();
|
||||
|
||||
private String[] mimeList = null;
|
||||
private String[] currentExtensions = null;
|
||||
private MimeTableModel mimeTableModel;
|
||||
private ExtTableModel extTableModel;
|
||||
|
||||
public FileExtMismatchConfigPanel() {
|
||||
mimeTableModel = new MimeTableModel();
|
||||
extTableModel = new ExtTableModel();
|
||||
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
}
|
||||
|
||||
private void customizeComponents() {
|
||||
setName("Advanced File Extension Mismatch Configuration");
|
||||
setName("Advanced File Extension Mismatch Configuration");
|
||||
final ListSelectionModel lsm = mimeTable.getSelectionModel();
|
||||
lsm.addListSelectionListener(new ListSelectionListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
ListSelectionModel listSelectionModel = (ListSelectionModel) e.getSource();
|
||||
if (!listSelectionModel.isSelectionEmpty()) {
|
||||
int index = listSelectionModel.getMinSelectionIndex();
|
||||
String selectedMime = mimeList[index];
|
||||
currentExtensions = editableMap.get(selectedMime);
|
||||
//listSelectionModel.setSelectionInterval(index, index);
|
||||
|
||||
extTableModel.resync();
|
||||
//initButtons();
|
||||
} else {
|
||||
currentExtensions = null;
|
||||
extTableModel.resync();
|
||||
//initButtons();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,12 +87,12 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
mimePanel = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
jTable2 = new javax.swing.JTable();
|
||||
mimeTable = new javax.swing.JTable();
|
||||
extensionPanel = new javax.swing.JPanel();
|
||||
jTextField1 = new javax.swing.JTextField();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jScrollPane3 = new javax.swing.JScrollPane();
|
||||
jTable1 = new javax.swing.JTable();
|
||||
extTable = new javax.swing.JTable();
|
||||
jButton3 = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
|
||||
@ -66,18 +103,8 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
|
||||
jLabel1.setText(org.openide.util.NbBundle.getMessage(FileExtMismatchConfigPanel.class, "FileExtMismatchConfigPanel.jLabel1.text")); // NOI18N
|
||||
|
||||
jTable2.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null}
|
||||
},
|
||||
new String [] {
|
||||
"Title 1", "Title 2", "Title 3", "Title 4"
|
||||
}
|
||||
));
|
||||
jScrollPane2.setViewportView(jTable2);
|
||||
mimeTable.setModel(mimeTableModel);
|
||||
jScrollPane2.setViewportView(mimeTable);
|
||||
|
||||
javax.swing.GroupLayout mimePanelLayout = new javax.swing.GroupLayout(mimePanel);
|
||||
mimePanel.setLayout(mimePanelLayout);
|
||||
@ -86,10 +113,10 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
.addGroup(mimePanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(mimePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE)
|
||||
.addGroup(mimePanelLayout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(0, 144, Short.MAX_VALUE)))
|
||||
.addGap(0, 264, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
mimePanelLayout.setVerticalGroup(
|
||||
@ -98,7 +125,8 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jSplitPane1.setLeftComponent(mimePanel);
|
||||
@ -107,18 +135,8 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
|
||||
jButton2.setText(org.openide.util.NbBundle.getMessage(FileExtMismatchConfigPanel.class, "FileExtMismatchConfigPanel.jButton2.text")); // NOI18N
|
||||
|
||||
jTable1.setModel(new javax.swing.table.DefaultTableModel(
|
||||
new Object [][] {
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null},
|
||||
{null, null, null, null}
|
||||
},
|
||||
new String [] {
|
||||
"Title 1", "Title 2", "Title 3", "Title 4"
|
||||
}
|
||||
));
|
||||
jScrollPane3.setViewportView(jTable1);
|
||||
extTable.setModel(extTableModel);
|
||||
jScrollPane3.setViewportView(extTable);
|
||||
|
||||
jButton3.setText(org.openide.util.NbBundle.getMessage(FileExtMismatchConfigPanel.class, "FileExtMismatchConfigPanel.jButton3.text")); // NOI18N
|
||||
|
||||
@ -140,7 +158,7 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
.addComponent(jButton2))
|
||||
.addComponent(jButton3)
|
||||
.addComponent(jLabel2))
|
||||
.addGap(0, 121, Short.MAX_VALUE)))
|
||||
.addGap(0, 105, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
extensionPanelLayout.setVerticalGroup(
|
||||
@ -148,7 +166,7 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, extensionPanelLayout.createSequentialGroup()
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(extensionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
@ -170,15 +188,15 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
.addGap(20, 20, 20))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jSplitPane1)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
|
||||
.addComponent(jSplitPane1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jButton1)
|
||||
.addGap(15, 15, 15))
|
||||
);
|
||||
@ -189,6 +207,7 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
// Load the XML into a buffer that the user can modify. They can choose
|
||||
// to save it back to the file after making changes.
|
||||
editableMap = FileExtMismatchXML.getDefault().load();
|
||||
mimeList = editableMap.keySet().toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -208,6 +227,7 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JTable extTable;
|
||||
private javax.swing.JPanel extensionPanel;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
@ -217,9 +237,138 @@ public final class FileExtMismatchConfigPanel extends javax.swing.JPanel impleme
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JScrollPane jScrollPane3;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JTable jTable1;
|
||||
private javax.swing.JTable jTable2;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
private javax.swing.JPanel mimePanel;
|
||||
private javax.swing.JTable mimeTable;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private class MimeTableModel extends AbstractTableModel {
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return editableMap == null ? 0 : editableMap.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column) {
|
||||
String colName = null;
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
colName = "Mime Type";
|
||||
break;
|
||||
default:
|
||||
;
|
||||
|
||||
}
|
||||
return colName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object ret = null;
|
||||
if ((mimeList == null) || (rowIndex > mimeList.length)) {
|
||||
return "";
|
||||
}
|
||||
String word = mimeList[rowIndex];
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
ret = (Object) word;
|
||||
break;
|
||||
default:
|
||||
logger.log(Level.SEVERE, "Invalid table column index: " + columnIndex);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int c) {
|
||||
return getValueAt(0, c).getClass();
|
||||
}
|
||||
|
||||
void resync() {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private class ExtTableModel extends AbstractTableModel {
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return currentExtensions == null ? 0 : currentExtensions.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column) {
|
||||
String colName = null;
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
colName = "Extension";
|
||||
break;
|
||||
default:
|
||||
;
|
||||
|
||||
}
|
||||
return colName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object ret = null;
|
||||
|
||||
if ((currentExtensions == null) || (rowIndex > currentExtensions.length)) {
|
||||
return "";
|
||||
}
|
||||
String word = currentExtensions[rowIndex];
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
ret = (Object) word;
|
||||
break;
|
||||
default:
|
||||
logger.log(Level.SEVERE, "Invalid table column index: " + columnIndex);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int c) {
|
||||
return getValueAt(0, c).getClass();
|
||||
}
|
||||
|
||||
void resync() {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user