Module: PWN::Plugins::RabbitMQ

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

Overview

This plugin is used to interact w/ RabbitMQ via ruby.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



44
45
46
47
48
# File 'lib/pwn/plugins/rabbit_mq.rb', line 44

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

.close(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::RabbitMQ.close(

amqp_oject: amqp_conn1

)



35
36
37
38
39
40
# File 'lib/pwn/plugins/rabbit_mq.rb', line 35

public_class_method def self.close(opts = {})
  this_amqp_obj = opts[:amqp_obj]
  this_amqp_obj.close_connection
rescue StandardError => e
  raise e
end

.helpObject

Display Usage for this Module



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/pwn/plugins/rabbit_mq.rb', line 52

public_class_method def self.help
  puts %{USAGE:
    amqp_conn1 = #{self}.open(
      hostname: 'required',
      port: 'optional - defaults to 5672',
      username: 'optional',
      password: 'optional'
    )

    #{self}.close(
      amqp_oject: amqp_conn1
    )

    #{self}.authors
  }
end

.open(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::RabbitMQ.open(

hostname: 'required',
port: 'optional - defaults to 5672',
username: 'optional',
password: 'optional'

)



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pwn/plugins/rabbit_mq.rb', line 17

public_class_method def self.open(opts = {})
  host = opts[:hostname].to_s
  port = opts[:port].to_i
  port = 5672 unless port.positive?
  user = opts[:username].to_s
  pass = opts[:password].to_s

  this_amqp_obj = Bunny.new("amqp://#{user}:#{pass}@#{host}:#{port}")
  this_amqp_obj.start
rescue StandardError => e
  raise e
end