mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge branch 'keyword-search-prototype' of https://github.com/sleuthkit/autopsy into keyword-search-prototype
This commit is contained in:
commit
f6490c6f1c
@ -35,11 +35,13 @@ import org.openide.DialogDisplayer;
|
||||
import org.openide.WizardDescriptor;
|
||||
import org.openide.util.ChangeSupport;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.openide.util.actions.Presenter;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.logging.Log;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
import org.sleuthkit.datamodel.SleuthkitJNI.CaseDbHandle.AddImageProcess;
|
||||
|
||||
/**
|
||||
@ -65,6 +67,8 @@ public final class AddImageAction extends CallableSystemAction implements Presen
|
||||
static final String IMAGEID_PROP = "imageId";
|
||||
// AddImageProcess: the next availble id for a new image
|
||||
static final String PROCESS_PROP = "process";
|
||||
// boolean: whether or not to index the image in Solr
|
||||
static final String SOLR_PROP = "indexInSolr";
|
||||
|
||||
|
||||
private WizardDescriptor wizardDescriptor;
|
||||
@ -103,6 +107,7 @@ public final class AddImageAction extends CallableSystemAction implements Presen
|
||||
wizardDescriptor = new WizardDescriptor(iterator);
|
||||
wizardDescriptor.setTitle("Add Image");
|
||||
wizardDescriptor.putProperty(NAME, e);
|
||||
wizardDescriptor.putProperty(SOLR_PROP, false);
|
||||
|
||||
|
||||
if (dialog != null) {
|
||||
@ -140,12 +145,19 @@ public final class AddImageAction extends CallableSystemAction implements Presen
|
||||
|
||||
String[] imgPaths = (String[]) settings.getProperty(AddImageAction.IMGPATHS_PROP);
|
||||
String timezone = settings.getProperty(AddImageAction.TIMEZONE_PROP).toString();
|
||||
boolean indexImage = (Boolean) settings.getProperty(AddImageAction.SOLR_PROP);
|
||||
|
||||
AddImageProcess process = (AddImageProcess) settings.getProperty(PROCESS_PROP);
|
||||
|
||||
try {
|
||||
long imageId = process.commit();
|
||||
Case.getCurrentCase().addImage(imgPaths, imageId, timezone);
|
||||
Image newImage = Case.getCurrentCase().addImage(imgPaths, imageId, timezone);
|
||||
|
||||
if (indexImage) {
|
||||
// Must use a Lookup here to prevent a circular dependency
|
||||
// between Case and KeywordSearch...
|
||||
Lookup.getDefault().lookup(IndexImageTask.class).runTask(newImage);
|
||||
}
|
||||
} finally {
|
||||
// Can't bail and revert image add after commit, so disable image cleanup
|
||||
// task
|
||||
@ -153,7 +165,8 @@ public final class AddImageAction extends CallableSystemAction implements Presen
|
||||
cleanupImage.disable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Closes the current dialog and wizard, and opens a new one. Used in the
|
||||
* "Add another image" action on the last panel
|
||||
@ -174,6 +187,23 @@ public final class AddImageAction extends CallableSystemAction implements Presen
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface IndexImageTask {
|
||||
void runTask(Image newImage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Closes the current dialog and wizard and indexes the newly added image.
|
||||
* Used in the "Index for keyword search" action on the last panel
|
||||
*/
|
||||
public void indexImage() {
|
||||
// Simulate clicking finish for the current dialog
|
||||
wizardDescriptor.setValue(WizardDescriptor.FINISH_OPTION);
|
||||
wizardDescriptor.putProperty(SOLR_PROP, true);
|
||||
dialog.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does nothing. Use the "actionPerformed(ActionEvent e)" instead of this method.
|
||||
|
@ -19,11 +19,28 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="addImgButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="crDbLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="0" min="-2" pref="549" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="crDbLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="0" min="-2" pref="549" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="418" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="indexImgButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="addImgButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="64" pref="64" max="64" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="368" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -34,9 +51,13 @@
|
||||
<Component id="crDbLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="addImgButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="54" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="indexImgButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@ -69,5 +90,22 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="indexImgButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel3.indexImgButton.text" 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="indexImgButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="AddImageVisualPanel3.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -57,6 +57,8 @@ final class AddImageVisualPanel3 extends JPanel {
|
||||
addImgButton = new javax.swing.JButton();
|
||||
crDbLabel = new javax.swing.JLabel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
indexImgButton = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(addImgButton, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.addImgButton.text")); // NOI18N
|
||||
addImgButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
@ -70,6 +72,15 @@ final class AddImageVisualPanel3 extends JPanel {
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.jLabel1.text")); // NOI18N
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(indexImgButton, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.indexImgButton.text")); // NOI18N
|
||||
indexImgButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
indexImgButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(AddImageVisualPanel3.class, "AddImageVisualPanel3.jLabel2.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -77,10 +88,21 @@ final class AddImageVisualPanel3 extends JPanel {
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(addImgButton)
|
||||
.addComponent(crDbLabel)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 549, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(crDbLabel)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 549, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel2)
|
||||
.addContainerGap(418, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(indexImgButton)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(addImgButton)
|
||||
.addGap(64, 64, 64)))
|
||||
.addContainerGap(368, Short.MAX_VALUE))))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -89,9 +111,13 @@ final class AddImageVisualPanel3 extends JPanel {
|
||||
.addComponent(crDbLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel2)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(addImgButton)
|
||||
.addContainerGap(54, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(indexImgButton)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@ -106,9 +132,17 @@ final class AddImageVisualPanel3 extends JPanel {
|
||||
act.restart();
|
||||
}//GEN-LAST:event_addImgButtonActionPerformed
|
||||
|
||||
private void indexImgButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_indexImgButtonActionPerformed
|
||||
// finish wizard and index image
|
||||
AddImageAction act = Lookup.getDefault().lookup(AddImageAction.class);
|
||||
act.indexImage();
|
||||
}//GEN-LAST:event_indexImgButtonActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton addImgButton;
|
||||
private javax.swing.JLabel crDbLabel;
|
||||
private javax.swing.JButton indexImgButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ AddImageVisualPanel2.progressLabel.text=
|
||||
AddImageVisualPanel2.jLabel1.text=<html> We will now analyze the disk image to extract volume and file system data and populate a local database. This may <br>take a while on large images. </html>
|
||||
AddImageVisualPanel3.addImgButton.text=Add Another Image
|
||||
AddImageVisualPanel3.crDbLabel.text=Finish or Add More Images
|
||||
AddImageVisualPanel3.jLabel1.text=Image successfully processed and added to the case. You can add another image or return to the case.
|
||||
AddImageVisualPanel3.jLabel1.text=Image successfully processed and added to the case. You can add another image, index the one you just
|
||||
AddImageVisualPanel1.jLabel1.text=
|
||||
AddImageVisualPanel1.timeZoneLabel.text=Please select your timezone:
|
||||
AddImageVisualPanel1.rawSingle.text=Raw Single (*.img, *.dd, etc)
|
||||
@ -113,3 +113,6 @@ NewJPanel.jFormattedTextField1.text=jFormattedTextField1
|
||||
NewJPanel.jButton1.text=Rename
|
||||
NewJPanel.jLabel4.text=Database:
|
||||
AddImageVisualPanel2.lookupFilesCheckBox.text=Lookup files in hash databases
|
||||
AddImageVisualPanel2.indexImageCheckBox.text=Index image for keyword search
|
||||
AddImageVisualPanel3.indexImgButton.text=Index Image for Keyword Search
|
||||
AddImageVisualPanel3.jLabel2.text=added, or return to the case.
|
||||
|
@ -231,7 +231,7 @@ public class Case {
|
||||
* @param imgId the ID of the image that being added
|
||||
* @param timeZone the timeZone of the image where it's added
|
||||
*/
|
||||
void addImage(String[] imgPaths, long imgId, String timeZone) throws Exception {
|
||||
Image addImage(String[] imgPaths, long imgId, String timeZone) throws Exception {
|
||||
Log.get(this.getClass()).log(Level.INFO, "Adding image to Case. imgPaths: {0} ID: {1} TimeZone: {2}", new Object[]{Arrays.toString(imgPaths), imgId, timeZone});
|
||||
|
||||
try {
|
||||
@ -239,6 +239,7 @@ public class Case {
|
||||
xmlcm.writeFile(); // write any changes to the config file
|
||||
Image newImage = db.getImageById(imgId);
|
||||
pcs.firePropertyChange(CASE_ADD_IMAGE, null, newImage); // the new value is the instance of the image
|
||||
return newImage;
|
||||
} catch (Exception ex) {
|
||||
// throw an error here
|
||||
throw ex;
|
||||
|
@ -36,9 +36,12 @@ import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.casemodule.AddImageAction;
|
||||
import org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.FsContent;
|
||||
import org.sleuthkit.datamodel.Image;
|
||||
|
||||
/**
|
||||
* Action adds all supported files from the given Content object and its
|
||||
@ -206,4 +209,13 @@ public class IndexContentFilesAction extends AbstractAction {
|
||||
title,
|
||||
messageType);
|
||||
}
|
||||
|
||||
@ServiceProvider(service = AddImageAction.IndexImageTask.class)
|
||||
public static class IndexImageTask implements AddImageAction.IndexImageTask {
|
||||
|
||||
@Override
|
||||
public void runTask(Image newImage) {
|
||||
(new IndexContentFilesAction(newImage, "new image")).actionPerformed(null);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user