mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Additions to user-defined types feature
This commit is contained in:
parent
401c725f67
commit
6e9c22032b
@ -110,7 +110,7 @@ final class FileType {
|
|||||||
* Creates a file signature consisting of a sequence of bytes at a
|
* Creates a file signature consisting of a sequence of bytes at a
|
||||||
* specific offset within a file.
|
* specific offset within a file.
|
||||||
*
|
*
|
||||||
* @param signatureBytes The signature bytes
|
* @param signatureBytes The signature bytes.
|
||||||
* @param offset The offset of the signature bytes.
|
* @param offset The offset of the signature bytes.
|
||||||
* @param type The interpretation of the signature bytes (e.g., raw
|
* @param type The interpretation of the signature bytes (e.g., raw
|
||||||
* bytes, an ASCII string).
|
* bytes, an ASCII string).
|
||||||
|
@ -50,14 +50,10 @@
|
|||||||
<Component id="signatureLabel" min="-2" max="-2" attributes="0"/>
|
<Component id="signatureLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="hexPrefixLabel" min="-2" max="-2" attributes="0"/>
|
<Component id="hexPrefixLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="offsetLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="44" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
|
<Component id="offsetLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="offsetTextField" min="-2" pref="84" max="-2" attributes="0"/>
|
<Component id="offsetTextField" min="-2" pref="84" max="-2" attributes="0"/>
|
||||||
<Component id="signatureTextField" min="-2" pref="178" max="-2" attributes="0"/>
|
<Component id="signatureTextField" min="-2" pref="178" max="-2" attributes="0"/>
|
||||||
@ -121,18 +117,13 @@
|
|||||||
<Component id="postHitCheckBox" min="-2" max="-2" attributes="0"/>
|
<Component id="postHitCheckBox" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
<Component id="newTypeButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Component id="deleteTypeButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="newTypeButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="deleteTypeButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="saveTypeButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
|
<Component id="saveTypeButton" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="jSeparator1" min="-2" pref="260" max="-2" attributes="0"/>
|
<Component id="jSeparator1" min="-2" pref="260" max="-2" attributes="0"/>
|
||||||
|
@ -35,7 +35,9 @@ import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
|
|||||||
import org.sleuthkit.autopsy.modules.filetypeid.FileType.Signature;
|
import org.sleuthkit.autopsy.modules.filetypeid.FileType.Signature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A panel to allow a user to make custom file type definitions.
|
* A panel to allow a user to make custom file type definitions. In addition to
|
||||||
|
* being an ingest module global settings panel, an instance of this class also
|
||||||
|
* appears in the NetBeans options dialog as an options panel.
|
||||||
*/
|
*/
|
||||||
final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
|
final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
|
||||||
|
|
||||||
@ -44,10 +46,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* These two fields are used to synthesize default names for user-defined
|
* These two fields are used to synthesize default names for user-defined
|
||||||
* types. This is a thread-safe implementation because there can be two
|
* types. This is a thread-safe implementation. All interactions with
|
||||||
* instances of this panel at the same time due to the non-modal nature of
|
|
||||||
* the NetBeans options window and the fact that these panels can also be
|
|
||||||
* invoked via ingest job configuration panels. All interactions with
|
|
||||||
* instances of this panel should occur on the EDT, so this is defensive
|
* instances of this panel should occur on the EDT, so this is defensive
|
||||||
* programming.
|
* programming.
|
||||||
*/
|
*/
|
||||||
@ -55,11 +54,12 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
private static final AtomicInteger defaultTypeNameCounter = new AtomicInteger(1);
|
private static final AtomicInteger defaultTypeNameCounter = new AtomicInteger(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This mapping of file type names to file types is used to hold the types
|
* The list model for the file types list component of this panel is the set
|
||||||
* displayed in the file types list component via its list model.
|
* of type names of the user-defined file types. A mapping of the file type
|
||||||
|
* names to file type objects completes the model.
|
||||||
*/
|
*/
|
||||||
private Map<String, FileType> fileTypes;
|
|
||||||
private DefaultListModel<String> typesListModel;
|
private DefaultListModel<String> typesListModel;
|
||||||
|
private Map<String, FileType> fileTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a panel to allow a user to make custom file type definitions.
|
* Creates a panel to allow a user to make custom file type definitions.
|
||||||
@ -70,8 +70,8 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does component initialization in addition to the the Matisse generated
|
* Does child component initialization in addition to the the Matisse
|
||||||
* initialization.
|
* generated initialization.
|
||||||
*/
|
*/
|
||||||
private void customizeComponents() {
|
private void customizeComponents() {
|
||||||
/**
|
/**
|
||||||
@ -79,14 +79,14 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
*/
|
*/
|
||||||
this.typesListModel = new DefaultListModel<>();
|
this.typesListModel = new DefaultListModel<>();
|
||||||
this.typesList.setModel(this.typesListModel);
|
this.typesList.setModel(this.typesListModel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a model for the signature type combo box component.
|
* Make a model for the signature type combo box component.
|
||||||
*/
|
*/
|
||||||
DefaultComboBoxModel<String> sigTypeComboBoxModel = new DefaultComboBoxModel<>();
|
DefaultComboBoxModel<String> sigTypeComboBoxModel = new DefaultComboBoxModel<>();
|
||||||
sigTypeComboBoxModel.addElement(FileTypeIdGlobalSettingsPanel.RAW_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
sigTypeComboBoxModel.addElement(FileTypeIdGlobalSettingsPanel.RAW_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
||||||
sigTypeComboBoxModel.addElement(FileTypeIdGlobalSettingsPanel.ASCII_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
sigTypeComboBoxModel.addElement(FileTypeIdGlobalSettingsPanel.ASCII_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
||||||
this.signatureTypeComboBox.setModel(sigTypeComboBoxModel);
|
this.signatureTypeComboBox.setModel(sigTypeComboBoxModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +98,8 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the child components.
|
* Populates the child components with file types obtained from the
|
||||||
|
* user-defined file types manager.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
@ -413,11 +414,11 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
signatureBytes = sigString.getBytes(Charset.forName("UTF-8"));
|
signatureBytes = sigString.getBytes(Charset.forName("UTF-8"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the offset.
|
* Get the offset.
|
||||||
*/
|
*/
|
||||||
long offset = Long.parseUnsignedLong(this.offsetTextField.getText());
|
long offset = Long.parseUnsignedLong(this.offsetTextField.getText());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put it all together and reset the file types list component.
|
* Put it all together and reset the file types list component.
|
||||||
*/
|
*/
|
||||||
@ -426,17 +427,17 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
this.fileTypes.put(typeName, fileType);
|
this.fileTypes.put(typeName, fileType);
|
||||||
this.setFileTypesListModel();
|
this.setFileTypesListModel();
|
||||||
this.typesList.setSelectedValue(fileType.getTypeName(), true);
|
this.typesList.setSelectedValue(fileType.getTypeName(), true);
|
||||||
|
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.message"),
|
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.message"),
|
||||||
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.title"),
|
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidOffset.title"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidSignatureBytes.message"),
|
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidSignatureBytes.message"),
|
||||||
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidSignatureBytes.title"),
|
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidSignatureBytes.title"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_saveTypeButtonActionPerformed
|
}//GEN-LAST:event_saveTypeButtonActionPerformed
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user