Method: Msf::Sessions::Scriptable::ClassMethods#find_script_path

Defined in:
lib/msf/base/sessions/scriptable.rb

#find_script_path(script) ⇒ Object

If the script exists, return its path. Otherwise return nil



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/msf/base/sessions/scriptable.rb', line 15

def find_script_path(script)
  # Find the full file path of the specified argument
  check_paths =
    [
      script,
      ::File.join(script_base, "#{script}"),
      ::File.join(script_base, "#{script}.rb"),
      ::File.join(user_script_base, "#{script}"),
      ::File.join(user_script_base, "#{script}.rb")
    ]

  full_path = nil

  # Scan all of the path combinations
  check_paths.each { |path|
    if ::File.file?(path)
      full_path = path
      break
    end
  }

  full_path
end