# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):
# 
# Path: auto_forensicate/hostinfo.py
# def ReadDMI(name):
# def GetChassisSerial():
# def GetMachineUUID():
# def GetRandomUUID():
# def GetIdentifier():
# def GetUdevadmInfo(device_name):
# def GetTime():
# def Which(cmd):
# 
# Path: auto_forensicate/macdisk.py
# class MacDiskError(Exception):
# class Disk(object):
# def _DictFromSubprocess(command):
# def _DictFromDiskutilInfo(deviceid):
# def _DictFromDiskutilList():
# def WholeDisks():
#   def __init__(self, deviceid):
#   def Refresh(self):
# 
# Path: auto_forensicate/recipes/base.py
# class BaseArtifact(object):
# class StringArtifact(BaseArtifact):
# class FileArtifact(BaseArtifact):
# class ProcessOutputArtifact(BaseArtifact):
# class BaseRecipe(object):
#   def __init__(self, name):
#   def _GetStream(self):
#   def CloseStream(self):
#   def OpenStream(self):
#   def size(self):
#   def readable_size(self):
#   def __init__(self, path, string_content):
#   def _GetStream(self):
#   def CloseStream(self):
#   def __init__(self, path):
#   def _GetStream(self):
#   def __init__(self, command, path, ignore_failure=False):
#   def _RunCommand(self):
#   def _GetStream(self):
#   def __init__(self, name, options=None):
#   def __enter__(self):
#   def __exit__(self, exc_type, exc_value, traceback):
#   def GetArtifacts(self):
# 
# Path: auto_forensicate/ux/cli.py
# def AskText(message, mandatory=False):
# def AskDiskList(disk_list):
# def Confirm(text, default='N'):
# 
# Path: auto_forensicate/ux/gui.py
# def AskText(message, mandatory=False):
# def AskDiskList(disk_list):
# def Confirm(text):


import json
import os
import subprocess
from auto_forensicate import errors
from auto_forensicate import hostinfo
from auto_forensicate import macdisk
from auto_forensicate.recipes import base
from auto_forensicate.ux import cli
from auto_forensicate.ux import gui

    if getattr(self._options, 'select_disks', None):
      all_disks = self._ListDisks(all_devices=True)
      if getattr(self._options, 'no_zenity', False):
        disks_to_collect = cli.AskDiskList(all_disks)
      else:
        disks_to_collect = gui.AskDiskList(all_disks)
    elif getattr(self._options, 'disk', None):
      disks_to_collect = self._ListDisks(names=self._options.disk)
    else:
      disks_to_collect = self._ListDisks()


    if not disks_to_collect:
      raise errors.RecipeException('No disk to collect')

    disk_list_artifact = self._GetListDisksArtifact()
    artifacts.append(disk_list_artifact)

    for disk in disks_to_collect:

      disk_info_artifact = self._GetDiskInfoArtifact(disk)
      if disk_info_artifact:
        artifacts.append(disk_info_artifact)

      artifacts.append(disk)

      if self.use_dcfldd:
        # It is necessary for the DiskArtifact to be appended before the
        # hashlog, as the hashlog is generated when dcfldd completes.

# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):
# 
# Path: auto_forensicate/hostinfo.py
# def ReadDMI(name):
# def GetChassisSerial():
# def GetMachineUUID():
# def GetRandomUUID():
# def GetIdentifier():
# def GetUdevadmInfo(device_name):
# def GetTime():
# def Which(cmd):
# 
# Path: auto_forensicate/macdisk.py
# class MacDiskError(Exception):
# class Disk(object):
# def _DictFromSubprocess(command):
# def _DictFromDiskutilInfo(deviceid):
# def _DictFromDiskutilList():
# def WholeDisks():
#   def __init__(self, deviceid):
#   def Refresh(self):
# 
# Path: auto_forensicate/recipes/base.py
# class BaseArtifact(object):
# class StringArtifact(BaseArtifact):
# class FileArtifact(BaseArtifact):
# class ProcessOutputArtifact(BaseArtifact):
# class BaseRecipe(object):
#   def __init__(self, name):
#   def _GetStream(self):
#   def CloseStream(self):
#   def OpenStream(self):
#   def size(self):
#   def readable_size(self):
#   def __init__(self, path, string_content):
#   def _GetStream(self):
#   def CloseStream(self):
#   def __init__(self, path):
#   def _GetStream(self):
#   def __init__(self, command, path, ignore_failure=False):
#   def _RunCommand(self):
#   def _GetStream(self):
#   def __init__(self, name, options=None):
#   def __enter__(self):
#   def __exit__(self, exc_type, exc_value, traceback):
#   def GetArtifacts(self):
# 
# Path: auto_forensicate/ux/cli.py
# def AskText(message, mandatory=False):
# def AskDiskList(disk_list):
# def Confirm(text, default='N'):
# 
# Path: auto_forensicate/ux/gui.py
# def AskText(message, mandatory=False):
# def AskDiskList(disk_list):
# def Confirm(text):


# Path: auto_forensicate/recipes/disk.py
import json
import os
import subprocess
from auto_forensicate import errors
from auto_forensicate import hostinfo
from auto_forensicate import macdisk
from auto_forensicate.recipes import base
from auto_forensicate.ux import cli
from auto_forensicate.ux import gui


    if getattr(self._options, 'select_disks', None):
      all_disks = self._ListDisks(all_devices=True)
      if getattr(self._options, 'no_zenity', False):
        disks_to_collect = cli.AskDiskList(all_disks)
      else:
        disks_to_collect = gui.AskDiskList(all_disks)
    elif getattr(self._options, 'disk', None):
      disks_to_collect = self._ListDisks(names=self._options.disk)
    else:
      disks_to_collect = self._ListDisks()


    if not disks_to_collect:
      raise errors.RecipeException('No disk to collect')

    disk_list_artifact = self._GetListDisksArtifact()
    artifacts.append(disk_list_artifact)

    for disk in disks_to_collect:

      disk_info_artifact = self._GetDiskInfoArtifact(disk)
      if disk_info_artifact:
        artifacts.append(disk_info_artifact)

      artifacts.append(disk)

      if self.use_dcfldd:
        # It is necessary for the DiskArtifact to be appended before the
        # hashlog, as the hashlog is generated when dcfldd completes.

        hashlog_artifact = base.FileArtifact(disk.hashlog_filename)