mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
bundles updates
This commit is contained in:
parent
f851eb7a26
commit
7695ef6a90
@ -89,6 +89,8 @@
|
||||
<fileset dir="${thirdparty.dir}/ImageMagick-7.0.10-27-portable-Q16-x64"/>
|
||||
</copy>
|
||||
|
||||
<mkdir dir="${basedir}/release/DomainCategorization"/>
|
||||
|
||||
<!-- The 'libgstlibav.dll' file is too big to store on GitHub, so we
|
||||
have it stored in a ZIP file. We'll extract it in place and remove
|
||||
the ZIP file afterward. -->
|
||||
|
@ -83,7 +83,9 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="categoryLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Category:"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/datamodel/hosts/Bundle.properties" key="AddEditCategoryDialog.categoryLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
@ -92,7 +94,9 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="domainSuffixLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Domain Suffix:"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/datamodel/hosts/Bundle.properties" key="AddEditCategoryDialog.domainSuffixLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
@ -110,7 +114,9 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="cancelButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/datamodel/hosts/Bundle.properties" key="AddEditCategoryDialog.cancelButton.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="cancelButtonActionPerformed"/>
|
||||
@ -122,7 +128,9 @@
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="saveButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Save"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/datamodel/hosts/Bundle.properties" key="AddEditCategoryDialog.saveButton.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="saveButtonActionPerformed"/>
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.url.analytics;
|
||||
|
||||
import java.util.Set;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
|
||||
/**
|
||||
@ -14,21 +15,31 @@ import org.openide.util.NbBundle.Messages;
|
||||
public class AddEditCategoryDialog extends javax.swing.JDialog {
|
||||
|
||||
private boolean changed = false;
|
||||
private final Set<String> currentSuffixesToUpper;
|
||||
private final String currentSuffix;
|
||||
private final String currentCategory;
|
||||
|
||||
/**
|
||||
* Creates new form AddEditCategoryDialog
|
||||
*/
|
||||
public AddEditCategoryDialog(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
public AddEditCategoryDialog(java.awt.Frame parent, Set<String> currentSuffixesToUpper) {
|
||||
this(parent, currentSuffixesToUpper, null, null);
|
||||
}
|
||||
|
||||
public AddEditCategoryDialog(java.awt.Frame parent, Set<String> currentSuffixesToUpper, String currentSuffix, String currentCategory) {
|
||||
super(parent, true);
|
||||
initComponents();
|
||||
this.currentSuffixesToUpper = currentSuffixesToUpper;
|
||||
this.currentSuffix = currentSuffix;
|
||||
this.currentCategory = currentCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The string value for the name in the input field if Ok pressed or
|
||||
* null if not.
|
||||
*/
|
||||
DomainCategory getValue() {
|
||||
return new DomainCategory(domainSuffixTextField.getText(), categoryTextField.getText());
|
||||
return new DomainCategory(domainSuffixTextField.getText().trim(), categoryTextField.getText().trim());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,6 +60,8 @@ public class AddEditCategoryDialog extends javax.swing.JDialog {
|
||||
"AddEditCategoryDialog_onValueUpdate_badSuffix=Please provide a domain suffix that is no more than {0} characters.",
|
||||
"# {0} - maxCategoryLen",
|
||||
"AddEditCategoryDialog_onValueUpdate_badCategory=Please provide a domain suffix that is no more than {0} characters.",
|
||||
"AddEditCategoryDialog_onValueUpdate_suffixRepeat=Please provide a unique domain suffix.",
|
||||
"AddEditCategoryDialog_onValueUpdate_sameCategory=Please provide a new category for this domain suffix.",
|
||||
})
|
||||
void onValueUpdate(String suffixStr, String categoryStr) {
|
||||
|
||||
@ -64,22 +77,23 @@ public class AddEditCategoryDialog extends javax.swing.JDialog {
|
||||
domainSuffixTextField.setText(safeSuffixStr);
|
||||
}
|
||||
|
||||
if (safeSuffixStr.length() == 0 || safeSuffixStr.length() > WebCategoriesManager.getMaxDomainSuffixLength()) {
|
||||
|
||||
} else if (safeCategoryStr.length() == 0 || safeCategoryStr.length() > WebCategoriesManager.getMaxCategoryLength()) {
|
||||
|
||||
}
|
||||
|
||||
// validate text input against invariants setting validation
|
||||
// message and whether or not okay button is enabled accordingly.
|
||||
// String validationMessage = HostNameValidator.getValidationMessage(
|
||||
// newNameValue, initialHost == null ? null : initialHost.getName(), hostNamesSanitized);
|
||||
//
|
||||
// okButton.setEnabled(validationMessage == null);
|
||||
// validationLabel.setText(validationMessage == null ? "" : validationMessage);
|
||||
String validationMessage = null;
|
||||
if (safeSuffixStr.trim().length() == 0 || safeSuffixStr.trim().length() > WebCategoriesDataModel.getMaxDomainSuffixLength()) {
|
||||
validationMessage = Bundle.AddEditCategoryDialog_onValueUpdate_badSuffix(WebCategoriesDataModel.getMaxCategoryLength());
|
||||
}else if (safeCategoryStr.trim().length() == 0 || safeCategoryStr.trim().length() > WebCategoriesDataModel.getMaxCategoryLength()) {
|
||||
validationMessage = Bundle.AddEditCategoryDialog_onValueUpdate_badCategory(WebCategoriesDataModel.getMaxDomainSuffixLength());
|
||||
} else if (currentSuffixesToUpper.contains(safeSuffixStr.trim().toUpperCase())) {
|
||||
validationMessage = Bundle.AddEditCategoryDialog_onValueUpdate_suffixRepeat();
|
||||
} else if (currentCategory != null && safeCategoryStr.trim().equals(currentCategory.trim())) {
|
||||
validationMessage = Bundle.AddEditCategoryDialog_onValueUpdate_sameCategory();
|
||||
}
|
||||
|
||||
saveButton.setEnabled(validationMessage == null);
|
||||
validationLabel.setText(validationMessage == null ? "" : validationMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
@ -100,22 +114,22 @@ public class AddEditCategoryDialog extends javax.swing.JDialog {
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
categoryLabel.setText("Category:");
|
||||
categoryLabel.setText(org.openide.util.NbBundle.getMessage(AddEditCategoryDialog.class, "AddEditCategoryDialog.categoryLabel.text")); // NOI18N
|
||||
|
||||
domainSuffixLabel.setText("Domain Suffix:");
|
||||
domainSuffixLabel.setText(org.openide.util.NbBundle.getMessage(AddEditCategoryDialog.class, "AddEditCategoryDialog.domainSuffixLabel.text")); // NOI18N
|
||||
|
||||
validationLabel.setForeground(java.awt.Color.RED);
|
||||
validationLabel.setText(" ");
|
||||
validationLabel.setToolTipText("");
|
||||
|
||||
cancelButton.setText("Cancel");
|
||||
cancelButton.setText(org.openide.util.NbBundle.getMessage(AddEditCategoryDialog.class, "AddEditCategoryDialog.cancelButton.text")); // NOI18N
|
||||
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
saveButton.setText("Save");
|
||||
saveButton.setText(org.openide.util.NbBundle.getMessage(AddEditCategoryDialog.class, "AddEditCategoryDialog.saveButton.text")); // NOI18N
|
||||
saveButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
saveButtonActionPerformed(evt);
|
||||
|
@ -0,0 +1,6 @@
|
||||
WebCategoryOptionsController_title=Custom Web Categories
|
||||
WebCategoryOptionsController_keywords=Custom Web Categories
|
||||
AddEditCategoryDialog.categoryLabel.text=Category:
|
||||
AddEditCategoryDialog.domainSuffixLabel.text=Domain Suffix:
|
||||
AddEditCategoryDialog.saveButton.text=Save
|
||||
AddEditCategoryDialog.cancelButton.text=Cancel
|
@ -2,3 +2,11 @@
|
||||
AddEditCategoryDialog_onValueUpdate_badCategory=Please provide a domain suffix that is no more than {0} characters.
|
||||
# {0} - maxSuffixLen
|
||||
AddEditCategoryDialog_onValueUpdate_badSuffix=Please provide a domain suffix that is no more than {0} characters.
|
||||
AddEditCategoryDialog_onValueUpdate_sameCategory=Please provide a new category for this domain suffix.
|
||||
AddEditCategoryDialog_onValueUpdate_suffixRepeat=Please provide a unique domain suffix.
|
||||
WebCategoryOptionsController_title=Custom Web Categories
|
||||
WebCategoryOptionsController_keywords=Custom Web Categories
|
||||
AddEditCategoryDialog.categoryLabel.text=Category:
|
||||
AddEditCategoryDialog.domainSuffixLabel.text=Domain Suffix:
|
||||
AddEditCategoryDialog.saveButton.text=Save
|
||||
AddEditCategoryDialog.cancelButton.text=Cancel
|
||||
|
@ -34,7 +34,7 @@ import org.openide.modules.InstalledFileLocator;
|
||||
*
|
||||
* @author gregd
|
||||
*/
|
||||
public class WebCategoriesManager {
|
||||
public class WebCategoriesDataModel {
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class CustomCategorizationJsonDto {
|
||||
@ -68,7 +68,7 @@ public class WebCategoriesManager {
|
||||
private static final String ROOT_FOLDER = "DomainCategorization";
|
||||
private static final String FILE_REL_PATH = "custom_list.db";
|
||||
private static final String JDBC_SQLITE_PREFIX = "jdbc:sqlite:";
|
||||
private static final Logger logger = Logger.getLogger(WebCategoriesManager.class.getName());
|
||||
private static final Logger logger = Logger.getLogger(WebCategoriesDataModel.class.getName());
|
||||
|
||||
|
||||
private final File sqlitePath;
|
||||
@ -84,15 +84,15 @@ public class WebCategoriesManager {
|
||||
|
||||
|
||||
private static File getDefaultPath() {
|
||||
File dir = InstalledFileLocator.getDefault().locate(ROOT_FOLDER, WebCategoriesManager.class.getPackage().getName(), false);
|
||||
File dir = InstalledFileLocator.getDefault().locate(ROOT_FOLDER, WebCategoriesDataModel.class.getPackage().getName(), false);
|
||||
return Paths.get(dir.getAbsolutePath(), FILE_REL_PATH).toFile();
|
||||
}
|
||||
|
||||
public WebCategoriesManager(File sqlitePath) {
|
||||
public WebCategoriesDataModel(File sqlitePath) {
|
||||
this.sqlitePath = sqlitePath;
|
||||
}
|
||||
|
||||
public WebCategoriesManager() {
|
||||
public WebCategoriesDataModel() {
|
||||
this(getDefaultPath());
|
||||
}
|
||||
|
@ -18,7 +18,9 @@
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="panelDescription">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="<html>This module allows you to find web categories based on host name.</html>"/>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/datamodel/hosts/Bundle.properties" key="WebCategoriesOptionsPanel.panelDescription.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
|
@ -5,6 +5,9 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.url.analytics;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||
import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
|
||||
|
||||
@ -14,11 +17,23 @@ import org.sleuthkit.autopsy.ingest.IngestModuleGlobalSettingsPanel;
|
||||
*/
|
||||
public class WebCategoriesOptionsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WebCategoriesOptionsPanel.class.getName());
|
||||
private final WebCategoriesDataModel dataModel;
|
||||
|
||||
/**
|
||||
* Creates new form CustomWebCategoriesOptionsPanel
|
||||
*/
|
||||
public WebCategoriesOptionsPanel() {
|
||||
public WebCategoriesOptionsPanel(WebCategoriesDataModel dataModel) {
|
||||
initComponents();
|
||||
this.dataModel = dataModel;
|
||||
}
|
||||
|
||||
private DomainCategory getSelected() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,7 +59,7 @@ public class WebCategoriesOptionsPanel extends IngestModuleGlobalSettingsPanel i
|
||||
|
||||
setLayout(new java.awt.GridBagLayout());
|
||||
|
||||
panelDescription.setText("<html>This module allows you to find web categories based on host name.</html>");
|
||||
panelDescription.setText(org.openide.util.NbBundle.getMessage(WebCategoriesOptionsPanel.class, "WebCategoriesOptionsPanel.panelDescription.text")); // NOI18N
|
||||
panelDescription.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridwidth = 3;
|
||||
@ -158,7 +173,14 @@ public class WebCategoriesOptionsPanel extends IngestModuleGlobalSettingsPanel i
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void deleteEntryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteEntryButtonActionPerformed
|
||||
// TODO add your handling code here:
|
||||
DomainCategory selected = getSelected();
|
||||
if (selected != null && selected.getHostSuffix() != null) {
|
||||
try {
|
||||
dataModel.deleteRecord(selected.getHostSuffix());
|
||||
} catch (SQLException ex) {
|
||||
logger.log(Level.WARNING, "There was an error while deleting: " + selected.getHostSuffix(), ex);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_deleteEntryButtonActionPerformed
|
||||
|
||||
private void newEntryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newEntryButtonActionPerformed
|
||||
@ -196,6 +218,6 @@ public class WebCategoriesOptionsPanel extends IngestModuleGlobalSettingsPanel i
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.url.analytics;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import javax.swing.JComponent;
|
||||
import org.netbeans.spi.options.OptionsPanelController;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.Lookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gregd
|
||||
*/
|
||||
@OptionsPanelController.TopLevelRegistration(categoryName = "#WebCategoryOptionsController_title",
|
||||
iconBase = "org/sleuthkit/autopsy/corecomponents/checkbox32.png",
|
||||
position = 21,
|
||||
keywords = "#WebCategoryOptionsController_keywords",
|
||||
keywordsCategory = "Custom Web Categories")
|
||||
public class WebCategoryOptionsController extends OptionsPanelController {
|
||||
private final WebCategoriesDataModel dataModel = new WebCategoriesDataModel();
|
||||
private final WebCategoriesOptionsPanel panel = new WebCategoriesOptionsPanel(dataModel);
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
panel.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyChanges() {
|
||||
// NO OP since saves happen whenever there is a change.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
// NO OP since saves happen whenever there is a change.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChanged() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getComponent(Lookup masterLookup) {
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpCtx getHelpCtx() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
// NO OP since saves happen whenever there is a change.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
// NO OP since saves happen whenever there is a change.
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user