Module: Msf::Exploit::Remote::SMB::Client::RemotePaths

Defined in:
lib/msf/core/exploit/smb/client/remote_paths.rb

Overview

Mixin for handling options related to remote files in SMB modules

Instance Method Summary collapse

Instance Method Details

#initialize(info = {}) ⇒ Object


6
7
8
9
10
11
12
13
# File 'lib/msf/core/exploit/smb/client/remote_paths.rb', line 6

def initialize(info = {})
  super
  register_options(
    [
      OptString.new('RPATH', [false, 'The name of the remote file relative to the share to operate on']),
      OptPath.new('FILE_RPATHS', [false, 'A file containing a list remote files relative to the share to operate on'])
    ], self.class)
end

#remote_pathsObject


21
22
23
24
25
26
27
# File 'lib/msf/core/exploit/smb/client/remote_paths.rb', line 21

def remote_paths
  if datastore['FILE_RPATHS']
    IO.readlines(datastore['FILE_RPATHS']).map(&:strip)
  elsif datastore['RPATH']
    [datastore['RPATH']]
  end
end

#setupObject


15
16
17
18
19
# File 'lib/msf/core/exploit/smb/client/remote_paths.rb', line 15

def setup
  unless (datastore['FILE_RPATHS'] && !datastore['RPATH']) || (!datastore['FILE_RPATHS'] && datastore['RPATH'])
    fail_with(::Msf::Module::Failure::BadConfig, 'One and only one of FILE_RPATHS or RPATH must be specified')
  end
end