4816 change manifest tool to be more user friendly

This commit is contained in:
William Schaefer 2019-03-14 18:32:13 -04:00
parent f017580b4e
commit e52f72aeab
3 changed files with 70 additions and 40 deletions

View File

@ -27,9 +27,14 @@
;Get the list of names of algorithms ;Get the list of names of algorithms
Global $algorithms[3] ;increase size of array when adding new algorithms Global $algorithms[3] ;increase size of array when adding new algorithms
$algorithms[0] = "Single Data Source" $algorithms[0] = "Single data source"
$algorithms[1] = "Folder of Logical Files" $algorithms[1] = "Folder of logical files"
$algorithms[2] = "One Data Source Per Folder" $algorithms[2] = "One data source per folder"
Global $algorithmDescriptions[3] ;increase size of array when adding new algorithms
$algorithmDescriptions[0] = "Create a single auto ingest manifest file for a single disk image or VM file."
$algorithmDescriptions[1] = "Create a single auto ingest manifest file for a single folder of logical files."
$algorithmDescriptions[2] = "Create a manifest file for the first supported image of each subfolder of a case folder. If no supported images exist in the folder a manifest will be generated for the folders contents as a logical file set. Supported disk image or VM files: .e01, .l01, .001, .ad1"
; $algorithms[2] = "All Files In One Folder" ; $algorithms[2] = "All Files In One Folder"
Global $progressArea = Null Global $progressArea = Null
@ -42,6 +47,11 @@ Func GetAlgorithmNames()
Return $algorithms Return $algorithms
EndFunc EndFunc
;Return the description for the specified algorithm index
Func GetAlgorithmDescription($index)
Return $algorithmDescriptions[$index]
EndFunc
;Return the name of the first algorithm as a default algorithm ;Return the name of the first algorithm as a default algorithm
Func GetDefaultAlgorithmName() Func GetDefaultAlgorithmName()
Return $algorithms[0] Return $algorithms[0]

View File

@ -30,9 +30,9 @@ Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
;Draw GUI and declare variables ;Draw GUI and declare variables
; ;
;============================================== ;==============================================
local $windowHeight = 500 local $windowHeight = 560
local $windowWidth = 400 local $windowWidth = 460
local $windowTitle = "Autopsy AutoIngest Manifest File Generator" local $windowTitle = "Autopsy Auto Ingest Manifest File Generator"
Global $hMainGUI = GUICreate($windowTitle, $windowWidth, $windowHeight) ;To make GUI resize add following args -1, -1, $WS_OVERLAPPEDWINDOW) Global $hMainGUI = GUICreate($windowTitle, $windowWidth, $windowHeight) ;To make GUI resize add following args -1, -1, $WS_OVERLAPPEDWINDOW)
;GUICtrlSetResizing ($hMainGUI, $GUI_DOCKBORDERS) ;GUICtrlSetResizing ($hMainGUI, $GUI_DOCKBORDERS)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton") GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")
@ -48,16 +48,17 @@ local $progressAreaInset = 8
local $distanceFromTop = $topMargin local $distanceFromTop = $topMargin
local $distanceFromLeft = $leftMargin local $distanceFromLeft = $leftMargin
Global $defaultDirectory = @MyDocumentsDir & "\" Global $defaultDirectory = @MyDocumentsDir & "\"
local $labelWidth = 58 local $labelWidth = 63
local $fieldWidth = 235 local $fieldWidth = 255
local $buttonWidth = 60 local $buttonWidth = 95
local $fieldHeight = 20 local $fieldHeight = 20
local $descriptionHeight = 50
local $progressAreaWidth = $windowWidth - 2*($progressAreaInset+$leftMargin) local $progressAreaWidth = $windowWidth - 2*($progressAreaInset+$leftMargin)
local $gapBetweenWidth = 10 local $gapBetweenWidth = 10
local $gapBetweenHeight = 10 local $gapBetweenHeight = 10
;Draw the GUI Code ;Draw the GUI Code
GUICtrlCreateLabel("Algorithm", $distanceFromLeft, $distanceFromTop+$labelOffset) GUICtrlCreateLabel("Input", $distanceFromLeft, $distanceFromTop+$labelOffset)
$distanceFromLeft = $distanceFromLeft+$labelWidth+$gapBetweenWidth $distanceFromLeft = $distanceFromLeft+$labelWidth+$gapBetweenWidth
Global $algorithmComboBox = GUICtrlCreateCombo(GetDefaultAlgorithmName(), $distanceFromLeft, $distanceFromTop, $fieldWidth, $fieldHeight, $CBS_DROPDOWNLIST) Global $algorithmComboBox = GUICtrlCreateCombo(GetDefaultAlgorithmName(), $distanceFromLeft, $distanceFromTop, $fieldWidth, $fieldHeight, $CBS_DROPDOWNLIST)
@ -67,12 +68,19 @@ for $algorithmName IN $allAlgorithmNames
; Add additional items to the combobox. ; Add additional items to the combobox.
GUICtrlSetData($algorithmComboBox, $algorithmName) GUICtrlSetData($algorithmComboBox, $algorithmName)
Next Next
$distanceFromLeft = $leftMargin $distanceFromLeft = $leftMargin
$distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight $distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight
Global $rootFolderLabel = GUICtrlCreateLabel("Root Folder", $distanceFromLeft, $distanceFromTop+$labelOffset) GUICtrlCreateLabel("Description", $distanceFromLeft, $distanceFromTop+$labelOffset)
$distanceFromLeft = $distanceFromLeft+$labelWidth+$gapBetweenWidth
;calculate height of progress area to use remaining space minus space for exit button
Global $descriptionArea = GUICtrlCreateEdit("", $distanceFromLeft, $distanceFromTop, $fieldWidth, $descriptionHeight, BitOr($ES_READONLY,$WS_VSCROLL, $ES_MULTILINE))
$distanceFromLeft = $leftMargin
$distanceFromTop = $distanceFromTop + $descriptionHeight + $gapBetweenHeight
Global $caseDirectoryLabel = GUICtrlCreateLabel("Case Directory", $distanceFromLeft, $distanceFromTop+$labelOffset)
$distanceFromLeft = $distanceFromLeft+$labelWidth+$gapBetweenWidth $distanceFromLeft = $distanceFromLeft+$labelWidth+$gapBetweenWidth
Global $rootFolderField = GUICtrlCreateInput("", $distanceFromLeft, $distanceFromTop, $fieldWidth, $fieldHeight) Global $rootFolderField = GUICtrlCreateInput("", $distanceFromLeft, $distanceFromTop, $fieldWidth, $fieldHeight)
$distanceFromLeft = $distanceFromLeft +$fieldWidth+$gapBetweenWidth $distanceFromLeft = $distanceFromLeft +$fieldWidth+$gapBetweenWidth
@ -83,13 +91,14 @@ $distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight
Global $caseNameLabel = GUICtrlCreateLabel("Case Name", $distanceFromLeft, $distanceFromTop+$labelOffset) Global $caseNameLabel = GUICtrlCreateLabel("Case Name", $distanceFromLeft, $distanceFromTop+$labelOffset)
$distanceFromLeft = $distanceFromLeft+$labelWidth+$gapBetweenWidth $distanceFromLeft = $distanceFromLeft+$labelWidth+$gapBetweenWidth
Global $caseNameField = GUICtrlCreateInput("", $distanceFromLeft, $distanceFromTop, $fieldWidth, $fieldHeight) Global $caseNameField = GUICtrlCreateInput("", $distanceFromLeft, $distanceFromTop, $fieldWidth, $fieldHeight)
$distanceFromLeft = $leftMargin $distanceFromLeft = $distanceFromLeft +$fieldWidth+$gapBetweenWidth
$distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight $distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight
$distanceFromTop = $distanceFromTop + $gapBetweenHeight ;add an extra gap before run button $distanceFromTop = $distanceFromTop + $gapBetweenHeight ;add an extra gap before Generate Manifest button
Global $runButton = GUICtrlCreateButton("Run", $distanceFromLeft, $distanceFromTop+$buttonOffset, $buttonWidth) Global $generateManifestButton = GUICtrlCreateButton("Generate Manifest", $distanceFromLeft, $distanceFromTop+$buttonOffset, $buttonWidth)
GUICtrlSetOnEvent($runButton, "AlgorithmRunAction") GUICtrlSetOnEvent($generateManifestButton, "AlgorithmGenerateManifestAction")
$distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight $distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight
$distanceFromLeft = $leftMargin
$distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight ;add extra gap before progress area $distanceFromTop = $distanceFromTop + $fieldHeight + $gapBetweenHeight ;add extra gap before progress area
local $ProgressLabel = GUICtrlCreateLabel("Progress", $distanceFromLeft, $distanceFromTop+$labelOffset) local $ProgressLabel = GUICtrlCreateLabel("Progress", $distanceFromLeft, $distanceFromTop+$labelOffset)
@ -170,46 +179,54 @@ Func Redraw()
;Move controls based on what is hidden or shown using ControlGetPos() and GUICtrlSetPos() ;Move controls based on what is hidden or shown using ControlGetPos() and GUICtrlSetPos()
If $selectedAlgName == $allAlgorithmNames[2] Then ;"One Data Source Per Folder" If $selectedAlgName == $allAlgorithmNames[2] Then ;"One Data Source Per Folder"
ChangeToDefaultGUI() ChangeToDefaultGUI()
GUICtrlSetData($descriptionArea, GetAlgorithmDescription(2))
GUICtrlSetTip($algorithmComboBox, "Creates multiple manifest files for one case")
ElseIf $selectedAlgName == $allAlgorithmNames[0] Then ;"Single Data Source" ElseIf $selectedAlgName == $allAlgorithmNames[0] Then ;"Single Data Source"
ChangeToSingleDataSourceGUI() ChangeToSingleDataSourceGUI()
GUICtrlSetData($descriptionArea, GetAlgorithmDescription(0))
ElseIf $selectedAlgName == $allAlgorithmNames[1] Then ;"Folder of Logical Files" ElseIf $selectedAlgName == $allAlgorithmNames[1] Then ;"Folder of Logical Files"
ChangeToFolderOfLogicalFilesGUI() ChangeToFolderOfLogicalFilesGUI()
GUICtrlSetData($descriptionArea, GetAlgorithmDescription(1))
EndIf EndIf
EndFunc ;==>AlgorithmComboBox EndFunc ;==>AlgorithmComboBox
;Change the controls displayed in the GUI to the ones needed for the Single Data Source algorithm ;Change the controls displayed in the GUI to the ones needed for the Single Data Source algorithm
Func ChangeToSingleDataSourceGUI() Func ChangeToSingleDataSourceGUI()
ClearFields() ClearFields()
GUICtrlSetData($rootFolderLabel, "Data Source") GUICtrlSetData($caseDirectoryLabel, "Data Source")
GUICtrlSetState($caseNameField, $GUI_SHOW) GUICtrlSetState($caseNameField, $GUI_SHOW)
GUICtrlSetState($caseNameLabel, $GUI_SHOW) GUICtrlSetState($caseNameLabel, $GUI_SHOW)
GUICtrlSetOnEvent($browseButton, "BrowseForDataSourceFile") GUICtrlSetOnEvent($browseButton, "BrowseForDataSourceFile")
GUICtrlSetState($runButton, $GUI_DISABLE) GUICtrlSetState($generateManifestButton, $GUI_DISABLE)
GUICtrlSetTip($algorithmComboBox, "Creates a single manifest file for a single case")
EndFunc EndFunc
;Change the controls displayed in the GUI to the ones needed for the Folder of Logical Files algorithm ;Change the controls displayed in the GUI to the ones needed for the Folder of Logical Files algorithm
Func ChangeToFolderOfLogicalFilesGUI() Func ChangeToFolderOfLogicalFilesGUI()
ClearFields() ClearFields()
GUICtrlSetData($rootFolderLabel, "Data Source") GUICtrlSetData($caseDirectoryLabel, "Data Source")
GUICtrlSetData($rootFolderLabel, "Data Source") GUICtrlSetData($caseDirectoryLabel, "Data Source")
GUICtrlSetState($caseNameField, $GUI_SHOW) GUICtrlSetState($caseNameField, $GUI_SHOW)
GUICtrlSetState($caseNameLabel, $GUI_SHOW) GUICtrlSetState($caseNameLabel, $GUI_SHOW)
GUICtrlSetOnEvent($browseButton, "Browse") GUICtrlSetOnEvent($browseButton, "Browse")
GUICtrlSetState($runButton, $GUI_DISABLE) GUICtrlSetState($generateManifestButton, $GUI_DISABLE)
GUICtrlSetTip($algorithmComboBox, "Creates a single manifest file for a single case")
EndFunc EndFunc
;Change the controls displayed in the GUI to the ones needed for One ;Change the controls displayed in the GUI to the ones needed for One Data Source Per Folder
Func ChangeToDefaultGUI() Func ChangeToDefaultGUI()
ClearFields() ClearFields()
GUICtrlSetData($rootFolderLabel, "Root Folder") GUICtrlSetData($caseDirectoryLabel, "Case Directory")
GUICtrlSetState($rootFolderField, $GUI_SHOW) GUICtrlSetState($rootFolderField, $GUI_SHOW)
GUICtrlSetState($rootFolderLabel, $GUI_SHOW) GUICtrlSetState($caseDirectoryLabel, $GUI_SHOW)
GUICtrlSetState($caseNameField, $GUI_HIDE) GUICtrlSetState($caseNameField, $GUI_HIDE)
GUICtrlSetState($caseNameLabel, $GUI_HIDE) GUICtrlSetState($caseNameLabel, $GUI_HIDE)
GUICtrlSetOnEvent($browseButton, "Browse") GUICtrlSetOnEvent($browseButton, "Browse")
;rename to RootDirectory to root directory ;rename to RootDirectory to root directory
;hide case name field ;hide case name field
GUICtrlSetState($runButton, $GUI_DISABLE) GUICtrlSetState($generateManifestButton, $GUI_DISABLE)
GUICtrlSetTip($algorithmComboBox, "Creates multiple manifest files for one case")
EndFunc EndFunc
;ensure that all fields for the selected algorithm are valid ;ensure that all fields for the selected algorithm are valid
@ -231,18 +248,18 @@ EndFunc
;ensure that the settings for the default algorithm are valid before enabling it ;ensure that the settings for the default algorithm are valid before enabling it
Func ValidateDefaultFields($rootFolderPath) Func ValidateDefaultFields($rootFolderPath)
if ($rootFolderPath <> "" And FileExists($rootFolderPath)) Then if ($rootFolderPath <> "" And FileExists($rootFolderPath)) Then
GUICtrlSetState($runButton, $GUI_ENABLE) GUICtrlSetState($generateManifestButton, $GUI_ENABLE)
Else Else
GUICtrlSetState($runButton, $GUI_DISABLE) GUICtrlSetState($generateManifestButton, $GUI_DISABLE)
EndIf EndIf
EndFunc EndFunc
;ensure that the settings for the Single Data Source and Folder of Logical Files algorithms are valid ;ensure that the settings for the Single Data Source and Folder of Logical Files algorithms are valid
Func ValidateSingleDataSourceFields($dataSourcePath, $caseName) Func ValidateSingleDataSourceFields($dataSourcePath, $caseName)
if ($dataSourcePath <> "" And FileExists($dataSourcePath) And $caseName <> "") Then if ($dataSourcePath <> "" And FileExists($dataSourcePath) And $caseName <> "") Then
GUICtrlSetState($runButton, $GUI_ENABLE) GUICtrlSetState($generateManifestButton, $GUI_ENABLE)
Else Else
GUICtrlSetState($runButton, $GUI_DISABLE) GUICtrlSetState($generateManifestButton, $GUI_DISABLE)
EndIf EndIf
EndFunc EndFunc
@ -264,6 +281,12 @@ Func Browse()
$defaultDirectory = $caseDrive & $caseDir $defaultDirectory = $caseDrive & $caseDir
GUICtrlSetData($rootFolderField, $selectedDirectory) GUICtrlSetData($rootFolderField, $selectedDirectory)
EndIf EndIf
If GUICtrlRead($algorithmComboBox) == $allAlgorithmNames[2] Then ;"One Data Source Per Folder"
If ($selectedDirectory == $defaultDirectory) Then ;Don't allow root drives as selected directory for this algorithm
MsgBox(0, "Invalid Case Directory", "The directory is used to determine the case name and can not be the root directory of a disk.")
GUICtrlSetData($rootFolderField, "")
EndIf
EndIf
GUICtrlSetState($caseNameField, $GUI_FOCUS) GUICtrlSetState($caseNameField, $GUI_FOCUS)
GUICtrlSetState($browseButton, $GUI_ENABLE) GUICtrlSetState($browseButton, $GUI_ENABLE)
EndFunc ;==>BrowseButton EndFunc ;==>BrowseButton
@ -284,13 +307,13 @@ Func BrowseForDataSourceFile()
GUICtrlSetState($browseButton, $GUI_ENABLE) GUICtrlSetState($browseButton, $GUI_ENABLE)
EndFunc EndFunc
;Perform the action associated with the run button which should be defined in ManifestGenerationAlgorithms.au3 ;Perform the action associated with the generate manifest button which should be defined in ManifestGenerationAlgorithms.au3
Func AlgorithmRunAction() Func AlgorithmGenerateManifestAction()
; Note: At this point @GUI_CtrlId would equal $runButton ; Note: At this point @GUI_CtrlId would equal $generateManifestButton
GUICtrlSetState($runButton, $GUI_DISABLE) GUICtrlSetState($generateManifestButton, $GUI_DISABLE)
RunAlgorithm(GUICtrlRead($algorithmComboBox), GetSettings(), $progressField) RunAlgorithm(GUICtrlRead($algorithmComboBox), GetSettings(), $progressField)
GUICtrlSetState($runButton, $GUI_ENABLE) GUICtrlSetState($generateManifestButton, $GUI_ENABLE)
EndFunc ;==>RunButton EndFunc ;==>GenerateManifestButton
;Get an array of settings as they are set on this panel ;Get an array of settings as they are set on this panel
Func GetSettings() Func GetSettings()
@ -306,11 +329,8 @@ Func CLOSEButton()
; @GUI_WinHandle will be either $hMainGUI or $hDummyGUI ; @GUI_WinHandle will be either $hMainGUI or $hDummyGUI
GUICtrlSetState($exitButton, $GUI_DISABLE) GUICtrlSetState($exitButton, $GUI_DISABLE)
If @GUI_WinHandle = $hMainGUI Then If @GUI_WinHandle = $hMainGUI Then
Local $msgBoxAnswer = MsgBox(1, "Close Tool Confirmation", "Press OK to confirm closing the tool") WritePropertiesFile()
if $msgBoxAnswer == 1 Then Exit
WritePropertiesFile()
Exit
EndIf
EndIf EndIf
GUICtrlSetState($exitButton, $GUI_ENABLE) GUICtrlSetState($exitButton, $GUI_ENABLE)
EndFunc ;==>CLOSEButton EndFunc ;==>CLOSEButton

Binary file not shown.