Files
metasploit-gs/lib/msf/base/sessions/postgresql.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.1 KiB
Ruby
Raw Normal View History

2023-09-19 10:35:51 +01:00
# -*- coding: binary -*-
require 'rex/post/postgresql'
2024-02-21 18:01:55 +00:00
class Msf::Sessions::PostgreSQL < Msf::Sessions::Sql
2023-09-19 10:35:51 +01:00
# @param[Rex::IO::Stream] rstream
# @param [Hash] opts
# @param opts [PostgreSQL::Client] :client
def initialize(rstream, opts = {})
@client = opts.fetch(:client)
@console = ::Rex::Post::PostgreSQL::Ui::Console.new(self)
super(rstream, opts)
end
def bootstrap(datastore = {}, handler = nil)
session = self
session.init_ui(user_input, user_output)
@info = "PostgreSQL #{datastore['USERNAME']} @ #{@peer_info}"
end
#
# @return [String] The type of the session
#
def self.type
2024-02-14 15:26:34 +00:00
'postgresql'
2023-09-19 10:35:51 +01:00
end
#
# @return [Boolean] Can the session clean up after itself
def self.can_cleanup_files
false
end
#
# @return [String] The session description
#
def desc
'PostgreSQL'
end
def address
return @address if @address
@address, @port = @client.conn.peerinfo.split(':')
@address
end
def port
return @port if @port
@address, @port = @client.conn.peerinfo.split(':')
@port
end
end