From d264802ce03be3e13dfc8220adc9e9bf40175bf3 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Fri, 21 Aug 2015 12:38:58 -0500 Subject: [PATCH] Consistency and API conformance changes to LES --- lib/msf/core/post/common.rb | 6 ++++-- .../multi/recon/local_exploit_suggester.rb | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/msf/core/post/common.rb b/lib/msf/core/post/common.rb index 6cbec94226..85e3af4d3a 100644 --- a/lib/msf/core/post/common.rb +++ b/lib/msf/core/post/common.rb @@ -305,12 +305,14 @@ module Msf::Post::Common # Special handle some cases that ARCH_TYPES won't recognize. # https://msdn.microsoft.com/en-us/library/aa384274.aspx case target_arch - when /i386/, /i686/ + when /i[3456]86|wow64/i return ARCH_X86 - when /amd64/i, /ia64/i + when /(amd|ia|x)64/i return ARCH_X86_64 end + # Detect tricky variants of architecture types upfront + # Rely on ARCH_TYPES to tell us a framework-recognizable ARCH. # Notice we're sorting ARCH_TYPES first, so that the longest string # goes first. This step is used because sometimes let's say if the target diff --git a/modules/post/multi/recon/local_exploit_suggester.rb b/modules/post/multi/recon/local_exploit_suggester.rb index f3ca1ca464..823c8b71e4 100644 --- a/modules/post/multi/recon/local_exploit_suggester.rb +++ b/modules/post/multi/recon/local_exploit_suggester.rb @@ -88,7 +88,9 @@ class Metasploit3 < Msf::Post def set_module_options(mod) - mod.datastore.merge!(self.datastore) + self.datastore.each_pair do |k,v| + mod.datastore[k] = v + end if !mod.datastore['SESSION'] && session.present? mod.datastore['SESSION'] = session.sid end @@ -120,6 +122,7 @@ class Metasploit3 < Msf::Post end end + def show_found_exploits if datastore['VERBOSE'] print_status("The following #{@local_exploits.length} exploit checks are being tried:") @@ -151,7 +154,9 @@ class Metasploit3 < Msf::Post # If the datastore option is true, a detailed description will show if datastore['SHOWDESCRIPTION'] # Formatting for the description text - print_line Rex::Text.wordwrap(Rex::Text.compress(m.description), 2, 70) + Rex::Text.wordwrap(Rex::Text.compress(m.description), 2, 70).split(/\n/).each do |line| + print_line line + end end else vprint_status("#{m.fullname}: #{checkcode.second}") @@ -163,12 +168,13 @@ class Metasploit3 < Msf::Post end end report_note( - :host => rhost, - :type => "les_results", - :data => results.inspect - ) + :host => rhost, + :type => "local.suggested_exploits", + :data => results + ) end + def is_check_interesting?(checkcode) [ Msf::Exploit::CheckCode::Vulnerable,