Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
MalwareScanIngestSettingsPanel.java
Go to the documentation of this file.
1/*
2 * Autopsy Browser
3 *
4 * Copyright 2023 Basis Technology Corp.
5 * Contact: carrier <at> sleuthkit <dot> org
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19package com.basistech.df.cybertriage.autopsy.malwarescan;
20
21import com.basistech.df.cybertriage.autopsy.ctapi.json.LicenseInfo;
22import com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud.CTLicensePersistence;
23import java.util.Optional;
24import org.sleuthkit.autopsy.modules.dataSourceIntegrity.*;
25import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
26import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
27
31@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
32final class MalwareScanIngestSettingsPanel extends IngestModuleIngestJobSettingsPanel {
33
34 private final CTLicensePersistence ctPersistence = CTLicensePersistence.getInstance();
35
36 MalwareScanIngestSettingsPanel(MalwareScanIngestSettings settings) {
37 initComponents();
38 customizeComponents(settings);
39 }
40
46 private void customizeComponents(MalwareScanIngestSettings settings) {
47 Optional<LicenseInfo> licenseInfoOpt = ctPersistence.loadLicenseInfo();
48 LicenseInfo licenseInfo = licenseInfoOpt.orElse(null);
49 if (licenseInfo != null) {
50 this.paidLicenseTextArea.setVisible(false);
51 this.queryFilesCheckbox.setVisible(true);
52 this.queryFilesCheckbox.setEnabled(false);
53 this.uploadFilesCheckbox.setVisible(true);
54 this.queryFilesCheckbox.setSelected(true);
55 this.uploadFilesCheckbox.setSelected(settings.shouldUploadFiles());
56 } else {
57 this.paidLicenseTextArea.setVisible(true);
58 this.queryFilesCheckbox.setVisible(false);
59 this.uploadFilesCheckbox.setVisible(false);
60 }
61 }
62
63 @Override
64 public IngestModuleIngestJobSettings getSettings() {
65 return new MalwareScanIngestSettings(queryFilesCheckbox.isSelected(), uploadFilesCheckbox.isSelected());
66 }
67
73 @SuppressWarnings("unchecked")
74 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
75 private void initComponents() {
76
77 queryFilesCheckbox = new javax.swing.JCheckBox();
78 uploadFilesCheckbox = new javax.swing.JCheckBox();
79 ingestSettingsLabel = new javax.swing.JLabel();
80 paidLicenseTextArea = new javax.swing.JTextArea();
81
82 setPreferredSize(new java.awt.Dimension(300, 155));
83
84 queryFilesCheckbox.setSelected(true);
85 org.openide.awt.Mnemonics.setLocalizedText(queryFilesCheckbox, org.openide.util.NbBundle.getMessage(MalwareScanIngestSettingsPanel.class, "MalwareScanIngestSettingsPanel.queryFilesCheckbox.text")); // NOI18N
86 queryFilesCheckbox.setEnabled(false);
87
88 org.openide.awt.Mnemonics.setLocalizedText(uploadFilesCheckbox, org.openide.util.NbBundle.getMessage(MalwareScanIngestSettingsPanel.class, "MalwareScanIngestSettingsPanel.uploadFilesCheckbox.text")); // NOI18N
89 uploadFilesCheckbox.setFocusable(false);
90 uploadFilesCheckbox.setLabel(org.openide.util.NbBundle.getMessage(MalwareScanIngestSettingsPanel.class, "MalwareScanIngestSettingsPanel.uploadFilesCheckbox.label")); // NOI18N
91
92 ingestSettingsLabel.setFont(ingestSettingsLabel.getFont().deriveFont(ingestSettingsLabel.getFont().getStyle() | java.awt.Font.BOLD));
93 org.openide.awt.Mnemonics.setLocalizedText(ingestSettingsLabel, org.openide.util.NbBundle.getMessage(MalwareScanIngestSettingsPanel.class, "MalwareScanIngestSettingsPanel.ingestSettingsLabel.text")); // NOI18N
94
95 paidLicenseTextArea.setColumns(20);
96 paidLicenseTextArea.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
97 paidLicenseTextArea.setRows(5);
98 paidLicenseTextArea.setText(org.openide.util.NbBundle.getMessage(MalwareScanIngestSettingsPanel.class, "MalwareScanIngestSettingsPanel.paidLicenseTextArea.text")); // NOI18N
99 paidLicenseTextArea.setWrapStyleWord(true);
100 paidLicenseTextArea.setBorder(null);
101 paidLicenseTextArea.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
102 paidLicenseTextArea.setFocusable(false);
103 paidLicenseTextArea.setOpaque(false);
104 paidLicenseTextArea.setRequestFocusEnabled(false);
105
106 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
107 this.setLayout(layout);
108 layout.setHorizontalGroup(
109 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
110 .addGroup(layout.createSequentialGroup()
111 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
112 .addGroup(layout.createSequentialGroup()
113 .addGap(6, 6, 6)
114 .addComponent(ingestSettingsLabel))
115 .addGroup(layout.createSequentialGroup()
116 .addGap(6, 6, 6)
117 .addComponent(uploadFilesCheckbox))
118 .addGroup(layout.createSequentialGroup()
119 .addContainerGap()
120 .addComponent(queryFilesCheckbox))
121 .addGroup(layout.createSequentialGroup()
122 .addGap(5, 5, 5)
123 .addComponent(paidLicenseTextArea, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)))
124 .addGap(185, 185, 185))
125 );
126 layout.setVerticalGroup(
127 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
128 .addGroup(layout.createSequentialGroup()
129 .addContainerGap()
130 .addComponent(ingestSettingsLabel)
131 .addGap(18, 18, 18)
132 .addComponent(queryFilesCheckbox)
133 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
134 .addComponent(uploadFilesCheckbox)
135 .addGap(18, 18, 18)
136 .addComponent(paidLicenseTextArea, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
137 );
138
139 uploadFilesCheckbox.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(MalwareScanIngestSettingsPanel.class, "MalwareScanIngestSettingsPanel.uploadFilesCheckbox.AccessibleContext.accessibleName")); // NOI18N
140 }// </editor-fold>//GEN-END:initComponents
141
142 // Variables declaration - do not modify//GEN-BEGIN:variables
143 private javax.swing.JLabel ingestSettingsLabel;
144 private javax.swing.JTextArea paidLicenseTextArea;
145 private javax.swing.JCheckBox queryFilesCheckbox;
146 private javax.swing.JCheckBox uploadFilesCheckbox;
147 // End of variables declaration//GEN-END:variables
148
149}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.