Module: Msf::Exploit::Remote::SSH::Options

Included in:
Msf::Exploit::Remote::SSH
Defined in:
lib/msf/core/exploit/remote/ssh/options.rb

Instance Method Summary collapse

Instance Method Details

#initialize(info = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/msf/core/exploit/remote/ssh/options.rb', line 10

def initialize(info = {})
  # HACK: Suppress already initialized constant warning
  verbose, $VERBOSE = $VERBOSE, nil

  super

  register_options([Msf::Opt::RHOST, Msf::Opt::RPORT(22)])

  register_advanced_options([
    # See Msf::Ui::Console::Driver#on_variable_set
    Msf::OptString.new(
      'SSH_IDENT',
      [
        true,
        'SSH client identification string',
        'SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3' # Ubuntu 18.04 LTS
      ]
    ),
    # Ugh, why weren't these advanced options CamelCase?
    Msf::OptInt.new(
      'SSH_TIMEOUT',
      [
        false,
        'Maximum SSH negotiation/authentication time in seconds',
        10
      ]
    ),
    Msf::OptBool.new(
      'SSH_DEBUG',
      [
        false,
        'Enable output of SSH protocol debugging information',
        false
      ]
    )
  ])

  # HACK: Bypass dynamic constant assignment error
  ::Net::SSH::Transport::ServerVersion.const_set(
    :PROTO_VERSION,
    datastore['SSH_IDENT']
  )
ensure
  # Restore warning
  $VERBOSE = verbose
end

#peerObject



65
66
67
# File 'lib/msf/core/exploit/remote/ssh/options.rb', line 65

def peer
  "#{rhost}:#{rport}"
end

#rhostObject



57
58
59
# File 'lib/msf/core/exploit/remote/ssh/options.rb', line 57

def rhost
  datastore['RHOST']
end

#rportObject



61
62
63
# File 'lib/msf/core/exploit/remote/ssh/options.rb', line 61

def rport
  datastore['RPORT']
end