Module: PWN::Plugins::Vsphere

Defined in:
lib/pwn/plugins/vsphere.rb

Overview

This plugin is used for interacting w/ VMware ESXI’s REST API using the ‘rest’ browser type of PWN::Plugins::TransparentBrowser.

Constant Summary collapse

@@logger =
PWN::Plugins::PWNLogger.create

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



56
57
58
59
60
# File 'lib/pwn/plugins/vsphere.rb', line 56

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.helpObject

Display Usage for this Module



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/pwn/plugins/vsphere.rb', line 64

public_class_method def self.help
  puts "USAGE:
    vsphere_obj = #{self}.login(
      host: 'required - vsphere host or ip',
      username: 'required - username',
      password: 'optional - password (will prompt if nil)',
      insecure: 'optional - ignore ssl checks (defaults to false)
    )

    vsphere_obj = #{self}.logout(
      vsphere_obj: 'required vsphere_obj returned from #login method'
    )

    #{self}.authors
  "
end

.login(opts = {}) ⇒ Object

Supported Method Parameters

vsphere_obj = PWN::Plugins::Vsphere.login(

host: 'required - vsphere host or ip',
username: 'required - username',
password: 'optional - password (will prompt if nil)',
insecure: 'optional - ignore ssl checks (defaults to false)

)



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pwn/plugins/vsphere.rb', line 20

public_class_method def self.(opts = {})
  host = opts[:host].to_s.scrub
  username = opts[:username].to_s.scrub
  password = if opts[:password].nil?
               PWN::Plugins::AuthenticationHelper.mask_password
             else
               opts[:password].to_s.scrub
             end
  insecure = opts[:insecure] ||= false

  @@logger.info("Logging into vSphere: #{host}")
  RbVmomi::VIM.connect(
    host: host,
    user: username,
    password: password,
    insecure: insecure
  )
rescue StandardError => e
  raise e
end

.logout(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::HackerOne.logout(

vsphere_obj: 'required vsphere_obj returned from #login method'

)



46
47
48
49
50
51
52
# File 'lib/pwn/plugins/vsphere.rb', line 46

public_class_method def self.logout(opts = {})
  vsphere_obj = opts[:vsphere_obj]
  @@logger.info('Logging out...')
  vsphere_obj = nil
rescue StandardError => e
  raise e
end