# 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
    Only supported implementations are MacOS and Linux.

    Args:
      path(str): the path to the disk.
      size(str): the size of the disk.
      use_dcfldd(bool): whether to use dcfldd to read from the blockdevice.

    Raises:
      ValueError: if path is none, doesn't start with '/dev' or size is =< 0.
    """
    super(DiskArtifact, self).__init__(os.path.basename(path))
    if not path.startswith('/dev'):
      raise ValueError(
          'Error with path {0:s}: should start with \'/dev\''.format(path))
    self._ddprocess = None
    self.use_dcfldd = use_dcfldd
    self._path = path
    if size > 0:
      self._size = size
    else:
      raise ValueError('Disk size must be an integer > 0')
    self.hashlog_filename = '{0:s}.hash'.format(self.name)
    self.remote_path = 'Disks/{0:s}.image'.format(self.name)

  def _GenerateDDCommand(self):
    """Builds the DD command to run on the disk.

    Returns:
      list: the argument list for the dd command
    """

# 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

    Only supported implementations are MacOS and Linux.

    Args:
      path(str): the path to the disk.
      size(str): the size of the disk.
      use_dcfldd(bool): whether to use dcfldd to read from the blockdevice.

    Raises:
      ValueError: if path is none, doesn't start with '/dev' or size is =< 0.
    """
    super(DiskArtifact, self).__init__(os.path.basename(path))
    if not path.startswith('/dev'):
      raise ValueError(
          'Error with path {0:s}: should start with \'/dev\''.format(path))
    self._ddprocess = None
    self.use_dcfldd = use_dcfldd
    self._path = path
    if size > 0:
      self._size = size
    else:
      raise ValueError('Disk size must be an integer > 0')
    self.hashlog_filename = '{0:s}.hash'.format(self.name)
    self.remote_path = 'Disks/{0:s}.image'.format(self.name)

  def _GenerateDDCommand(self):
    """Builds the DD command to run on the disk.

    Returns:
      list: the argument list for the dd command
    """

    dd_binary = hostinfo.Which(self._DD_BINARY)