def Main(): """The main function.""" tool = log2timeline_tool.Log2TimelineTool() if not tool.ParseArguments(sys.argv[1:]): return False if tool.show_info: tool.ShowInfo() return True if tool.show_troubleshooting: print('Using Python version {0!s}'.format(sys.version)) print() print('Path: {0:s}'.format(os.path.abspath(__file__))) print() print(tool.GetVersionInformation()) print() dependencies.CheckDependencies(verbose_output=True) print('Also see: https://plaso.readthedocs.io/en/latest/sources/user/' 'Troubleshooting.html') return True have_list_option = False if tool.list_hashers: tool.ListHashers() have_list_option = True if tool.list_parsers_and_plugins: tool.ListParsersAndPlugins() have_list_option = True if tool.list_profilers: tool.ListProfilers() have_list_option = True if tool.list_timezones: tool.ListTimeZones() have_list_option = True if have_list_option: return True if tool.dependencies_check and not dependencies.CheckDependencies( verbose_output=False): return False try: tool.ExtractEventsFromSources() except (KeyboardInterrupt, errors.UserAbort): logging.warning('Aborted by user.') return False except (errors.BadConfigOption, errors.SourceScannerError) as exception: logging.warning(exception) return False return True
def Main(): """The main function.""" tool = pinfo_tool.PinfoTool() if not tool.ParseArguments(): return False if tool.show_troubleshooting: print('Using Python version {0!s}'.format(sys.version)) print() print('Path: {0:s}'.format(os.path.abspath(__file__))) print() print(tool.GetVersionInformation()) print() dependencies.CheckDependencies(verbose_output=True) print('Also see: https://plaso.readthedocs.io/en/latest/sources/user/' 'Troubleshooting.html') return True result = True try: if tool.compare_storage_information: result = tool.CompareStores() else: tool.PrintStorageInformation() except errors.BadConfigOption as exception: logging.warning(exception) return False return result
def Main(): """The main function.""" tool = pinfo_tool.PinfoTool() if not tool.ParseArguments(sys.argv[1:]): return False if tool.show_troubleshooting: print('Using Python version {0!s}'.format(sys.version)) print() print('Path: {0:s}'.format(os.path.abspath(__file__))) print() print(tool.GetVersionInformation()) print() dependencies.CheckDependencies(verbose_output=True) print('Also see: https://plaso.readthedocs.io/en/latest/sources/user/' 'Troubleshooting.html') return True try: tool.CheckOutDated() except KeyboardInterrupt: return False have_list_option = False if tool.list_reports: tool.ListReports() have_list_option = True if tool.list_sections: tool.ListSections() have_list_option = True if have_list_option: return True result = True try: if tool.compare_storage_information: result = tool.CompareStores() elif tool.generate_report: tool.GenerateReport() else: tool.PrintStorageInformation() # Writing to stdout and stderr will raise BrokenPipeError if it # receives a SIGPIPE. except BrokenPipeError: pass except (KeyboardInterrupt, errors.UserAbort): logging.warning('Aborted by user.') return False except errors.BadConfigOption as exception: logging.warning(exception) return False return result
def Main(): """The main function. Returns: bool: True if successful or False otherwise. """ tool = image_export_tool.ImageExportTool() if not tool.ParseArguments(sys.argv[1:]): return False if tool.show_troubleshooting: print('Using Python version {0!s}'.format(sys.version)) print() print('Path: {0:s}'.format(os.path.abspath(__file__))) print() print(tool.GetVersionInformation()) print() dependencies.CheckDependencies(verbose_output=True) print('Also see: https://plaso.readthedocs.io/en/latest/sources/user/' 'Troubleshooting.html') return True try: tool.CheckOutDated() except KeyboardInterrupt: return False if tool.list_signature_identifiers: tool.ListSignatureIdentifiers() return True if not tool.has_filters: logging.warning('No filter defined exporting all files.') # TODO: print more status information like PrintOptions. tool.PrintFilterCollection() try: tool.ProcessSources() except (KeyboardInterrupt, errors.UserAbort): logging.warning('Aborted by user.') return False except errors.BadConfigOption as exception: logging.warning(exception) return False except errors.SourceScannerError as exception: logging.warning(( 'Unable to scan for a supported filesystem with error: {0!s}\n' 'Most likely the image format is not supported by the ' 'tool.').format(exception)) return False return True
def Main(): """The main function.""" input_reader = cli_tools.StdinInputReader() tool = psort_tool.PsortTool(input_reader=input_reader) if not tool.ParseArguments(sys.argv[1:]): return False if tool.show_troubleshooting: print('Using Python version {0!s}'.format(sys.version)) print() print('Path: {0:s}'.format(os.path.abspath(__file__))) print() print(tool.GetVersionInformation()) print() dependencies.CheckDependencies(verbose_output=True) print('Also see: https://plaso.readthedocs.io/en/latest/sources/user/' 'Troubleshooting.html') return True try: tool.CheckOutDated() except KeyboardInterrupt: return False have_list_option = False if tool.list_analysis_plugins: tool.ListAnalysisPlugins() have_list_option = True if tool.list_output_modules: tool.ListOutputModules() have_list_option = True if tool.list_language_identifiers: tool.ListLanguageIdentifiers() have_list_option = True if tool.list_timezones: tool.ListTimeZones() have_list_option = True if have_list_option: return True try: tool.ProcessStorage() except (KeyboardInterrupt, errors.UserAbort): logging.warning('Aborted by user.') return False except errors.BadConfigOption as exception: logging.warning(exception) return False return True
def Main(): """The main function.""" multiprocessing.freeze_support() tool = log2timeline_tool.Log2TimelineTool() if not tool.ParseArguments(): return False if tool.show_info: tool.ShowInfo() return True have_list_option = False if tool.list_hashers: tool.ListHashers() have_list_option = True if tool.list_parsers_and_plugins: tool.ListParsersAndPlugins() have_list_option = True if tool.list_output_modules: tool.ListOutputModules() have_list_option = True if tool.list_profilers: tool.ListProfilers() have_list_option = True if tool.list_timezones: tool.ListTimeZones() have_list_option = True if have_list_option: return True if tool.dependencies_check and not dependencies.CheckDependencies( verbose_output=False): return False try: tool.ExtractEventsFromSources() except (KeyboardInterrupt, errors.UserAbort): logging.warning(u'Aborted by user.') return False except (errors.BadConfigOption, errors.SourceScannerError) as exception: logging.warning(exception) return False return True
def Main(): """The main function.""" tool = psteal_tool.PstealTool() if not tool.ParseArguments(sys.argv[1:]): return False if tool.show_troubleshooting: print('Using Python version {0!s}'.format(sys.version)) print() print('Path: {0:s}'.format(os.path.abspath(__file__))) print() print(tool.GetVersionInformation()) print() dependencies.CheckDependencies(verbose_output=True) print('Also see: https://plaso.readthedocs.io/en/latest/sources/user/' 'Troubleshooting.html') return True try: tool.CheckOutDated() except KeyboardInterrupt: return False have_list_option = False if tool.list_timezones: tool.ListTimeZones() have_list_option = True if tool.list_output_modules: tool.ListOutputModules() have_list_option = True if tool.list_timezones: tool.ListTimeZones() have_list_option = True if tool.list_parsers_and_plugins: tool.ListParsersAndPlugins() have_list_option = True if tool.list_hashers: tool.ListHashers() have_list_option = True if tool.list_language_identifiers: tool.ListLanguageIdentifiers() have_list_option = True if have_list_option: return True if tool.dependencies_check and not dependencies.CheckDependencies( verbose_output=False): return False try: tool.ExtractEventsFromSources() tool.AnalyzeEvents() # Writing to stdout and stderr will raise BrokenPipeError if it # receives a SIGPIPE. except BrokenPipeError: pass except (KeyboardInterrupt, errors.UserAbort): logging.warning('Aborted by user.') return False except errors.SourceScannerError as exception: logging.warning(exception) return False return True
def testCheckDependencies(self): """Tests the CheckDependencies function.""" result = dependencies.CheckDependencies(verbose_output=False) self.assertTrue(result)
def Main(): """The main function.""" tool = log2timeline_tool.Log2TimelineTool() if not tool.ParseArguments(sys.argv[1:]): return False if tool.show_troubleshooting: print('Using Python version {0!s}'.format(sys.version)) print() print('Path: {0:s}'.format(os.path.abspath(__file__))) print() print(tool.GetVersionInformation()) print() dependencies.CheckDependencies(verbose_output=True) print('Also see: https://plaso.readthedocs.io/en/latest/sources/user/' 'Troubleshooting.html') return True try: tool.CheckOutDated() except KeyboardInterrupt: return False if tool.show_info: tool.ShowInfo() return True have_list_option = False if tool.list_hashers: tool.ListHashers() have_list_option = True if tool.list_language_tags: tool.ListLanguageTags() have_list_option = True if tool.list_parsers_and_plugins: tool.ListParsersAndPlugins() have_list_option = True if tool.list_profilers: tool.ListProfilers() have_list_option = True if tool.list_time_zones: tool.ListTimeZones() have_list_option = True if have_list_option: return True if tool.dependencies_check and not dependencies.CheckDependencies( verbose_output=False): return False try: tool.ExtractEventsFromSources() # Writing to stdout and stderr will raise BrokenPipeError if it # receives a SIGPIPE. except BrokenPipeError: pass except (KeyboardInterrupt, errors.UserAbort): logging.warning('Aborted by user.') return False except (IOError, errors.BadConfigOption, errors.SourceScannerError) as exception: # Display message on stdout as well as the log file. print(exception) logging.error(exception) return False return True