Files
metasploit-gs/lib/msf/core/exploit/ssh/options.rb
T

59 lines
1.3 KiB
Ruby
Raw Normal View History

2019-06-02 17:11:37 -05:00
# -*- coding: binary -*-
require 'net/ssh'
2019-06-02 17:11:37 -05:00
# Include this mixin if you want just the SSH datastore options
# (e.g., when using Metasploit::Framework::LoginScanner::SSH)
module Msf::Exploit::Remote::SSH
module Options
2019-06-02 17:11:37 -05:00
def initialize(info = {})
2019-06-06 12:33:54 -05:00
# HACK: Suppress already initialized constant warning
verbose, $VERBOSE = $VERBOSE, nil
2019-06-02 17:11:37 -05:00
super
2019-12-11 13:40:09 -06:00
register_options([Msf::Opt::RHOST, Msf::Opt::RPORT(22)])
2019-06-02 17:11:37 -05:00
register_advanced_options([
# See Msf::Ui::Console::Driver#on_variable_set
Msf::OptString.new(
2019-06-02 18:26:25 -05:00
'SSH_IDENT',
2019-06-02 17:11:37 -05:00
[
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']
)
2019-06-03 03:51:08 -05:00
ensure
2019-06-06 10:50:26 -05:00
# Restore warning
$VERBOSE = verbose
2019-06-02 17:11:37 -05:00
end
end
end