Module: Msf::Exploit::Remote::SMB::Client::LocalPaths

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

Overview

Mixin for handling options related to local 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/local_paths.rb', line 6

def initialize(info = {})
  super
  register_options(
    [
      OptString.new('LPATH', [false, 'The path of the local file to utilize']),
      OptPath.new('FILE_LPATHS', [false, 'A file containing a list of local files to utilize'])
    ], self.class)
end

#local_pathsObject


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

def local_paths
  if datastore['FILE_LPATHS']
    IO.readlines(datastore['FILE_LPATHS']).map(&:strip)
  elsif datastore['LPATH']
    [datastore['LPATH']]
  end
end

#setupObject


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

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