diff --git a/lib/msf/core/session_compatibility.rb b/lib/msf/core/session_compatibility.rb index bd02ecd149bb..c57269f2a286 100644 --- a/lib/msf/core/session_compatibility.rb +++ b/lib/msf/core/session_compatibility.rb @@ -101,6 +101,19 @@ def session_display_info alias :client :session + # + # Cached sysinfo, returns nil for non-meterpreter sessions + # + # @return [Hash,nil] + def sysinfo + begin + @sysinfo ||= session.sys.config.sysinfo + rescue NoMethodError + @sysinfo = nil + end + @sysinfo + end + # # Can be overridden by individual modules to add new commands #