# Path: dtformats/detection_history.py
# class WindowsDefenderScanDetectionHistoryFile(data_format.BinaryDataFile):
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile(
#       'detection_history.yaml')
#   _DEBUG_INFO_THREAT_TRACKING_HEADER = [
#       ('version', 'Version', '_FormatIntegerAsDecimal'),
#       ('header_size', 'Header size', '_FormatIntegerAsDecimal'),
#       ('values_data_size', 'Values data size', '_FormatIntegerAsDecimal'),
#       ('total_data_size', 'Total data size', '_FormatIntegerAsDecimal'),
#       ('unknown2', 'Unknown2', '_FormatIntegerAsHexadecimal8')]
#   _DEBUG_INFO_THREAT_TRACKING_VALUE = [
#       ('key_string_size', 'Key string size', '_FormatIntegerAsDecimal'),
#       ('key_string', 'Key string', '_FormatString'),
#       ('value_type', 'Value type', '_FormatIntegerAsHexadecimal8'),
#       ('value_integer', 'Value integer', '_FormatIntegerAsDecimal'),
#       ('value_string_size', 'Value string size', '_FormatIntegerAsDecimal'),
#       ('value_string', 'Value string', '_FormatString')]
#   _DEBUG_INFO_VALUE = [
#       ('data_size', 'Data size', '_FormatIntegerAsDecimal'),
#       ('data_type', 'Data type', '_FormatIntegerAsHexadecimal8'),
#       ('data', 'Data', '_FormatDataInHexadecimal'),
#       ('value_filetime', 'Value FILETIME', '_FormatIntegerAsFiletime'),
#       ('value_guid', 'Value GUID', '_FormatUUIDAsString'),
#       ('value_integer', 'Value integer', '_FormatIntegerAsDecimal'),
#       ('value_string', 'Value string', '_FormatString'),
#       ('alignment_padding', 'Alignment padding', '_FormatDataInHexadecimal')]
#   _VALUE_DESCRIPTIONS = [
#       {0: 'Threat identifier',
#        1: 'Identifier'},
#       {0: 'UnknownMagic1',
#        1: 'Threat name',
#        4: 'Category'},
#       {0: 'UnknownMagic2',
#        1: 'Resource type',
#        2: 'Resource location',
#        4: 'Threat tracking data size',
#        5: 'Threat tracking data',
#        6: 'Last threat status change time',
#        12: 'Domain user1',
#        14: 'Process name',
#        18: 'Initial detection time',
#        20: 'Remediation time',
#        24: 'Domain user2'}]
#   _CATEGORY_NAME = {
#       0: 'INVALID',
#       1: 'ADWARE',
#       2: 'SPYWARE',
#       3: 'PASSWORDSTEALER',
#       4: 'TROJANDOWNLOADER',
#       5: 'WORM',
#       6: 'BACKDOOR',
#       7: 'REMOTEACCESSTROJAN',
#       8: 'TROJAN',
#       9: 'EMAILFLOODER',
#       10: 'KEYLOGGER',
#       11: 'DIALER',
#       12: 'MONITORINGSOFTWARE',
#       13: 'BROWSERMODIFIER',
#       14: 'COOKIE',
#       15: 'BROWSERPLUGIN',
#       16: 'AOLEXPLOIT',
#       17: 'NUKER',
#       18: 'SECURITYDISABLER',
#       19: 'JOKEPROGRAM',
#       20: 'HOSTILEACTIVEXCONTROL',
#       21: 'SOFTWAREBUNDLER',
#       22: 'STEALTHNOTIFIER',
#       23: 'SETTINGSMODIFIER',
#       24: 'TOOLBAR',
#       25: 'REMOTECONTROLSOFTWARE',
#       26: 'TROJANFTP',
#       27: 'POTENTIALUNWANTEDSOFTWARE',
#       28: 'ICQEXPLOIT',
#       29: 'TROJANTELNET',
#       30: 'FILESHARINGPROGRAM',
#       31: 'MALWARE_CREATION_TOOL',
#       32: 'REMOTE_CONTROL_SOFTWARE',
#       33: 'TOOL',
#       34: 'TROJAN_DENIALOFSERVICE',
#       36: 'TROJAN_DROPPER',
#       37: 'TROJAN_MASSMAILER',
#       38: 'TROJAN_MONITORINGSOFTWARE',
#       39: 'TROJAN_PROXYSERVER',
#       40: 'VIRUS',
#       42: 'KNOWN',
#       43: 'UNKNOWN',
#       44: 'SPP',
#       45: 'BEHAVIOR',
#       46: 'VULNERABILTIY',
#       47: 'POLICY'}
#   def _ReadThreatTrackingData(self, threat_tracking_data, file_offset):
#   def _ReadThreatTrackingHeader(self, threat_tracking_data):
#   def _ReadThreatTrackingValue(self, threat_tracking_data, file_offset):
#   def _ReadValue(self, file_object, file_offset):
#   def ReadFileObject(self, file_object):
# 
# Path: dtformats/output_writers.py
# class OutputWriter(object):
# class StdoutWriter(OutputWriter):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):


import argparse
import logging
import sys
from dtformats import detection_history
from dtformats import output_writers
  argument_parser.add_argument(
      '-d', '--debug', dest='debug', action='store_true', default=False,
      help='enable debug output.')

  argument_parser.add_argument(
      'source', nargs='?', action='store', metavar='PATH', default=None, help=(
          'path of the Windows Defender scan DetectionHistory file.'))

  options = argument_parser.parse_args()

  if not options.source:
    print('Source file missing.')
    print('')
    argument_parser.print_help()
    print('')
    return False

  logging.basicConfig(
      level=logging.INFO, format='[%(levelname)s] %(message)s')

  output_writer = output_writers.StdoutWriter()

  try:
    output_writer.Open()
  except IOError as exception:
    print('Unable to open output writer with error: {0!s}'.format(exception))
    print('')
    return False

  detection_history_file = (

# Path: dtformats/detection_history.py
# class WindowsDefenderScanDetectionHistoryFile(data_format.BinaryDataFile):
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile(
#       'detection_history.yaml')
#   _DEBUG_INFO_THREAT_TRACKING_HEADER = [
#       ('version', 'Version', '_FormatIntegerAsDecimal'),
#       ('header_size', 'Header size', '_FormatIntegerAsDecimal'),
#       ('values_data_size', 'Values data size', '_FormatIntegerAsDecimal'),
#       ('total_data_size', 'Total data size', '_FormatIntegerAsDecimal'),
#       ('unknown2', 'Unknown2', '_FormatIntegerAsHexadecimal8')]
#   _DEBUG_INFO_THREAT_TRACKING_VALUE = [
#       ('key_string_size', 'Key string size', '_FormatIntegerAsDecimal'),
#       ('key_string', 'Key string', '_FormatString'),
#       ('value_type', 'Value type', '_FormatIntegerAsHexadecimal8'),
#       ('value_integer', 'Value integer', '_FormatIntegerAsDecimal'),
#       ('value_string_size', 'Value string size', '_FormatIntegerAsDecimal'),
#       ('value_string', 'Value string', '_FormatString')]
#   _DEBUG_INFO_VALUE = [
#       ('data_size', 'Data size', '_FormatIntegerAsDecimal'),
#       ('data_type', 'Data type', '_FormatIntegerAsHexadecimal8'),
#       ('data', 'Data', '_FormatDataInHexadecimal'),
#       ('value_filetime', 'Value FILETIME', '_FormatIntegerAsFiletime'),
#       ('value_guid', 'Value GUID', '_FormatUUIDAsString'),
#       ('value_integer', 'Value integer', '_FormatIntegerAsDecimal'),
#       ('value_string', 'Value string', '_FormatString'),
#       ('alignment_padding', 'Alignment padding', '_FormatDataInHexadecimal')]
#   _VALUE_DESCRIPTIONS = [
#       {0: 'Threat identifier',
#        1: 'Identifier'},
#       {0: 'UnknownMagic1',
#        1: 'Threat name',
#        4: 'Category'},
#       {0: 'UnknownMagic2',
#        1: 'Resource type',
#        2: 'Resource location',
#        4: 'Threat tracking data size',
#        5: 'Threat tracking data',
#        6: 'Last threat status change time',
#        12: 'Domain user1',
#        14: 'Process name',
#        18: 'Initial detection time',
#        20: 'Remediation time',
#        24: 'Domain user2'}]
#   _CATEGORY_NAME = {
#       0: 'INVALID',
#       1: 'ADWARE',
#       2: 'SPYWARE',
#       3: 'PASSWORDSTEALER',
#       4: 'TROJANDOWNLOADER',
#       5: 'WORM',
#       6: 'BACKDOOR',
#       7: 'REMOTEACCESSTROJAN',
#       8: 'TROJAN',
#       9: 'EMAILFLOODER',
#       10: 'KEYLOGGER',
#       11: 'DIALER',
#       12: 'MONITORINGSOFTWARE',
#       13: 'BROWSERMODIFIER',
#       14: 'COOKIE',
#       15: 'BROWSERPLUGIN',
#       16: 'AOLEXPLOIT',
#       17: 'NUKER',
#       18: 'SECURITYDISABLER',
#       19: 'JOKEPROGRAM',
#       20: 'HOSTILEACTIVEXCONTROL',
#       21: 'SOFTWAREBUNDLER',
#       22: 'STEALTHNOTIFIER',
#       23: 'SETTINGSMODIFIER',
#       24: 'TOOLBAR',
#       25: 'REMOTECONTROLSOFTWARE',
#       26: 'TROJANFTP',
#       27: 'POTENTIALUNWANTEDSOFTWARE',
#       28: 'ICQEXPLOIT',
#       29: 'TROJANTELNET',
#       30: 'FILESHARINGPROGRAM',
#       31: 'MALWARE_CREATION_TOOL',
#       32: 'REMOTE_CONTROL_SOFTWARE',
#       33: 'TOOL',
#       34: 'TROJAN_DENIALOFSERVICE',
#       36: 'TROJAN_DROPPER',
#       37: 'TROJAN_MASSMAILER',
#       38: 'TROJAN_MONITORINGSOFTWARE',
#       39: 'TROJAN_PROXYSERVER',
#       40: 'VIRUS',
#       42: 'KNOWN',
#       43: 'UNKNOWN',
#       44: 'SPP',
#       45: 'BEHAVIOR',
#       46: 'VULNERABILTIY',
#       47: 'POLICY'}
#   def _ReadThreatTrackingData(self, threat_tracking_data, file_offset):
#   def _ReadThreatTrackingHeader(self, threat_tracking_data):
#   def _ReadThreatTrackingValue(self, threat_tracking_data, file_offset):
#   def _ReadValue(self, file_object, file_offset):
#   def ReadFileObject(self, file_object):
# 
# Path: dtformats/output_writers.py
# class OutputWriter(object):
# class StdoutWriter(OutputWriter):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):


# Path: scripts/detection_history.py
import argparse
import logging
import sys
from dtformats import detection_history
from dtformats import output_writers

  argument_parser.add_argument(
      '-d', '--debug', dest='debug', action='store_true', default=False,
      help='enable debug output.')

  argument_parser.add_argument(
      'source', nargs='?', action='store', metavar='PATH', default=None, help=(
          'path of the Windows Defender scan DetectionHistory file.'))

  options = argument_parser.parse_args()

  if not options.source:
    print('Source file missing.')
    print('')
    argument_parser.print_help()
    print('')
    return False

  logging.basicConfig(
      level=logging.INFO, format='[%(levelname)s] %(message)s')

  output_writer = output_writers.StdoutWriter()

  try:
    output_writer.Open()
  except IOError as exception:
    print('Unable to open output writer with error: {0!s}'.format(exception))
    print('')
    return False

  detection_history_file = (

      detection_history.WindowsDefenderScanDetectionHistoryFile(