mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Merge pull request #1635 from mhmdfy/multi-sig-mime-type
Multi sig mime type
This commit is contained in:
commit
5f5944098d
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.modules.filetypeid;
|
|||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
@ -103,6 +104,29 @@ class FileType {
|
|||||||
String getFilesSetName() {
|
String getFilesSetName() {
|
||||||
return interestingFilesSetName;
|
return interestingFilesSetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if(other != null && other instanceof FileType) {
|
||||||
|
FileType that = (FileType) other;
|
||||||
|
if(this.getMimeType().equals(that.getMimeType()) && this.getSignature().equals(that.getSignature()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 67 * hash + Objects.hashCode(this.mimeType);
|
||||||
|
hash = 67 * hash + Objects.hashCode(this.signature);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A file signature consisting of a sequence of bytes at a specific offset
|
* A file signature consisting of a sequence of bytes at a specific offset
|
||||||
@ -221,6 +245,27 @@ class FileType {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (other != null && other instanceof Signature) {
|
||||||
|
Signature that = (Signature) other;
|
||||||
|
if(Arrays.equals(this.getSignatureBytes(), that.getSignatureBytes())
|
||||||
|
&& this.getOffset() == that.getOffset()
|
||||||
|
&& this.getType().equals(that.getType()))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 3;
|
||||||
|
hash = 97 * hash + Arrays.hashCode(this.signatureBytes);
|
||||||
|
hash = 97 * hash + (int) (this.offset ^ (this.offset >>> 32));
|
||||||
|
hash = 97 * hash + Objects.hashCode(this.type);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.sleuthkit.autopsy.modules.filetypeid;
|
package org.sleuthkit.autopsy.modules.filetypeid;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import org.apache.tika.Tika;
|
import org.apache.tika.Tika;
|
||||||
@ -38,15 +39,14 @@ public class FileTypeDetector {
|
|||||||
private static final Tika tika = new Tika();
|
private static final Tika tika = new Tika();
|
||||||
private static final int BUFFER_SIZE = 64 * 1024;
|
private static final int BUFFER_SIZE = 64 * 1024;
|
||||||
private final byte buffer[] = new byte[BUFFER_SIZE];
|
private final byte buffer[] = new byte[BUFFER_SIZE];
|
||||||
private final Map<String, FileType> userDefinedFileTypes;
|
private final List<FileType> userDefinedFileTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an object that detects the type of a file by an inspection of
|
* Constructs an object that detects the type of a file by an inspection of
|
||||||
* its contents.
|
* its contents.
|
||||||
*
|
*
|
||||||
* @throws FileTypeDetector.FileTypeDetectorInitException if an
|
* @throws FileTypeDetector.FileTypeDetectorInitException if an
|
||||||
* initialization
|
* initialization error occurs.
|
||||||
* error occurs.
|
|
||||||
*/
|
*/
|
||||||
public FileTypeDetector() throws FileTypeDetectorInitException {
|
public FileTypeDetector() throws FileTypeDetectorInitException {
|
||||||
try {
|
try {
|
||||||
@ -77,7 +77,12 @@ public class FileTypeDetector {
|
|||||||
* @return True if MIME type is detectable.
|
* @return True if MIME type is detectable.
|
||||||
*/
|
*/
|
||||||
private boolean isDetectableAsUserDefinedType(String mimeType) {
|
private boolean isDetectableAsUserDefinedType(String mimeType) {
|
||||||
return userDefinedFileTypes.containsKey(mimeType);
|
for (FileType fileType : userDefinedFileTypes) {
|
||||||
|
if (fileType.getMimeType().equals(mimeType)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,7 +221,7 @@ public class FileTypeDetector {
|
|||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
private String detectUserDefinedType(AbstractFile file) throws TskCoreException {
|
private String detectUserDefinedType(AbstractFile file) throws TskCoreException {
|
||||||
for (FileType fileType : userDefinedFileTypes.values()) {
|
for (FileType fileType : userDefinedFileTypes) {
|
||||||
if (fileType.matches(file)) {
|
if (fileType.matches(file)) {
|
||||||
if (fileType.alertOnMatch()) {
|
if (fileType.alertOnMatch()) {
|
||||||
BlackboardArtifact artifact;
|
BlackboardArtifact artifact;
|
||||||
|
@ -33,59 +33,58 @@
|
|||||||
</Group>
|
</Group>
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Group type="102" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="deleteTypeButton" min="-2" pref="70" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
|
||||||
<Component id="newTypeButton" min="-2" pref="70" max="-2" attributes="0"/>
|
<Component id="deleteTypeButton" min="-2" pref="70" max="-2" attributes="0"/>
|
||||||
</Group>
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
<Component id="typesScrollPane" alignment="0" min="-2" pref="180" max="-2" attributes="0"/>
|
<Component id="newTypeButton" min="-2" pref="70" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<Component id="typesScrollPane" alignment="0" min="-2" pref="180" max="-2" attributes="0"/>
|
||||||
<Component id="separator" min="-2" pref="7" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="103" alignment="0" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="mimeTypeLabel" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<Component id="mimeTypeTextField" min="-2" pref="176" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="postHitCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Component id="separator" min="-2" pref="7" max="-2" attributes="0"/>
|
||||||
<Component id="signatureTypeLabel" min="-2" max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="signatureTypeComboBox" min="-2" pref="176" max="-2" attributes="0"/>
|
<Group type="103" alignment="0" groupAlignment="0" attributes="0">
|
||||||
</Group>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Component id="mimeTypeLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="signatureLabel" min="-2" pref="73" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<Component id="mimeTypeTextField" min="-2" pref="176" max="-2" attributes="0"/>
|
||||||
<Component id="hexPrefixLabel" min="-2" max="-2" attributes="0"/>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<Component id="postHitCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="signatureTextField" min="-2" pref="160" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
</Group>
|
<Component id="signatureTypeLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="offsetLabel" min="-2" pref="71" max="-2" attributes="0"/>
|
<Component id="signatureTypeComboBox" min="-2" pref="176" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
</Group>
|
||||||
<Component id="offsetTextField" min="-2" pref="178" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
</Group>
|
<Component id="signatureLabel" min="-2" pref="73" max="-2" attributes="0"/>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
|
<Component id="hexPrefixLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="filesSetNameLabel" min="-2" max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<Component id="signatureTextField" min="-2" pref="160" max="-2" attributes="0"/>
|
||||||
<Component id="filesSetNameTextField" min="-2" pref="182" max="-2" attributes="0"/>
|
</Group>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="offsetLabel" min="-2" pref="71" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
|
<Component id="offsetTextField" min="-2" pref="178" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
|
||||||
|
<Component id="filesSetNameLabel" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
|
<Component id="filesSetNameTextField" min="-2" pref="182" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<Component id="saveTypeButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="saveTypeButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
@ -181,7 +180,7 @@
|
|||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<FileType>"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -58,8 +58,8 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
* the MIME types to file type objects lies behind the list model. This map
|
* the MIME types to file type objects lies behind the list model. This map
|
||||||
* is obtained from the user-defined types manager.
|
* is obtained from the user-defined types manager.
|
||||||
*/
|
*/
|
||||||
private DefaultListModel<String> typesListModel;
|
private DefaultListModel<FileType> typesListModel;
|
||||||
private Map<String, FileType> fileTypes;
|
private java.util.List<FileType> fileTypes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This panel implements a property change listener that listens to ingest
|
* This panel implements a property change listener that listens to ingest
|
||||||
@ -227,7 +227,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
ex.getLocalizedMessage(),
|
ex.getLocalizedMessage(),
|
||||||
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.loadFailed.title"),
|
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.loadFailed.title"),
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
fileTypes = Collections.emptyMap();
|
fileTypes = Collections.emptyList();
|
||||||
}
|
}
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}
|
}
|
||||||
@ -236,11 +236,10 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
* Sets the list model for the file types list component.
|
* Sets the list model for the file types list component.
|
||||||
*/
|
*/
|
||||||
private void updateFileTypesListModel() {
|
private void updateFileTypesListModel() {
|
||||||
ArrayList<String> mimeTypes = new ArrayList<>(fileTypes.keySet());
|
|
||||||
Collections.sort(mimeTypes);
|
|
||||||
typesListModel.clear();
|
typesListModel.clear();
|
||||||
for (String mimeType : mimeTypes) {
|
for (FileType fileType : fileTypes) {
|
||||||
typesListModel.addElement(mimeType);
|
typesListModel.addElement(fileType);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,10 +248,10 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
* panel based on the current selection in the file types list.
|
* panel based on the current selection in the file types list.
|
||||||
*/
|
*/
|
||||||
private void populateTypeDetailsComponents() {
|
private void populateTypeDetailsComponents() {
|
||||||
String mimeType = typesList.getSelectedValue();
|
FileType fileType = typesList.getSelectedValue();
|
||||||
FileType fileType = fileTypes.get(mimeType);
|
|
||||||
if (null != fileType) {
|
if (null != fileType) {
|
||||||
mimeTypeTextField.setText(fileType.getMimeType());
|
mimeTypeTextField.setText(fileType.getMimeType());
|
||||||
|
mimeTypeTextField.setEditable(false);
|
||||||
Signature signature = fileType.getSignature();
|
Signature signature = fileType.getSignature();
|
||||||
FileType.Signature.Type sigType = signature.getType();
|
FileType.Signature.Type sigType = signature.getType();
|
||||||
signatureTypeComboBox.setSelectedItem(sigType == FileType.Signature.Type.RAW ? FileTypeIdGlobalSettingsPanel.RAW_SIGNATURE_TYPE_COMBO_BOX_ITEM : FileTypeIdGlobalSettingsPanel.ASCII_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
signatureTypeComboBox.setSelectedItem(sigType == FileType.Signature.Type.RAW ? FileTypeIdGlobalSettingsPanel.RAW_SIGNATURE_TYPE_COMBO_BOX_ITEM : FileTypeIdGlobalSettingsPanel.ASCII_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
||||||
@ -286,6 +285,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
private void clearTypeDetailsComponents() {
|
private void clearTypeDetailsComponents() {
|
||||||
typesList.clearSelection();
|
typesList.clearSelection();
|
||||||
mimeTypeTextField.setText(""); //NON-NLS
|
mimeTypeTextField.setText(""); //NON-NLS
|
||||||
|
mimeTypeTextField.setEditable(true);
|
||||||
signatureTypeComboBox.setSelectedItem(FileTypeIdGlobalSettingsPanel.RAW_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
signatureTypeComboBox.setSelectedItem(FileTypeIdGlobalSettingsPanel.RAW_SIGNATURE_TYPE_COMBO_BOX_ITEM);
|
||||||
hexPrefixLabel.setVisible(true);
|
hexPrefixLabel.setVisible(true);
|
||||||
signatureTextField.setText("0000"); //NON-NLS
|
signatureTextField.setText("0000"); //NON-NLS
|
||||||
@ -339,7 +339,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
typesScrollPane = new javax.swing.JScrollPane();
|
typesScrollPane = new javax.swing.JScrollPane();
|
||||||
typesList = new javax.swing.JList<String>();
|
typesList = new javax.swing.JList<FileType>();
|
||||||
separator = new javax.swing.JSeparator();
|
separator = new javax.swing.JSeparator();
|
||||||
mimeTypeLabel = new javax.swing.JLabel();
|
mimeTypeLabel = new javax.swing.JLabel();
|
||||||
mimeTypeTextField = new javax.swing.JTextField();
|
mimeTypeTextField = new javax.swing.JTextField();
|
||||||
@ -451,48 +451,47 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
.addGap(30, 30, 30))
|
.addGap(30, 30, 30))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jLabel2)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(10, 10, 10)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(deleteTypeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jLabel2)
|
||||||
.addGap(18, 18, 18)
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(newTypeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addGap(10, 10, 10)
|
||||||
.addComponent(typesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(deleteTypeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(newTypeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addComponent(typesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 7, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(mimeTypeLabel)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGap(30, 30, 30)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(mimeTypeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(postHitCheckBox)
|
.addComponent(mimeTypeLabel)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGap(30, 30, 30)
|
||||||
.addComponent(signatureTypeLabel)
|
.addComponent(mimeTypeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addComponent(postHitCheckBox)
|
||||||
.addComponent(signatureTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(signatureTypeLabel)
|
||||||
.addComponent(signatureLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addComponent(signatureTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(hexPrefixLabel)
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addComponent(signatureLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(signatureTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(hexPrefixLabel)
|
||||||
.addComponent(offsetLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addComponent(signatureTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(offsetTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addComponent(offsetLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(21, 21, 21)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(filesSetNameLabel)
|
.addComponent(offsetTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addComponent(filesSetNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
.addGap(21, 21, 21)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addComponent(filesSetNameLabel)
|
||||||
.addComponent(saveTypeButton)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addGap(8, 8, 8)))
|
.addComponent(filesSetNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
.addContainerGap())
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(saveTypeButton)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGap(8, 8, 8))))
|
||||||
.addComponent(jLabel1)
|
.addComponent(jLabel1)
|
||||||
.addComponent(jLabel3))
|
.addComponent(jLabel3))
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||||
@ -557,8 +556,8 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
}//GEN-LAST:event_newTypeButtonActionPerformed
|
}//GEN-LAST:event_newTypeButtonActionPerformed
|
||||||
|
|
||||||
private void deleteTypeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteTypeButtonActionPerformed
|
private void deleteTypeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteTypeButtonActionPerformed
|
||||||
String typeName = typesList.getSelectedValue();
|
FileType fileType = typesList.getSelectedValue();
|
||||||
fileTypes.remove(typeName);
|
fileTypes.remove(fileType);
|
||||||
updateFileTypesListModel();
|
updateFileTypesListModel();
|
||||||
if (!typesListModel.isEmpty()) {
|
if (!typesListModel.isEmpty()) {
|
||||||
typesList.setSelectedIndex(0);
|
typesList.setSelectedIndex(0);
|
||||||
@ -626,7 +625,10 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
/**
|
/**
|
||||||
* Get the interesting files set details.
|
* Get the interesting files set details.
|
||||||
*/
|
*/
|
||||||
String filesSetName = filesSetNameTextField.getText();
|
String filesSetName = "";
|
||||||
|
if (postHitCheckBox.isSelected()) {
|
||||||
|
filesSetName = filesSetNameTextField.getText();
|
||||||
|
}
|
||||||
if (postHitCheckBox.isSelected() && filesSetName.isEmpty()) {
|
if (postHitCheckBox.isSelected() && filesSetName.isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidInterestingFilesSetName.message"),
|
NbBundle.getMessage(FileTypeIdGlobalSettingsPanel.class, "FileTypeIdGlobalSettingsPanel.JOptionPane.invalidInterestingFilesSetName.message"),
|
||||||
@ -640,9 +642,13 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
*/
|
*/
|
||||||
FileType.Signature signature = new FileType.Signature(signatureBytes, offset, sigType);
|
FileType.Signature signature = new FileType.Signature(signatureBytes, offset, sigType);
|
||||||
FileType fileType = new FileType(typeName, signature, filesSetName, postHitCheckBox.isSelected());
|
FileType fileType = new FileType(typeName, signature, filesSetName, postHitCheckBox.isSelected());
|
||||||
fileTypes.put(typeName, fileType);
|
FileType selected = typesList.getSelectedValue();
|
||||||
|
if (selected != null) {
|
||||||
|
fileTypes.remove(selected);
|
||||||
|
}
|
||||||
|
fileTypes.add(fileType);
|
||||||
updateFileTypesListModel();
|
updateFileTypesListModel();
|
||||||
typesList.setSelectedValue(fileType.getMimeType(), true);
|
typesList.setSelectedValue(fileType, true);
|
||||||
}//GEN-LAST:event_saveTypeButtonActionPerformed
|
}//GEN-LAST:event_saveTypeButtonActionPerformed
|
||||||
|
|
||||||
private void postHitCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_postHitCheckBoxActionPerformed
|
private void postHitCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_postHitCheckBoxActionPerformed
|
||||||
@ -685,7 +691,7 @@ final class FileTypeIdGlobalSettingsPanel extends IngestModuleGlobalSettingsPane
|
|||||||
private javax.swing.JTextField signatureTextField;
|
private javax.swing.JTextField signatureTextField;
|
||||||
private javax.swing.JComboBox<String> signatureTypeComboBox;
|
private javax.swing.JComboBox<String> signatureTypeComboBox;
|
||||||
private javax.swing.JLabel signatureTypeLabel;
|
private javax.swing.JLabel signatureTypeLabel;
|
||||||
private javax.swing.JList<String> typesList;
|
private javax.swing.JList<FileType> typesList;
|
||||||
private javax.swing.JScrollPane typesScrollPane;
|
private javax.swing.JScrollPane typesScrollPane;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
@ -25,10 +25,7 @@ import java.io.UnsupportedEncodingException;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@ -82,7 +79,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* map is guarded by the intrinsic lock of the user-defined file types
|
* map is guarded by the intrinsic lock of the user-defined file types
|
||||||
* manager for thread-safety.
|
* manager for thread-safety.
|
||||||
*/
|
*/
|
||||||
private final Map<String, FileType> userDefinedFileTypes = new HashMap<>();
|
private final List<FileType> userDefinedFileTypes = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The combined set of user-defined file types and file types predefined by
|
* The combined set of user-defined file types and file types predefined by
|
||||||
@ -91,7 +88,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* the intrinsic lock of the user-defined file types manager for
|
* the intrinsic lock of the user-defined file types manager for
|
||||||
* thread-safety.
|
* thread-safety.
|
||||||
*/
|
*/
|
||||||
private final Map<String, FileType> fileTypes = new HashMap<>();
|
private final List<FileType> fileTypes = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the singleton manager of user-defined file types characterized by
|
* Gets the singleton manager of user-defined file types characterized by
|
||||||
@ -122,7 +119,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* @throws
|
* @throws
|
||||||
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
||||||
*/
|
*/
|
||||||
synchronized Map<String, FileType> getFileTypes() throws UserDefinedFileTypesException {
|
synchronized List<FileType> getFileTypes() throws UserDefinedFileTypesException {
|
||||||
loadFileTypes();
|
loadFileTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,7 +128,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* Collections.unmodifiableCollection() is not used here because this
|
* Collections.unmodifiableCollection() is not used here because this
|
||||||
* view of the file types is a snapshot.
|
* view of the file types is a snapshot.
|
||||||
*/
|
*/
|
||||||
return new HashMap<>(fileTypes);
|
return new ArrayList<>(fileTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,7 +139,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* @throws
|
* @throws
|
||||||
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
||||||
*/
|
*/
|
||||||
synchronized Map<String, FileType> getUserDefinedFileTypes() throws UserDefinedFileTypesException {
|
synchronized List<FileType> getUserDefinedFileTypes() throws UserDefinedFileTypesException {
|
||||||
loadFileTypes();
|
loadFileTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -151,7 +148,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* Collections.unmodifiableCollection() is not used here because this
|
* Collections.unmodifiableCollection() is not used here because this
|
||||||
* view of the file types is a snapshot.
|
* view of the file types is a snapshot.
|
||||||
*/
|
*/
|
||||||
return new HashMap<>(userDefinedFileTypes);
|
return new ArrayList<>(userDefinedFileTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,44 +183,44 @@ final class UserDefinedFileTypesManager {
|
|||||||
try {
|
try {
|
||||||
// Add rule for xml
|
// Add rule for xml
|
||||||
fileType = new FileType("text/xml", new Signature("<?xml", 0L), "", false); //NON-NLS
|
fileType = new FileType("text/xml", new Signature("<?xml", 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for gzip
|
// Add rule for gzip
|
||||||
byteArray = DatatypeConverter.parseHexBinary("1F8B"); //NON-NLS
|
byteArray = DatatypeConverter.parseHexBinary("1F8B"); //NON-NLS
|
||||||
fileType = new FileType("application/x-gzip", new Signature(byteArray, 0L), "", false); //NON-NLS
|
fileType = new FileType("application/x-gzip", new Signature(byteArray, 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for .wk1
|
// Add rule for .wk1
|
||||||
byteArray = DatatypeConverter.parseHexBinary("0000020006040600080000000000"); //NON-NLS
|
byteArray = DatatypeConverter.parseHexBinary("0000020006040600080000000000"); //NON-NLS
|
||||||
fileType = new FileType("application/x-123", new Signature(byteArray, 0L), "", false); //NON-NLS
|
fileType = new FileType("application/x-123", new Signature(byteArray, 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for Radiance image
|
// Add rule for Radiance image
|
||||||
byteArray = DatatypeConverter.parseHexBinary("233F52414449414E43450A");//NON-NLS
|
byteArray = DatatypeConverter.parseHexBinary("233F52414449414E43450A");//NON-NLS
|
||||||
fileType = new FileType("image/vnd.radiance", new Signature(byteArray, 0L), "", false); //NON-NLS
|
fileType = new FileType("image/vnd.radiance", new Signature(byteArray, 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for .dcx image
|
// Add rule for .dcx image
|
||||||
byteArray = DatatypeConverter.parseHexBinary("B168DE3A"); //NON-NLS
|
byteArray = DatatypeConverter.parseHexBinary("B168DE3A"); //NON-NLS
|
||||||
fileType = new FileType("image/x-dcx", new Signature(byteArray, 0L), "", false); //NON-NLS
|
fileType = new FileType("image/x-dcx", new Signature(byteArray, 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for .ics image
|
// Add rule for .ics image
|
||||||
fileType = new FileType("image/x-icns", new Signature("icns", 0L), "", false); //NON-NLS
|
fileType = new FileType("image/x-icns", new Signature("icns", 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for .pict image
|
// Add rule for .pict image
|
||||||
byteArray = DatatypeConverter.parseHexBinary("001102FF"); //NON-NLS
|
byteArray = DatatypeConverter.parseHexBinary("001102FF"); //NON-NLS
|
||||||
fileType = new FileType("image/x-pict", new Signature(byteArray, 522L), "", false); //NON-NLS
|
fileType = new FileType("image/x-pict", new Signature(byteArray, 522L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for .pam
|
// Add rule for .pam
|
||||||
fileType = new FileType("image/x-portable-arbitrarymap", new Signature("P7", 0L), "", false); //NON-NLS
|
fileType = new FileType("image/x-portable-arbitrarymap", new Signature("P7", 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
|
|
||||||
// Add rule for .pfm
|
// Add rule for .pfm
|
||||||
fileType = new FileType("image/x-portable-floatmap", new Signature("PF", 0L), "", false); //NON-NLS
|
fileType = new FileType("image/x-portable-floatmap", new Signature("PF", 0L), "", false); //NON-NLS
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
}
|
}
|
||||||
// parseHexBinary() throws this if the argument passed in is not Hex
|
// parseHexBinary() throws this if the argument passed in is not Hex
|
||||||
catch (IllegalArgumentException e) {
|
catch (IllegalArgumentException e) {
|
||||||
@ -265,20 +262,20 @@ final class UserDefinedFileTypesManager {
|
|||||||
* @param fileType The file type to add.
|
* @param fileType The file type to add.
|
||||||
*/
|
*/
|
||||||
private void addUserDefinedFileType(FileType fileType) {
|
private void addUserDefinedFileType(FileType fileType) {
|
||||||
userDefinedFileTypes.put(fileType.getMimeType(), fileType);
|
userDefinedFileTypes.add(fileType);
|
||||||
fileTypes.put(fileType.getMimeType(), fileType);
|
fileTypes.add(fileType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the user-defined file types.
|
* Sets the user-defined file types.
|
||||||
*
|
*
|
||||||
* @param newFileTypes A mapping of file type names to user-defined file
|
* @param newFileTypes A mapping of file type names to user-defined file
|
||||||
* types.
|
* types.
|
||||||
*/
|
*/
|
||||||
synchronized void setUserDefinedFileTypes(Map<String, FileType> newFileTypes) throws UserDefinedFileTypesException {
|
synchronized void setUserDefinedFileTypes(List<FileType> newFileTypes) throws UserDefinedFileTypesException {
|
||||||
try {
|
try {
|
||||||
String filePath = getFileTypeDefinitionsFilePath(USER_DEFINED_TYPE_DEFINITIONS_FILE);
|
String filePath = getFileTypeDefinitionsFilePath(USER_DEFINED_TYPE_DEFINITIONS_FILE);
|
||||||
XmlWriter.writeFileTypes(newFileTypes.values(), filePath);
|
XmlWriter.writeFileTypes(newFileTypes, filePath);
|
||||||
} catch (ParserConfigurationException | FileNotFoundException | UnsupportedEncodingException | TransformerException ex) {
|
} catch (ParserConfigurationException | FileNotFoundException | UnsupportedEncodingException | TransformerException ex) {
|
||||||
throwUserDefinedFileTypesException(ex, "UserDefinedFileTypesManager.saveFileTypes.errorMessage");
|
throwUserDefinedFileTypesException(ex, "UserDefinedFileTypesManager.saveFileTypes.errorMessage");
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@ -308,7 +305,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* Writes a set of file type definitions to an XML file.
|
* Writes a set of file type definitions to an XML file.
|
||||||
*
|
*
|
||||||
* @param fileTypes A collection of file types.
|
* @param fileTypes A collection of file types.
|
||||||
* @param filePath The path to the destination file.
|
* @param filePath The path to the destination file.
|
||||||
*
|
*
|
||||||
* @throws ParserConfigurationException
|
* @throws ParserConfigurationException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@ -316,7 +313,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* @throws UnsupportedEncodingException
|
* @throws UnsupportedEncodingException
|
||||||
* @throws TransformerException
|
* @throws TransformerException
|
||||||
*/
|
*/
|
||||||
private static void writeFileTypes(Collection<FileType> fileTypes, String filePath) throws ParserConfigurationException, IOException, FileNotFoundException, UnsupportedEncodingException, TransformerException {
|
private static void writeFileTypes(List<FileType> fileTypes, String filePath) throws ParserConfigurationException, IOException, FileNotFoundException, UnsupportedEncodingException, TransformerException {
|
||||||
Document doc = XMLUtil.createDocument();
|
Document doc = XMLUtil.createDocument();
|
||||||
Element fileTypesElem = doc.createElement(FILE_TYPES_TAG_NAME);
|
Element fileTypesElem = doc.createElement(FILE_TYPES_TAG_NAME);
|
||||||
doc.appendChild(fileTypesElem);
|
doc.appendChild(fileTypesElem);
|
||||||
@ -331,7 +328,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
* Creates an XML representation of a file type.
|
* Creates an XML representation of a file type.
|
||||||
*
|
*
|
||||||
* @param fileType The file type object.
|
* @param fileType The file type object.
|
||||||
* @param doc The WC3 DOM object to use to create the XML.
|
* @param doc The WC3 DOM object to use to create the XML.
|
||||||
*
|
*
|
||||||
* @return An XML element.
|
* @return An XML element.
|
||||||
*/
|
*/
|
||||||
@ -347,9 +344,9 @@ final class UserDefinedFileTypesManager {
|
|||||||
/**
|
/**
|
||||||
* Add a MIME type child element to a file type XML element.
|
* Add a MIME type child element to a file type XML element.
|
||||||
*
|
*
|
||||||
* @param fileType The file type to use as a content source.
|
* @param fileType The file type to use as a content source.
|
||||||
* @param fileTypeElem The parent file type element.
|
* @param fileTypeElem The parent file type element.
|
||||||
* @param doc The WC3 DOM object to use to create the XML.
|
* @param doc The WC3 DOM object to use to create the XML.
|
||||||
*/
|
*/
|
||||||
private static void addMimeTypeElement(FileType fileType, Element fileTypeElem, Document doc) {
|
private static void addMimeTypeElement(FileType fileType, Element fileTypeElem, Document doc) {
|
||||||
Element typeNameElem = doc.createElement(MIME_TYPE_TAG_NAME);
|
Element typeNameElem = doc.createElement(MIME_TYPE_TAG_NAME);
|
||||||
@ -360,9 +357,9 @@ final class UserDefinedFileTypesManager {
|
|||||||
/**
|
/**
|
||||||
* Add a signature child element to a file type XML element.
|
* Add a signature child element to a file type XML element.
|
||||||
*
|
*
|
||||||
* @param fileType The file type to use as a content source.
|
* @param fileType The file type to use as a content source.
|
||||||
* @param fileTypeElem The parent file type element.
|
* @param fileTypeElem The parent file type element.
|
||||||
* @param doc The WC3 DOM object to use to create the XML.
|
* @param doc The WC3 DOM object to use to create the XML.
|
||||||
*/
|
*/
|
||||||
private static void addSignatureElement(FileType fileType, Element fileTypeElem, Document doc) {
|
private static void addSignatureElement(FileType fileType, Element fileTypeElem, Document doc) {
|
||||||
Signature signature = fileType.getSignature();
|
Signature signature = fileType.getSignature();
|
||||||
@ -383,9 +380,9 @@ final class UserDefinedFileTypesManager {
|
|||||||
/**
|
/**
|
||||||
* Add an interesting files set element to a file type XML element.
|
* Add an interesting files set element to a file type XML element.
|
||||||
*
|
*
|
||||||
* @param fileType The file type to use as a content source.
|
* @param fileType The file type to use as a content source.
|
||||||
* @param fileTypeElem The parent file type element.
|
* @param fileTypeElem The parent file type element.
|
||||||
* @param doc The WC3 DOM object to use to create the XML.
|
* @param doc The WC3 DOM object to use to create the XML.
|
||||||
*/
|
*/
|
||||||
private static void addInterestingFilesSetElement(FileType fileType, Element fileTypeElem, Document doc) {
|
private static void addInterestingFilesSetElement(FileType fileType, Element fileTypeElem, Document doc) {
|
||||||
if (!fileType.getFilesSetName().isEmpty()) {
|
if (!fileType.getFilesSetName().isEmpty()) {
|
||||||
@ -398,7 +395,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
/**
|
/**
|
||||||
* Add an alert attribute to a file type XML element.
|
* Add an alert attribute to a file type XML element.
|
||||||
*
|
*
|
||||||
* @param fileType The file type to use as a content source.
|
* @param fileType The file type to use as a content source.
|
||||||
* @param fileTypeElem The parent file type element.
|
* @param fileTypeElem The parent file type element.
|
||||||
*/
|
*/
|
||||||
private static void addAlertAttribute(FileType fileType, Element fileTypeElem) {
|
private static void addAlertAttribute(FileType fileType, Element fileTypeElem) {
|
||||||
@ -521,7 +518,7 @@ final class UserDefinedFileTypesManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the text content of a single child element.
|
* Gets the text content of a single child element.
|
||||||
*
|
*
|
||||||
* @param elem The parent element.
|
* @param elem The parent element.
|
||||||
* @param tagName The tag name of the child element.
|
* @param tagName The tag name of the child element.
|
||||||
*
|
*
|
||||||
* @return The text content.
|
* @return The text content.
|
||||||
@ -538,9 +535,9 @@ final class UserDefinedFileTypesManager {
|
|||||||
* Logs an exception, bundles the exception with a simple message in a
|
* Logs an exception, bundles the exception with a simple message in a
|
||||||
* uniform exception type, and throws the wrapper exception.
|
* uniform exception type, and throws the wrapper exception.
|
||||||
*
|
*
|
||||||
* @param ex The exception to wrap.
|
* @param ex The exception to wrap.
|
||||||
* @param messageKey A key into the bundle file that maps to the desired
|
* @param messageKey A key into the bundle file that maps to the desired
|
||||||
* message.
|
* message.
|
||||||
*
|
*
|
||||||
* @throws
|
* @throws
|
||||||
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
* org.sleuthkit.autopsy.modules.filetypeid.UserDefinedFileTypesManager.UserDefinedFileTypesException
|
||||||
|
Loading…
x
Reference in New Issue
Block a user