diff --git a/lib/msf/core/exploit/powershell.rb b/lib/msf/core/exploit/powershell.rb index c1251d32d8..65a3b28fa7 100644 --- a/lib/msf/core/exploit/powershell.rb +++ b/lib/msf/core/exploit/powershell.rb @@ -244,6 +244,7 @@ EOS def cmd_psh_payload(pay, payload_arch, opts={}) opts[:persist] ||= datastore['Powershell::persist'] opts[:prepend_sleep] ||= datastore['Powershell::prepend_sleep'] + opts[:method] ||= datastore['Powershell::method'] if opts[:encode_inner_payload] && opts[:encode_final_payload] raise RuntimeError, ":encode_inner_payload and :encode_final_payload are incompatible options" @@ -253,7 +254,7 @@ EOS raise RuntimeError, ":no_equals requires :encode_final_payload option to be used" end - psh_payload = case datastore['PSH::method'] + psh_payload = case opts[:method] when 'net' Msf::Util::EXE.to_win32pe_psh_net(framework, pay) when 'reflection' @@ -261,7 +262,9 @@ EOS when 'old' Msf::Util::EXE.to_win32pe_psh(framework, pay) when 'msil' - raise RuntimeError, "MSIL Powershell Technique no longer exists" + raise RuntimeError, "MSIL Powershell method no longer exists" + else + raise RuntimeError, "No Powershell method specified" end # Run our payload in a while loop