This commit is contained in:
Greg DiCristofaro 2021-03-03 12:31:53 -05:00
parent a79ef6610d
commit 75edce86eb
12 changed files with 85 additions and 40 deletions

View File

@ -57,12 +57,12 @@ public class AnalysisPanel extends BaseDataSourceSummaryPanel {
private static final List<ColumnModel<Pair<String, Long>, DefaultCellModel<?>>> DEFAULT_COLUMNS = Arrays.asList(
new ColumnModel<>(
Bundle.AnalysisPanel_keyColumn_title(),
(pair) -> new DefaultCellModel(pair.getKey()),
(pair) -> new DefaultCellModel<>(pair.getKey()),
300
),
new ColumnModel<>(
Bundle.AnalysisPanel_countColumn_title(),
(pair) -> new DefaultCellModel(pair.getValue()),
(pair) -> new DefaultCellModel<>(pair.getValue()),
100
)
);

View File

@ -497,7 +497,7 @@ abstract class BaseDataSourceSummaryPanel extends JPanel {
String sheetName, List<T> data) {
return convertToExcel(
(dataList) -> new ExcelExport.ExcelTableExport<T, C>(Bundle.AnalysisPanel_hashsetHits_tabName(), columnsModel, dataList),
(dataList) -> new ExcelExport.ExcelTableExport<T, C>(sheetName, columnsModel, dataList),
data,
sheetName);
}
@ -508,7 +508,7 @@ abstract class BaseDataSourceSummaryPanel extends JPanel {
return getExport(
dataFetcher,
(dataList) -> new ExcelExport.ExcelTableExport<T, C>(Bundle.AnalysisPanel_hashsetHits_tabName(), columnsModel, dataList),
(dataList) -> new ExcelExport.ExcelTableExport<T, C>(sheetName, columnsModel, dataList),
sheetName,
ds);
}

View File

@ -58,4 +58,4 @@ UserActivityPanel.rightClickForMoreOptions3.text=Right click on row for more opt
UserActivityPanel.rightClickForMoreOptions4.text=Right click on row for more options
UserActivityPanel.rightClickForMoreOptions5.text=Right click on row for more options
TimelinePanel.viewInTimelineBtn.text=View in Timeline
DataSourceSummaryTabbedPane.exportXLSXButton.text=Export to XLSX
DataSourceSummaryTabbedPane.exportXLSXButton.text=Export Summary Data

View File

@ -1,5 +1,8 @@
AnalysisPanel_countColumn_title=Count
AnalysisPanel_hashsetHits_tabName=Hashset Hits
AnalysisPanel_interestingItemHits_tabName=Interesting Item Hits
AnalysisPanel_keyColumn_title=Name
AnalysisPanel_keywordHits_tabName=Keyword Hits
AnalysisPanel_keywordSearchModuleName=Keyword Search
BaseDataSourceSummaryPanel_goToArtifact=View Source Result
BaseDataSourceSummaryPanel_goToFile=View Source File in Directory
@ -45,26 +48,44 @@ DataSourceSummaryNode.column.type.header=Type
DataSourceSummaryNode.viewDataSourceAction.text=Go to Data Source
DataSourceSummaryTabbedPane_analysisTab_title=Analysis
DataSourceSummaryTabbedPane_detailsTab_title=Container
DataSourceSummaryTabbedPane_exportToXLSX_beginExport=Beginning Export...
# {0} - tabName
DataSourceSummaryTabbedPane_exportToXLSX_gatheringTabData=Fetching Data for {0} Tab...
DataSourceSummaryTabbedPane_exportToXLSX_writingToFile=Writing to File...
DataSourceSummaryTabbedPane_geolocationTab_title=Geolocation
DataSourceSummaryTabbedPane_ingestHistoryTab_title=Ingest History
DataSourceSummaryTabbedPane_pastCasesTab_title=Past Cases
# {0} - path
DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsMessage=File at {0} already exists.
DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsTitle=File Already Exists
DataSourceSummaryTabbedPane_recentFileTab_title=Recent Files
DataSourceSummaryTabbedPane_runXLSXExport_progressCancelActionTitle=Cancelling...
DataSourceSummaryTabbedPane_runXLSXExport_progressCancelTitle=Cancel
# {0} - dataSource
DataSourceSummaryTabbedPane_runXLSXExport_progressTitle=Exporting {0} to XLSX
DataSourceSummaryTabbedPane_timelineTab_title=Timeline
DataSourceSummaryTabbedPane_typesTab_title=Types
DataSourceSummaryTabbedPane_userActivityTab_title=User Activity
GeolocationPanel_cityColumn_title=Closest City
GeolocationPanel_countColumn_title=Count
GeolocationPanel_mostCommon_tabName=Most Common Cities
GeolocationPanel_mostRecent_tabName=Most Recent Cities
GeolocationPanel_onNoCrIngest_message=No results will be shown because the GPX Parser was not run.
GeolocationPanel_unknownRow_title=Unknown
PastCasesPanel_caseColumn_title=Case
PastCasesPanel_countColumn_title=Count
PastCasesPanel_notableFileTable_tabName=Cases with Common Notable
PastCasesPanel_onNoCrIngest_message=No results will be shown because the Central Repository module was not run.
PastCasesPanel_sameIdsTable_tabName=Past Cases with the Same Devices
RecentFilePanel_col_header_domain=Domain
RecentFilePanel_col_header_path=Path
RecentFilePanel_col_header_sender=Sender
RecentFilePanel_emailParserModuleName=Email Parser
RecentFilePanel_no_open_documents=No recently open documents found.
RecentFilesPanel_attachmentsTable_tabName=Recent Attachments
RecentFilesPanel_col_head_date=Date
RecentFilesPanel_docsTable_tabName=Recently Opened Documents
RecentFilesPanel_downloadsTable_tabName=Recently Downloads
SizeRepresentationUtil_units_bytes=\ bytes
SizeRepresentationUtil_units_gigabytes=\ GB
SizeRepresentationUtil_units_kilobytes=\ kB
@ -123,21 +144,27 @@ UserActivityPanel.rightClickForMoreOptions3.text=Right click on row for more opt
UserActivityPanel.rightClickForMoreOptions4.text=Right click on row for more options
UserActivityPanel.rightClickForMoreOptions5.text=Right click on row for more options
TimelinePanel.viewInTimelineBtn.text=View in Timeline
DataSourceSummaryTabbedPane.exportXLSXButton.text=Export Summary Data
UserActivityPanel_noDataExists=No communication data exists
UserActivityPanel_tab_title=User Activity
UserActivityPanel_TopAccountTableModel_accountType_header=Account Type
UserActivityPanel_TopAccountTableModel_lastAccess_header=Last Accessed
UserActivityPanel_TopAccountTableModel_tabName=Recent Account Types Used
UserActivityPanel_TopDeviceAttachedTableModel_dateAccessed_header=Last Accessed
UserActivityPanel_TopDeviceAttachedTableModel_deviceId_header=Device Id
UserActivityPanel_TopDeviceAttachedTableModel_makeModel_header=Make and Model
UserActivityPanel_TopDeviceAttachedTableModel_tabName=Recent Devices Attached
UserActivityPanel_TopDomainsTableModel_count_header=Visits
UserActivityPanel_TopDomainsTableModel_domain_header=Domain
UserActivityPanel_TopDomainsTableModel_lastAccess_header=Last Accessed
UserActivityPanel_TopDomainsTableModel_tabName=Recent Domains
UserActivityPanel_TopProgramsTableModel_count_header=Run Times
UserActivityPanel_TopProgramsTableModel_folder_header=Folder
UserActivityPanel_TopProgramsTableModel_lastrun_header=Last Run
UserActivityPanel_TopProgramsTableModel_name_header=Program
UserActivityPanel_TopProgramsTableModel_tabName=Recent Programs
UserActivityPanel_TopWebSearchTableModel_dateAccessed_header=Date Accessed
UserActivityPanel_TopWebSearchTableModel_searchString_header=Search String
UserActivityPanel_TopWebSearchTableModel_tabName=Recent Web Searches
UserActivityPanel_TopWebSearchTableModel_translatedResult_header=Translated
ViewSummaryInformationAction.name.text=View Summary Information

View File

@ -70,7 +70,7 @@
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
<EmptyBorder bottom="5" left="5" right="5" top="5"/>
<EmptyBorder bottom="2" left="2" right="2" top="2"/>
</Border>
</Property>
</Properties>
@ -93,7 +93,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="East"/>
<BorderConstraints direction="West"/>
</Constraint>
</Constraints>
</Component>

View File

@ -25,20 +25,28 @@ import java.awt.event.ActionListener;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.logging.Level;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datasourcesummary.uiutils.ExcelExport;
import org.sleuthkit.autopsy.datasourcesummary.uiutils.ExcelExport.ExcelExportException;
import org.sleuthkit.autopsy.datasourcesummary.uiutils.ExcelExport.ExcelSheetExport;
@ -145,6 +153,8 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
}
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(DataSourceSummaryTabbedPane.class.getName());
// needs to match value provided for card layout in designed
private static final String TABBED_PANE = "tabbedPane";
private static final String NO_DATASOURCE_PANE = "noDataSourcePane";
@ -271,19 +281,19 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
@Messages({
"DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsTitle=File Already Exists",
"# {0} - path",
"DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsMessage=File at {0} already exists.",
})
"DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsMessage=File at {0} already exists.",})
private void promptAndExportToXLSX() {
DataSource ds = this.dataSource;
if (ds == null) {
return;
}
String expectedExtension = "xlsx";
JFileChooser fc = new JFileChooser();
FileNameExtensionFilter xmlFilter = new FileNameExtensionFilter("XLSX file (*.xlsx)", expectedExtension);
fc.addChoosableFileFilter(xmlFilter);
fc.setFileFilter(xmlFilter);
DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss");
fc.setSelectedFile(new File(String.format("%s-%s.xlsx", ds.getName() == null ? "" : FileUtil.escapeFileName(ds.getName()), dateFormat.format(new Date()))));
int returnVal = fc.showSaveDialog(this);
@ -295,14 +305,15 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
if (!file.getAbsolutePath().endsWith("." + expectedExtension)) {
file = new File(file.getAbsolutePath() + "." + expectedExtension);
}
if (file.exists()) {
MessageNotifyUtil.Notify.error(
Bundle.DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsTitle(),
Bundle.DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsMessage(file.getAbsolutePath()));
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
Bundle.DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsMessage(file.getAbsolutePath()),
Bundle.DataSourceSummaryTabbedPane_promptAndExportToXLSX_fileExistsTitle(),
JOptionPane.WARNING_MESSAGE);
return;
}
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
@ -357,7 +368,15 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
@Override
protected void done() {
progressIndicator.finish();
try {
get();
} catch (ExecutionException ex) {
logger.log(Level.WARNING, "Error while trying to export data source summary to xlsx.", ex);
} catch (InterruptedException | CancellationException ex) {
// no op on cancellation
} finally {
progressIndicator.finish();
}
}
};
@ -368,14 +387,15 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
@Messages({
"DataSourceSummaryTabbedPane_exportToXLSX_beginExport=Beginning Export...",
"# {0} - tabName",
"DataSourceSummaryTabbedPane_exportToXLSX_gatheringTabData=Fetching Data for {0}...",
"DataSourceSummaryTabbedPane_exportToXLSX_gatheringTabData=Fetching Data for {0} Tab...",
"DataSourceSummaryTabbedPane_exportToXLSX_writingToFile=Writing to File...",})
private void exportToXLSX(ProgressIndicator progressIndicator, DataSource dataSource, File path)
throws InterruptedException, IOException, ExcelExportException {
int exportWeight = 3;
int totalWeight = tabs.size() + exportWeight;
progressIndicator.switchToDeterminate(Bundle.DataSourceSummaryTabbedPane_exportToXLSX_beginExport(), 0, totalWeight);
progressIndicator.start(Bundle.DataSourceSummaryTabbedPane_exportToXLSX_beginExport(), totalWeight);
List<ExcelSheetExport> sheetExports = new ArrayList<>();
for (int i = 0; i < tabs.size(); i++) {
if (Thread.interrupted()) {
@ -431,7 +451,7 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
tabContentPane.setLayout(new java.awt.BorderLayout());
tabContentPane.add(tabbedPane, java.awt.BorderLayout.CENTER);
actionsPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
actionsPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
actionsPane.setLayout(new java.awt.BorderLayout());
org.openide.awt.Mnemonics.setLocalizedText(exportXLSXButton, org.openide.util.NbBundle.getMessage(DataSourceSummaryTabbedPane.class, "DataSourceSummaryTabbedPane.exportXLSXButton.text")); // NOI18N
@ -440,7 +460,7 @@ public class DataSourceSummaryTabbedPane extends javax.swing.JPanel {
exportXLSXButtonActionPerformed(evt);
}
});
actionsPane.add(exportXLSXButton, java.awt.BorderLayout.EAST);
actionsPane.add(exportXLSXButton, java.awt.BorderLayout.WEST);
tabContentPane.add(actionsPane, java.awt.BorderLayout.SOUTH);

View File

@ -93,14 +93,14 @@ public class GeolocationPanel extends BaseDataSourceSummaryPanel {
// The column indicating the city
private static final ColumnModel<Pair<String, Integer>, DefaultCellModel<?>> CITY_COL = new ColumnModel<>(
Bundle.GeolocationPanel_cityColumn_title(),
(pair) -> new DefaultCellModel(pair.getLeft()),
(pair) -> new DefaultCellModel<>(pair.getLeft()),
300
);
// The column indicating the count of points seen close to that city
private static final ColumnModel<Pair<String, Integer>, DefaultCellModel<?>> COUNT_COL = new ColumnModel<>(
Bundle.GeolocationPanel_countColumn_title(),
(pair) -> new DefaultCellModel(pair.getRight()),
(pair) -> new DefaultCellModel<>(pair.getRight()),
100
);

View File

@ -54,13 +54,13 @@ public class PastCasesPanel extends BaseDataSourceSummaryPanel {
private static final ColumnModel<Pair<String, Long>, DefaultCellModel<?>> CASE_COL = new ColumnModel<>(
Bundle.PastCasesPanel_caseColumn_title(),
(pair) -> new DefaultCellModel(pair.getKey()),
(pair) -> new DefaultCellModel<>(pair.getKey()),
300
);
private static final ColumnModel<Pair<String, Long>, DefaultCellModel<?>> COUNT_COL = new ColumnModel<>(
Bundle.PastCasesPanel_countColumn_title(),
(pair) -> new DefaultCellModel(pair.getValue()),
(pair) -> new DefaultCellModel<>(pair.getValue()),
100
);

View File

@ -72,7 +72,7 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
private final List<ColumnModel<RecentFileDetails, DefaultCellModel<?>>> docsTemplate = Arrays.asList(
new ColumnModel<>(Bundle.RecentFilePanel_col_header_path(),
(prog) -> {
return new DefaultCellModel(prog.getPath())
return new DefaultCellModel<>(prog.getPath())
.setPopupMenuRetriever(getPopupFunct(prog));
}, 250),
new ColumnModel<>(Bundle.RecentFilesPanel_col_head_date(),
@ -82,12 +82,12 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
private final List<ColumnModel<RecentDownloadDetails, DefaultCellModel<?>>> downloadsTemplate = Arrays.asList(
new ColumnModel<>(Bundle.RecentFilePanel_col_header_domain(),
(prog) -> {
return new DefaultCellModel(prog.getWebDomain())
return new DefaultCellModel<>(prog.getWebDomain())
.setPopupMenuRetriever(getPopupFunct(prog));
}, 100),
new ColumnModel<>(Bundle.RecentFilePanel_col_header_path(),
(prog) -> {
return new DefaultCellModel(prog.getPath())
return new DefaultCellModel<>(prog.getPath())
.setPopupMenuRetriever(getPopupFunct(prog));
}, 250),
new ColumnModel<>(Bundle.RecentFilesPanel_col_head_date(),
@ -97,7 +97,7 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
private final List<ColumnModel<RecentAttachmentDetails, DefaultCellModel<?>>> attachmentsTemplate = Arrays.asList(
new ColumnModel<>(Bundle.RecentFilePanel_col_header_path(),
(prog) -> {
return new DefaultCellModel(prog.getPath())
return new DefaultCellModel<>(prog.getPath())
.setPopupMenuRetriever(getPopupFunct(prog));
}, 250),
new ColumnModel<>(Bundle.RecentFilesPanel_col_head_date(),
@ -105,7 +105,7 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
80),
new ColumnModel<>(Bundle.RecentFilePanel_col_header_sender(),
(prog) -> {
return new DefaultCellModel(prog.getSender())
return new DefaultCellModel<>(prog.getSender())
.setPopupMenuRetriever(getPopupFunct(prog));
}, 150));
@ -139,7 +139,7 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
private <T extends RecentFileDetails> Function<T, DefaultCellModel<?>> getDateFunct() {
return (T lastAccessed) -> {
Function<Date, String> dateParser = (dt) -> dt == null ? "" : DATETIME_FORMAT.format(dt);
return new DefaultCellModel<>(new Date(lastAccessed.getDateAsLong()), dateParser, DATETIME_FORMAT_STR)
return new DefaultCellModel<>(new Date(lastAccessed.getDateAsLong() * 1000), dateParser, DATETIME_FORMAT_STR)
.setPopupMenuRetriever(getPopupFunct(lastAccessed));
};
}

View File

@ -1,5 +1,7 @@
AbstractLoadableComponent_errorMessage_defaultText=There was an error loading results.
AbstractLoadableComponent_loadingMessage_defaultText=Loading results...
AbstractLoadableComponent_noDataExists_defaultText=No data exists.
# {0} - sheetNumber
ExcelExport_writeExcel_noSheetName=Sheet {0}
IngestRunningLabel_defaultMessage=Ingest is currently running.
PieChartPanel_noDataLabel=No Data

View File

@ -80,7 +80,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
*
* @return As a utility, returns this.
*/
public DefaultCellModel setTooltip(String tooltip) {
public DefaultCellModel<T> setTooltip(String tooltip) {
this.tooltip = tooltip;
return this;
}
@ -97,7 +97,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
*
* @return As a utility, returns this.
*/
public DefaultCellModel setHorizontalAlignment(CellModel.HorizontalAlign alignment) {
public DefaultCellModel<T> setHorizontalAlignment(CellModel.HorizontalAlign alignment) {
this.horizontalAlignment = alignment;
return this;
}
@ -114,7 +114,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
*
* @return As a utility, returns this.
*/
public DefaultCellModel setInsets(Insets insets) {
public DefaultCellModel<T> setInsets(Insets insets) {
this.insets = insets;
return this;
}
@ -138,7 +138,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
* @param menuItemSupplier The lazy load function for popup items.
* @return
*/
public DefaultCellModel setPopupMenuRetriever(Supplier<List<MenuItem>> menuItemSupplier) {
public DefaultCellModel<T> setPopupMenuRetriever(Supplier<List<MenuItem>> menuItemSupplier) {
this.menuItemSupplier = menuItemSupplier;
return this;
}
@ -149,7 +149,7 @@ public class DefaultCellModel<T> implements GuiCellModel, ExcelCellModel {
* @param popupMenu
* @return As a utility, returns this.
*/
public DefaultCellModel setPopupMenu(List<MenuItem> popupMenu) {
public DefaultCellModel<T> setPopupMenu(List<MenuItem> popupMenu) {
this.popupMenu = popupMenu == null ? null : new ArrayList<>(popupMenu);
return this;
}

View File

@ -86,10 +86,6 @@ public class ExcelExport {
cell.setCellValue((Date) cellData);
} else if (cellData instanceof Double) {
cell.setCellValue((Double) cellData);
} else if (cellData instanceof LocalDate) {
cell.setCellValue((LocalDate) cellData);
} else if (cellData instanceof LocalDateTime) {
cell.setCellValue((LocalDateTime) cellData);
} else if (cellData instanceof String) {
cell.setCellValue((String) cellData);
} else if (cellData instanceof Short) {