Sha256: 7928107ce5cc6dc1066b9e96d0c83ea4b4ca338729082f5dbfe97b6daf3023a2

Contents?: true

Size: 1.67 KB

Versions: 85

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

require 'bunny'

module PWN
  module Plugins
    # This plugin is used to interact w/ RabbitMQ via ruby.
    module RabbitMQ
      # Supported Method Parameters::
      # PWN::Plugins::RabbitMQ.open(
      #   hostname: 'required',
      #   port: 'optional - defaults to 5672',
      #   username: 'optional',
      #   password: 'optional'
      # )

      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

      # Supported Method Parameters::
      # PWN::Plugins::RabbitMQ.close(
      #   amqp_oject: amqp_conn1
      # )

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

      # Author(s):: 0day Inc. <support@0dayinc.com>

      public_class_method def self.authors
        "AUTHOR(S):
          0day Inc. <support@0dayinc.com>
        "
      end

      # Display Usage for this Module

      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
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
pwn-0.5.235 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.234 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.233 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.232 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.231 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.230 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.229 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.228 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.227 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.226 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.225 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.224 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.223 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.222 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.221 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.220 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.219 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.217 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.216 lib/pwn/plugins/rabbit_mq.rb
pwn-0.5.215 lib/pwn/plugins/rabbit_mq.rb