@@ -248,7 +248,7 @@ def self.to_win32pe(framework, code, opts = {})
248248 end
249249
250250 # use
251- self . to_win32pe_exe_sub ( framework , code , opts )
251+ return self . to_win32pe_exe_sub ( framework , code , opts )
252252 end
253253
254254 # Allow the user to specify their own EXE template
@@ -630,7 +630,6 @@ def self.to_win32pe_exe_sub(framework, code, opts = {})
630630 opts [ :exe_type ] = :exe_sub
631631 exe_sub_method ( code , opts )
632632 end
633-
634633 # self.to_win64pe
635634 #
636635 # @param framework [Msf::Framework] The framework of you want to use
@@ -674,24 +673,10 @@ def self.to_win64pe(framework, code, opts = {})
674673 #
675674 # @return [String] Windows Service PE file
676675 def self . to_win32pe_service ( framework , code , opts = { } )
676+ # Allow the user to specify their own service EXE template
677677 set_template_default ( opts , "template_x86_windows_svc.exe" )
678- if opts [ :sub_method ]
679- # Allow the user to specify their own service EXE template
680- opts [ :exe_type ] = :service_exe
681- return exe_sub_method ( code , opts )
682- else
683- ENV [ 'MSF_SERVICENAME' ] = opts [ :servicename ]
684-
685- opts [ :framework ] = framework
686- opts [ :payload ] = 'stdin'
687- opts [ :encoder ] = '@x86/service,' +( opts [ :serviceencoder ] || '' )
688-
689- # XXX This should not be required, it appears there is a dependency inversion
690- # See https://github.com/rapid7/metasploit-framework/pull/9851
691- venom_generator = Msf ::PayloadGenerator . new ( opts )
692- code_service = venom_generator . multiple_encode_payload ( code )
693- return to_winpe_only ( framework , code_service , opts )
694- end
678+ opts [ :exe_type ] = :service_exe
679+ exe_sub_method ( code , opts )
695680 end
696681
697682 # self.to_win64pe_service
0 commit comments