class Metasploit::Aggregator::Http::Requester

a Requester takes in Request object and to send to a known port and protocol and receives a response that it also returns as a Request object

Public Class Methods

new(host, port) click to toggle source
# File lib/metasploit/aggregator/http/requester.rb, line 10
def initialize(host, port)
  @host = host
  @port = port
end

Public Instance Methods

close_connection(connection) click to toggle source
# File lib/metasploit/aggregator/http/requester.rb, line 34
def close_connection(connection)
  connection.close
end
get_connection(host, port) click to toggle source
# File lib/metasploit/aggregator/http/requester.rb, line 30
def get_connection(host, port)
  TCPSocket.new host, port
end
process_request(request) click to toggle source
# File lib/metasploit/aggregator/http/requester.rb, line 15
def process_request(request)
  socket = get_connection(@host, @port)
  write_request(socket, request)
  response_obj = Metasploit::Aggregator::Http::Responder.get_data(socket, true)
  close_connection(socket)
  response_obj
end
write_request(connection, request) click to toggle source
# File lib/metasploit/aggregator/http/requester.rb, line 23
def write_request(connection, request)
  request.headers.each do |header|
    connection.write(header)
  end
  connection.write(request.body) unless request.body.nil?
end