<commit_before>require 'MiqVm/MiqVm'
require 'metadata/util/md5deep'
require 'util/miq-xml'
require 'util/miq-logger'
require 'ostruct'
require 'metadata/util/win32/Win32Accounts'
require 'metadata/util/win32/Win32Software'
require 'metadata/util/win32/Win32Services'
require 'metadata/util/win32/Win32System'
require 'metadata/util/win32/Win32EventLog'
require 'metadata/linux/LinuxUsers'
require 'metadata/linux/LinuxPackages'
require 'metadata/linux/LinuxInitProcs'
require 'metadata/linux/LinuxSystemd'
require 'metadata/linux/LinuxOSInfo'
require 'metadata/ScanProfile/VmScanProfiles'
require 'VMwareWebService/MiqVim'
require 'util/miq-password'
require 'VMwareWebService/MiqVimBroker'

class MIQExtract
	attr_reader :systemFsMsg, :systemFs, :vm

	def initialize(filename, ost=nil) # TODO: Always pass in MiqVm

    ost ||= OpenStruct.new
    @ost = ost
    @dataDir = ost.config ? ost.config.dataDir : nil
    ost.scanData = {} if ost.scanData.nil?
    @xml_class = ost.xml_class.nil? ? XmlHash::Document : ost.xml_class

    # TODO: Should all be subclasses of MiqVm.
    #       Going forward, we should only pass in an MiqVm - so the "else" will be removed.
		if filename.kind_of?(MiqVm) || filename.kind_of?(MiqOpenStackImage) || filename.kind_of?(MiqOpenStackInstance)
			@externalMount = true
			@vm = filename
			@vmCfgFile = @vm.vmConfigFile

      $log.info "MIQExtract using config file: [#{@vmCfgFile}]  settings: [#{MiqPassword.sanitize_string(ost.scanData.inspect)}]"<commit_msg>Added "require" statements needed for standalone usage.<commit_after>require 'MiqVm/MiqVm'
require 'metadata/util/md5deep'
require 'util/miq-xml'
require 'util/miq-logger'
require 'ostruct'
require 'metadata/util/win32/Win32Accounts'
require 'metadata/util/win32/Win32Software'
require 'metadata/util/win32/Win32Services'
require 'metadata/util/win32/Win32System'
require 'metadata/util/win32/Win32EventLog'
require 'metadata/linux/LinuxUsers'
require 'metadata/linux/LinuxPackages'
require 'metadata/linux/LinuxInitProcs'
require 'metadata/linux/LinuxSystemd'
require 'metadata/linux/LinuxOSInfo'
require 'metadata/ScanProfile/VmScanProfiles'
require 'VMwareWebService/MiqVim'
require 'OpenStackExtract/MiqOpenStackVm/MiqOpenStackImage'
require 'OpenStackExtract/MiqOpenStackVm/MiqOpenStackInstance'
require 'util/miq-password'
require 'VMwareWebService/MiqVimBroker'

class MIQExtract
	attr_reader :systemFsMsg, :systemFs, :vm

	def initialize(filename, ost=nil) # TODO: Always pass in MiqVm

    ost ||= OpenStruct.new
    @ost = ost
    @dataDir = ost.config ? ost.config.dataDir : nil
    ost.scanData = {} if ost.scanData.nil?
    @xml_class = ost.xml_class.nil? ? XmlHash::Document : ost.xml_class

    # TODO: Should all be subclasses of MiqVm.
    #       Going forward, we should only pass in an MiqVm - so the "else" will be removed.
		if filename.kind_of?(MiqVm) || filename.kind_of?(MiqOpenStackImage) || filename.kind_of?(MiqOpenStackInstance)
			@externalMount = true
			@vm = filename
			@vmCfgFile = @vm.vmConfigFile

      $log.info "MIQExtract using config file: [#{@vmCfgFile}]  settings: [#{MiqPassword.sanitize_string(ost.scanData.inspect)}]"
{'fraction_non_alphanumeric': 0.11413215301928549, 'fraction_numerical': 0.013278533038254822, 'mean_word_length': 5.302788844621514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5620361', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1076, 'n_words': 223}