OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """The log2timeline CLI tool.""" | 2 """The log2timeline CLI tool.""" |
3 | 3 |
4 import argparse | 4 import argparse |
5 import logging | 5 import logging |
6 import os | |
7 import sys | 6 import sys |
8 import time | 7 import time |
9 import textwrap | 8 import textwrap |
10 | 9 |
11 from dfvfs.lib import definitions as dfvfs_definitions | 10 from dfvfs.lib import definitions as dfvfs_definitions |
12 from dfvfs.resolver import context as dfvfs_context | 11 from dfvfs.resolver import context as dfvfs_context |
13 | 12 |
14 import plaso | 13 import plaso |
15 | 14 |
16 # The following import makes sure the filters are registered. | 15 # The following import makes sure the filters are registered. |
17 from plaso import filters # pylint: disable=unused-import | 16 from plaso import filters # pylint: disable=unused-import |
18 | 17 |
19 # The following import makes sure the output modules are registered. | 18 # The following import makes sure the output modules are registered. |
20 from plaso import output # pylint: disable=unused-import | 19 from plaso import output # pylint: disable=unused-import |
21 | 20 |
22 from plaso.cli import extraction_tool | 21 from plaso.cli import extraction_tool |
| 22 from plaso.cli import logging_filter |
23 from plaso.cli import status_view | 23 from plaso.cli import status_view |
24 from plaso.cli import tools as cli_tools | |
25 from plaso.cli import views as cli_views | |
26 from plaso.cli import logging_filter as logging_filter | 24 from plaso.cli import logging_filter as logging_filter |
| 25 from plaso.cli import tool_options |
| 26 from plaso.cli import tools |
| 27 from plaso.cli import views |
| 28 from plaso.cli.helpers import manager as helpers_manager |
27 from plaso.engine import configurations | 29 from plaso.engine import configurations |
28 from plaso.engine import engine | 30 from plaso.engine import engine |
29 from plaso.engine import single_process as single_process_engine | 31 from plaso.engine import single_process as single_process_engine |
30 from plaso.frontend import utils as frontend_utils | 32 from plaso.frontend import utils as frontend_utils |
| 33 from plaso.lib import definitions |
31 from plaso.lib import errors | 34 from plaso.lib import errors |
32 from plaso.multi_processing import task_engine as multi_process_engine | 35 from plaso.multi_processing import task_engine as multi_process_engine |
33 from plaso.output import manager as output_manager | 36 from plaso.output import manager as output_manager |
34 from plaso.storage import zip_file as storage_zip_file | 37 from plaso.storage import zip_file as storage_zip_file |
35 | 38 |
36 | 39 |
37 class Log2TimelineTool(extraction_tool.ExtractionTool): | 40 class Log2TimelineTool( |
38 """Class that implements the log2timeline CLI tool. | 41 extraction_tool.ExtractionTool, |
| 42 tool_options.OutputModuleOptions, |
| 43 tool_options.StorageFileOptions): |
| 44 """Log2timeline CLI tool. |
39 | 45 |
40 Attributes: | 46 Attributes: |
41 dependencies_check (bool): True if the availability and versions of | 47 dependencies_check (bool): True if the availability and versions of |
42 dependencies should be checked. | 48 dependencies should be checked. |
43 list_output_modules (bool): True if information about the output modules | 49 list_output_modules (bool): True if information about the output modules |
44 should be shown. | 50 should be shown. |
45 show_info (bool): True if information about hashers, parsers, plugins, | 51 show_info (bool): True if information about hashers, parsers, plugins, |
46 etc. should be shown. | 52 etc. should be shown. |
47 """ | 53 """ |
48 | 54 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 that the stdin input reader should be used. | 99 that the stdin input reader should be used. |
94 output_writer (Optional[OutputWriter]): output writer, where None | 100 output_writer (Optional[OutputWriter]): output writer, where None |
95 indicates that the stdout output writer should be used. | 101 indicates that the stdout output writer should be used. |
96 """ | 102 """ |
97 super(Log2TimelineTool, self).__init__( | 103 super(Log2TimelineTool, self).__init__( |
98 input_reader=input_reader, output_writer=output_writer) | 104 input_reader=input_reader, output_writer=output_writer) |
99 self._command_line_arguments = None | 105 self._command_line_arguments = None |
100 self._enable_sigsegv_handler = False | 106 self._enable_sigsegv_handler = False |
101 self._number_of_extraction_workers = 0 | 107 self._number_of_extraction_workers = 0 |
102 self._resolver_context = dfvfs_context.Context() | 108 self._resolver_context = dfvfs_context.Context() |
| 109 self._storage_serializer_format = definitions.SERIALIZER_FORMAT_JSON |
103 self._source_type = None | 110 self._source_type = None |
104 self._status_view = status_view.StatusView(self._output_writer, self.NAME) | 111 self._status_view = status_view.StatusView(self._output_writer, self.NAME) |
105 self._status_view_mode = self._DEFAULT_STATUS_VIEW_MODE | 112 self._status_view_mode = self._DEFAULT_STATUS_VIEW_MODE |
106 self._stdout_output_writer = isinstance( | 113 self._stdout_output_writer = isinstance( |
107 self._output_writer, cli_tools.StdoutOutputWriter) | 114 self._output_writer, tools.StdoutOutputWriter) |
108 self._storage_file_path = None | 115 self._storage_file_path = None |
109 self._temporary_directory = None | 116 self._temporary_directory = None |
110 self._text_prepend = None | 117 self._text_prepend = None |
111 self._use_zeromq = True | 118 self._use_zeromq = True |
112 self._worker_memory_limit = None | 119 self._worker_memory_limit = None |
113 | 120 |
114 self.dependencies_check = True | 121 self.dependencies_check = True |
115 self.list_output_modules = False | 122 self.list_output_modules = False |
116 self.show_info = False | 123 self.show_info = False |
117 | 124 |
118 def _CheckStorageFile(self, storage_file_path): | |
119 """Checks if the storage file path is valid. | |
120 | |
121 Args: | |
122 storage_file_path (str): path of the storage file. | |
123 | |
124 Raises: | |
125 BadConfigOption: if the storage file path is invalid. | |
126 """ | |
127 if os.path.exists(storage_file_path): | |
128 if not os.path.isfile(storage_file_path): | |
129 raise errors.BadConfigOption( | |
130 u'Storage file: {0:s} already exists and is not a file.'.format( | |
131 storage_file_path)) | |
132 logging.warning(u'Appending to an already existing storage file.') | |
133 | |
134 dirname = os.path.dirname(storage_file_path) | |
135 if not dirname: | |
136 dirname = u'.' | |
137 | |
138 # TODO: add a more thorough check to see if the storage file really is | |
139 # a plaso storage file. | |
140 | |
141 if not os.access(dirname, os.W_OK): | |
142 raise errors.BadConfigOption( | |
143 u'Unable to write to storage file: {0:s}'.format(storage_file_path)) | |
144 | |
145 def _CreateProcessingConfiguration(self): | 125 def _CreateProcessingConfiguration(self): |
146 """Creates a processing configuration. | 126 """Creates a processing configuration. |
147 | 127 |
148 Returns: | 128 Returns: |
149 ProcessingConfiguration: processing configuration. | 129 ProcessingConfiguration: processing configuration. |
150 """ | 130 """ |
151 # TODO: pass preferred_encoding. | 131 # TODO: pass preferred_encoding. |
152 configuration = configurations.ProcessingConfiguration() | 132 configuration = configurations.ProcessingConfiguration() |
153 configuration.credentials = self._credential_configurations | 133 configuration.credentials = self._credential_configurations |
154 configuration.debug_output = self._debug_mode | 134 configuration.debug_output = self._debug_mode |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 Args: | 208 Args: |
229 options (argparse.Namespace): command line arguments. | 209 options (argparse.Namespace): command line arguments. |
230 | 210 |
231 Raises: | 211 Raises: |
232 BadConfigOption: if the options are invalid. | 212 BadConfigOption: if the options are invalid. |
233 """ | 213 """ |
234 self._use_zeromq = getattr(options, u'use_zeromq', True) | 214 self._use_zeromq = getattr(options, u'use_zeromq', True) |
235 | 215 |
236 self._single_process_mode = getattr(options, u'single_process', False) | 216 self._single_process_mode = getattr(options, u'single_process', False) |
237 | 217 |
238 self._temporary_directory = getattr(options, u'temporary_directory', None) | 218 helpers_manager.ArgumentHelperManager.ParseOptions( |
239 if (self._temporary_directory and | 219 options, self, names=[u'temporary_directory']) |
240 not os.path.isdir(self._temporary_directory)): | |
241 raise errors.BadConfigOption( | |
242 u'No such temporary directory: {0:s}'.format( | |
243 self._temporary_directory)) | |
244 | 220 |
245 self._worker_memory_limit = getattr(options, u'worker_memory_limit', None) | 221 self._worker_memory_limit = getattr(options, u'worker_memory_limit', None) |
246 self._number_of_extraction_workers = getattr(options, u'workers', 0) | 222 self._number_of_extraction_workers = getattr(options, u'workers', 0) |
247 | 223 |
248 # TODO: add code to parse the worker options. | 224 # TODO: add code to parse the worker options. |
249 | 225 |
250 def AddOutputOptions(self, argument_group): | 226 def AddOutputOptions(self, argument_group): |
251 """Adds the output options to the argument group. | 227 """Adds the output options to the argument group. |
252 | 228 |
253 Args: | 229 Args: |
(...skipping 26 matching lines...) Expand all Loading... |
280 u'--disable_zeromq', u'--disable-zeromq', action=u'store_false', | 256 u'--disable_zeromq', u'--disable-zeromq', action=u'store_false', |
281 dest=u'use_zeromq', default=True, help=( | 257 dest=u'use_zeromq', default=True, help=( |
282 u'Disable queueing using ZeroMQ. A Multiprocessing queue will be ' | 258 u'Disable queueing using ZeroMQ. A Multiprocessing queue will be ' |
283 u'used instead.')) | 259 u'used instead.')) |
284 | 260 |
285 argument_group.add_argument( | 261 argument_group.add_argument( |
286 u'--single_process', u'--single-process', dest=u'single_process', | 262 u'--single_process', u'--single-process', dest=u'single_process', |
287 action=u'store_true', default=False, help=( | 263 action=u'store_true', default=False, help=( |
288 u'Indicate that the tool should run in a single process.')) | 264 u'Indicate that the tool should run in a single process.')) |
289 | 265 |
290 argument_group.add_argument( | 266 helpers_manager.ArgumentHelperManager.AddCommandLineArguments( |
291 u'--temporary_directory', u'--temporary-directory', | 267 argument_group, names=[u'temporary_directory']) |
292 dest=u'temporary_directory', type=str, action=u'store', | |
293 metavar=u'DIRECTORY', help=( | |
294 u'Path to the directory that should be used to store temporary ' | |
295 u'files created during extraction.')) | |
296 | 268 |
297 argument_group.add_argument( | 269 argument_group.add_argument( |
298 u'--worker-memory-limit', u'--worker_memory_limit', | 270 u'--worker-memory-limit', u'--worker_memory_limit', |
299 dest=u'worker_memory_limit', action=u'store', type=int, | 271 dest=u'worker_memory_limit', action=u'store', type=int, |
300 metavar=u'SIZE', help=( | 272 metavar=u'SIZE', help=( |
301 u'Maximum amount of memory a worker process is allowed to consume. ' | 273 u'Maximum amount of memory a worker process is allowed to consume. ' |
302 u'[defaults to 2 GiB]')) | 274 u'[defaults to 2 GiB]')) |
303 | 275 |
304 argument_group.add_argument( | 276 argument_group.add_argument( |
305 u'--workers', dest=u'workers', action=u'store', type=int, default=0, | 277 u'--workers', dest=u'workers', action=u'store', type=int, default=0, |
306 help=(u'The number of worker processes [defaults to available system ' | 278 help=(u'The number of worker processes [defaults to available system ' |
307 u'CPUs minus one].')) | 279 u'CPUs minus one].')) |
308 | 280 |
309 def ListOutputModules(self): | |
310 """Lists the output modules.""" | |
311 table_view = cli_views.ViewsFactory.GetTableView( | |
312 self._views_format_type, column_names=[u'Name', u'Description'], | |
313 title=u'Output Modules') | |
314 | |
315 for name, output_class in output_manager.OutputManager.GetOutputClasses(): | |
316 table_view.AddRow([name, output_class.DESCRIPTION]) | |
317 table_view.Write(self._output_writer) | |
318 | |
319 disabled_classes = list( | |
320 output_manager.OutputManager.GetDisabledOutputClasses()) | |
321 if not disabled_classes: | |
322 return | |
323 | |
324 table_view = cli_views.ViewsFactory.GetTableView( | |
325 self._views_format_type, column_names=[u'Name', u'Description'], | |
326 title=u'Disabled Output Modules') | |
327 for name, output_class in disabled_classes: | |
328 table_view.AddRow([name, output_class.DESCRIPTION]) | |
329 table_view.Write(self._output_writer) | |
330 | |
331 def ParseArguments(self): | 281 def ParseArguments(self): |
332 """Parses the command line arguments. | 282 """Parses the command line arguments. |
333 | 283 |
334 Returns: | 284 Returns: |
335 bool: True if the arguments were successfully parsed. | 285 bool: True if the arguments were successfully parsed. |
336 """ | 286 """ |
337 self._ConfigureLogging() | 287 self._ConfigureLogging() |
338 | 288 |
339 argument_parser = argparse.ArgumentParser( | 289 argument_parser = argparse.ArgumentParser( |
340 description=self.DESCRIPTION, epilog=self.EPILOG, add_help=False, | 290 description=self.DESCRIPTION, epilog=self.EPILOG, add_help=False, |
341 formatter_class=argparse.RawDescriptionHelpFormatter) | 291 formatter_class=argparse.RawDescriptionHelpFormatter) |
342 | 292 |
343 self.AddBasicOptions(argument_parser) | 293 self.AddBasicOptions(argument_parser) |
344 | 294 |
| 295 helpers_manager.ArgumentHelperManager.AddCommandLineArguments( |
| 296 argument_parser, names=[u'storage_file']) |
| 297 |
345 extraction_group = argument_parser.add_argument_group( | 298 extraction_group = argument_parser.add_argument_group( |
346 u'Extraction Arguments') | 299 u'Extraction Arguments') |
347 | 300 |
348 self.AddExtractionOptions(extraction_group) | 301 self.AddExtractionOptions(extraction_group) |
349 self.AddFilterOptions(extraction_group) | 302 |
| 303 helpers_manager.ArgumentHelperManager.AddCommandLineArguments( |
| 304 argument_parser, names=[u'filter_file']) |
| 305 |
350 self.AddStorageMediaImageOptions(extraction_group) | 306 self.AddStorageMediaImageOptions(extraction_group) |
351 self.AddTimeZoneOption(extraction_group) | 307 self.AddTimeZoneOption(extraction_group) |
352 self.AddVSSProcessingOptions(extraction_group) | 308 self.AddVSSProcessingOptions(extraction_group) |
353 self.AddCredentialOptions(extraction_group) | 309 self.AddCredentialOptions(extraction_group) |
354 | 310 |
355 info_group = argument_parser.add_argument_group(u'Informational Arguments') | 311 info_group = argument_parser.add_argument_group(u'Informational Arguments') |
356 | 312 |
357 self.AddInformationalOptions(info_group) | 313 self.AddInformationalOptions(info_group) |
358 | 314 |
359 info_group.add_argument( | 315 info_group.add_argument( |
360 u'--info', dest=u'show_info', action=u'store_true', default=False, | 316 u'--info', dest=u'show_info', action=u'store_true', default=False, |
361 help=u'Print out information about supported plugins and parsers.') | 317 help=u'Print out information about supported plugins and parsers.') |
362 | 318 |
363 info_group.add_argument( | 319 info_group.add_argument( |
364 u'--use_markdown', u'--use-markdown', dest=u'use_markdown', | 320 u'--use_markdown', u'--use-markdown', dest=u'use_markdown', |
365 action=u'store_true', default=False, help=( | 321 action=u'store_true', default=False, help=( |
366 u'Output lists in Markdown format use in combination with ' | 322 u'Output lists in Markdown format use in combination with ' |
367 u'"--hashers list", "--parsers list" or "--timezone list"')) | 323 u'"--hashers list", "--parsers list" or "--timezone list"')) |
368 | 324 |
369 info_group.add_argument( | 325 info_group.add_argument( |
370 u'--no_dependencies_check', u'--no-dependencies-check', | 326 u'--no_dependencies_check', u'--no-dependencies-check', |
371 dest=u'dependencies_check', action=u'store_false', default=True, | 327 dest=u'dependencies_check', action=u'store_false', default=True, |
372 help=u'Disable the dependencies check.') | 328 help=u'Disable the dependencies check.') |
373 | 329 |
374 self.AddLogFileOptions(info_group) | 330 self.AddLogFileOptions(info_group) |
375 | 331 |
376 info_group.add_argument( | 332 helpers_manager.ArgumentHelperManager.AddCommandLineArguments( |
377 u'--status_view', u'--status-view', dest=u'status_view_mode', | 333 info_group, names=[u'status_view']) |
378 choices=[u'linear', u'none', u'window'], action=u'store', | |
379 metavar=u'TYPE', default=self._DEFAULT_STATUS_VIEW_MODE, help=( | |
380 u'The processing status view mode: "linear", "none" or "window".')) | |
381 | 334 |
382 output_group = argument_parser.add_argument_group(u'Output Arguments') | 335 output_group = argument_parser.add_argument_group(u'Output Arguments') |
383 | 336 |
384 self.AddOutputOptions(output_group) | 337 self.AddOutputOptions(output_group) |
385 | 338 |
386 processing_group = argument_parser.add_argument_group( | 339 processing_group = argument_parser.add_argument_group( |
387 u'Processing Arguments') | 340 u'Processing Arguments') |
388 | 341 |
389 self.AddDataLocationOption(processing_group) | 342 helpers_manager.ArgumentHelperManager.AddCommandLineArguments( |
| 343 processing_group, names=[u'data_location']) |
| 344 |
390 self.AddPerformanceOptions(processing_group) | 345 self.AddPerformanceOptions(processing_group) |
391 self.AddProfilingOptions(processing_group) | 346 self.AddProfilingOptions(processing_group) |
392 self.AddProcessingOptions(processing_group) | 347 self.AddProcessingOptions(processing_group) |
393 | 348 |
394 processing_group.add_argument( | 349 processing_group.add_argument( |
395 u'--sigsegv_handler', u'--sigsegv-handler', dest=u'sigsegv_handler', | 350 u'--sigsegv_handler', u'--sigsegv-handler', dest=u'sigsegv_handler', |
396 action=u'store_true', default=False, help=( | 351 action=u'store_true', default=False, help=( |
397 u'Enables the SIGSEGV handler. WARNING this functionality is ' | 352 u'Enables the SIGSEGV handler. WARNING this functionality is ' |
398 u'experimental and will a deadlock worker process if a real ' | 353 u'experimental and will a deadlock worker process if a real ' |
399 u'segfault is caught, but not signal SIGSEGV. This functionality ' | 354 u'segfault is caught, but not signal SIGSEGV. This functionality ' |
400 u'is therefore primarily intended for debugging purposes')) | 355 u'is therefore primarily intended for debugging purposes')) |
401 | 356 |
402 argument_parser.add_argument( | 357 argument_parser.add_argument( |
403 u'output', action=u'store', metavar=u'STORAGE_FILE', nargs=u'?', | |
404 type=str, help=( | |
405 u'The path to the output file, if the file exists it will get ' | |
406 u'appended to.')) | |
407 | |
408 argument_parser.add_argument( | |
409 self._SOURCE_OPTION, action=u'store', metavar=u'SOURCE', nargs=u'?', | 358 self._SOURCE_OPTION, action=u'store', metavar=u'SOURCE', nargs=u'?', |
410 default=None, type=str, help=( | 359 default=None, type=str, help=( |
411 u'The path to the source device, file or directory. If the source ' | 360 u'The path to the source device, file or directory. If the source ' |
412 u'is a supported storage media device or image file, archive file ' | 361 u'is a supported storage media device or image file, archive file ' |
413 u'or a directory, the files within are processed recursively.')) | 362 u'or a directory, the files within are processed recursively.')) |
414 | 363 |
415 try: | 364 try: |
416 options = argument_parser.parse_args() | 365 options = argument_parser.parse_args() |
417 except UnicodeEncodeError: | 366 except UnicodeEncodeError: |
418 # If we get here we are attempting to print help in a non-Unicode | 367 # If we get here we are attempting to print help in a non-Unicode |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 """ | 411 """ |
463 # Check the list options first otherwise required options will raise. | 412 # Check the list options first otherwise required options will raise. |
464 self._ParseExtractionOptions(options) | 413 self._ParseExtractionOptions(options) |
465 self._ParseOutputOptions(options) | 414 self._ParseOutputOptions(options) |
466 self._ParseProfilingOptions(options) | 415 self._ParseProfilingOptions(options) |
467 self._ParseTimezoneOption(options) | 416 self._ParseTimezoneOption(options) |
468 | 417 |
469 self.show_info = getattr(options, u'show_info', False) | 418 self.show_info = getattr(options, u'show_info', False) |
470 | 419 |
471 if getattr(options, u'use_markdown', False): | 420 if getattr(options, u'use_markdown', False): |
472 self._views_format_type = cli_views.ViewsFactory.FORMAT_TYPE_MARKDOWN | 421 self._views_format_type = views.ViewsFactory.FORMAT_TYPE_MARKDOWN |
473 | 422 |
474 self.dependencies_check = getattr(options, u'dependencies_check', True) | 423 self.dependencies_check = getattr(options, u'dependencies_check', True) |
475 | 424 |
476 if (self.list_hashers or self.list_output_modules or | 425 if (self.list_hashers or self.list_output_modules or |
477 self.list_parsers_and_plugins or self.list_profilers or | 426 self.list_parsers_and_plugins or self.list_profilers or |
478 self.list_timezones or self.show_info): | 427 self.list_timezones or self.show_info): |
479 return | 428 return |
480 | 429 |
481 super(Log2TimelineTool, self).ParseOptions(options) | 430 self._ParseInformationalOptions(options) |
| 431 |
| 432 helpers_manager.ArgumentHelperManager.ParseOptions( |
| 433 options, self, names=[u'data_location']) |
| 434 |
| 435 self._ParseLogFileOptions(options) |
| 436 |
| 437 self._ParseStorageMediaOptions(options) |
| 438 |
| 439 helpers_manager.ArgumentHelperManager.ParseOptions( |
| 440 options, self, names=[u'filter_file']) |
| 441 |
| 442 self._ParsePerformanceOptions(options) |
482 self._ParseOutputOptions(options) | 443 self._ParseOutputOptions(options) |
483 self._ParseProcessingOptions(options) | 444 self._ParseProcessingOptions(options) |
484 | 445 |
485 format_string = ( | 446 format_string = ( |
486 u'%(asctime)s [%(levelname)s] (%(processName)-10s) PID:%(process)d ' | 447 u'%(asctime)s [%(levelname)s] (%(processName)-10s) PID:%(process)d ' |
487 u'<%(module)s> %(message)s') | 448 u'<%(module)s> %(message)s') |
488 | 449 |
489 if self._debug_mode: | 450 if self._debug_mode: |
490 logging_level = logging.DEBUG | 451 logging_level = logging.DEBUG |
491 elif self._quiet_mode: | 452 elif self._quiet_mode: |
492 logging_level = logging.WARNING | 453 logging_level = logging.WARNING |
493 else: | 454 else: |
494 logging_level = logging.INFO | 455 logging_level = logging.INFO |
495 | 456 |
496 self.ParseLogFileOptions(options) | |
497 self._ConfigureLogging( | 457 self._ConfigureLogging( |
498 filename=self._log_file, format_string=format_string, | 458 filename=self._log_file, format_string=format_string, |
499 log_level=logging_level) | 459 log_level=logging_level) |
500 | 460 |
501 if self._debug_mode: | 461 if self._debug_mode: |
502 log_filter = logging_filter.LoggingFilter() | 462 log_filter = logging_filter.LoggingFilter() |
503 root_logger = logging.getLogger() | 463 root_logger = logging.getLogger() |
504 root_logger.addFilter(log_filter) | 464 root_logger.addFilter(log_filter) |
505 | 465 |
506 self._storage_file_path = self.ParseStringOption(options, u'output') | 466 helpers_manager.ArgumentHelperManager.ParseOptions( |
| 467 options, self, names=[u'storage_file']) |
| 468 |
507 if not self._storage_file_path: | 469 if not self._storage_file_path: |
508 raise errors.BadConfigOption(u'No storage file path defined.') | 470 raise errors.BadConfigOption(u'Missing storage file option.') |
| 471 |
| 472 serializer_format = getattr( |
| 473 options, u'serializer_format', definitions.SERIALIZER_FORMAT_JSON) |
| 474 if serializer_format not in definitions.SERIALIZER_FORMATS: |
| 475 raise errors.BadConfigOption( |
| 476 u'Unsupported storage serializer format: {0:s}.'.format( |
| 477 serializer_format)) |
| 478 self._storage_serializer_format = serializer_format |
509 | 479 |
510 # TODO: where is this defined? | 480 # TODO: where is this defined? |
511 self._operating_system = getattr(options, u'os', None) | 481 self._operating_system = getattr(options, u'os', None) |
512 | 482 |
513 if self._operating_system: | 483 if self._operating_system: |
514 self._mount_path = getattr(options, u'filename', None) | 484 self._mount_path = getattr(options, u'filename', None) |
515 | 485 |
516 self._status_view_mode = getattr( | 486 helpers_manager.ArgumentHelperManager.ParseOptions( |
517 options, u'status_view_mode', self._DEFAULT_STATUS_VIEW_MODE) | 487 options, self, names=[u'status_view']) |
518 | 488 |
519 self._enable_sigsegv_handler = getattr(options, u'sigsegv_handler', False) | 489 self._enable_sigsegv_handler = getattr(options, u'sigsegv_handler', False) |
520 | 490 |
521 def _PreprocessSources(self, extraction_engine): | 491 def _PreprocessSources(self, extraction_engine): |
522 """Preprocesses the sources. | 492 """Preprocesses the sources. |
523 | 493 |
524 Args: | 494 Args: |
525 extraction_engine (BaseEngine): extraction engine to preprocess | 495 extraction_engine (BaseEngine): extraction engine to preprocess |
526 the sources. | 496 the sources. |
527 """ | 497 """ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 | 625 |
656 self._status_view.PrintExtractionSummary(processing_status) | 626 self._status_view.PrintExtractionSummary(processing_status) |
657 | 627 |
658 def ShowInfo(self): | 628 def ShowInfo(self): |
659 """Shows information about available hashers, parsers, plugins, etc.""" | 629 """Shows information about available hashers, parsers, plugins, etc.""" |
660 self._output_writer.Write( | 630 self._output_writer.Write( |
661 u'{0:=^80s}\n'.format(u' log2timeline/plaso information ')) | 631 u'{0:=^80s}\n'.format(u' log2timeline/plaso information ')) |
662 | 632 |
663 plugin_list = self._GetPluginData() | 633 plugin_list = self._GetPluginData() |
664 for header, data in plugin_list.items(): | 634 for header, data in plugin_list.items(): |
665 table_view = cli_views.ViewsFactory.GetTableView( | 635 table_view = views.ViewsFactory.GetTableView( |
666 self._views_format_type, column_names=[u'Name', u'Description'], | 636 self._views_format_type, column_names=[u'Name', u'Description'], |
667 title=header) | 637 title=header) |
668 for entry_header, entry_data in sorted(data): | 638 for entry_header, entry_data in sorted(data): |
669 table_view.AddRow([entry_header, entry_data]) | 639 table_view.AddRow([entry_header, entry_data]) |
670 table_view.Write(self._output_writer) | 640 table_view.Write(self._output_writer) |
OLD | NEW |