Module: Msf::Auxiliary::ManageEngineXnode::Config

Included in:
Msf::Auxiliary::ManageEngineXnode
Defined in:
lib/msf/core/auxiliary/manage_engine_xnode/config.rb

Constant Summary collapse

CONFIG_FILE_DOES_NOT_EXIST =
1
CANNOT_READ_CONFIG_FILE =
2
DATA_TO_DUMP_EMPTY =
3
DATA_TO_DUMP_WRONG_FORMAT =
4

Instance Method Summary collapse

Instance Method Details

#ad_audit_plus_data_reposArray

Returns an array of data repositories that may exist in ManageEngine Audit Plus

Returns:

  • (Array)

    list of possible data repositories in ManageEngine Audit Plus



36
37
38
39
40
41
42
43
44
# File 'lib/msf/core/auxiliary/manage_engine_xnode/config.rb', line 36

def ad_audit_plus_data_repos
  [
    'AdapFileAuditLog',
    'AdapPowershellAuditLog',
    'AdapSysMonAuditLog',
    'AdapDNSAuditLog',
    'AdapADReplicationAuditLog',
  ]
end

#config_statusModule

Returns the full module so that config_status::<status> can be used in the modules importing this library as shorthand to access the error codes defined at the start of the module

Returns:

  • (Module)

    Msf::Auxiliary::ManageEngineXnode::Config



70
71
72
# File 'lib/msf/core/auxiliary/manage_engine_xnode/config.rb', line 70

def config_status
  Msf::Auxiliary::ManageEngineXnode::Config
end

#datasecurity_plus_data_reposArray

Returns an array of data repositories that may exist in ManageEngine DataSecurity Plus

Returns:

  • (Array)

    list of possible data repositories in ManageEngine DataSecurity Plus



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/msf/core/auxiliary/manage_engine_xnode/config.rb', line 50

def datasecurity_plus_data_repos
  [
    'DSPEmailAuditAttachments',
    'DSPEmailAuditReport',
    'DSPEndpointAuditReport',
    'DSPEndpointClassificationReport',
    'DSPEndpointIncidentReport',
    'DspEndpointPrinterAuditReport',
    'DspEndpointWebAuditReport',
    'DSPFileAnalysisAlerts',
    'RAAlertHistory',
    'RAIncidents',
    'RAViolationRecords',
  ]
end

#grab_config(config_file) ⇒ Hash, Integer

Reads the configuration file for the current ManageEngine Xnode module in order to obtain the data repositories (tables) and fields (columns) to dump.

Parameters:

  • config_file (String)

    String containing the full path to the configuration file to read.

Returns:

  • (Hash, Integer)

    Hash containing the data repositories (tables) and their fields (columns) to dump if reading the config file succeeded, error code otherwise



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/msf/core/auxiliary/manage_engine_xnode/config.rb', line 13

def grab_config(config_file)
  # get the specified data repositories (tables) and fields (columns) to dump from the config file
  return CONFIG_FILE_DOES_NOT_EXIST unless File.exists? config_file

  begin
    config_contents = File.read(config_file)
    data_to_dump = YAML.safe_load((config_contents))
  rescue StandardError => e
    print_error("Encountered the following error while trying to load #{config_file}:")
    print_error(e.to_s)
    return CANNOT_READ_CONFIG_FILE
  end

  return DATA_TO_DUMP_EMPTY if data_to_dump.empty?

  return DATA_TO_DUMP_WRONG_FORMAT unless data_to_dump.instance_of?(Hash)

  data_to_dump
end