CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/base/sessions/postgresql.rb
Views: 1904
1
# -*- coding: binary -*-
2
3
require 'rex/post/postgresql'
4
5
class Msf::Sessions::PostgreSQL < Msf::Sessions::Sql
6
7
# @param[Rex::IO::Stream] rstream
8
# @param [Hash] opts
9
# @param opts [Msf::Db::PostgresPR::Connection] :client
10
def initialize(rstream, opts = {})
11
@client = opts.fetch(:client)
12
self.platform = opts.fetch(:platform)
13
self.arch = opts.fetch(:arch)
14
@console = ::Rex::Post::PostgreSQL::Ui::Console.new(self)
15
super(rstream, opts)
16
end
17
18
def bootstrap(datastore = {}, handler = nil)
19
session = self
20
session.init_ui(user_input, user_output)
21
22
@info = "PostgreSQL #{datastore['USERNAME']} @ #{@peer_info}"
23
end
24
25
#
26
# @return [String] The type of the session
27
#
28
def self.type
29
'postgresql'
30
end
31
32
#
33
# @return [Boolean] Can the session clean up after itself
34
def self.can_cleanup_files
35
false
36
end
37
38
#
39
# @return [String] The session description
40
#
41
def desc
42
'PostgreSQL'
43
end
44
end
45
46