@@ -525,9 +525,6 @@ def self.to_win64pe(framework, code, opts = {})
525
525
return injector . generate_pe
526
526
end
527
527
528
- #opts[:exe_type] = :exe_sub
529
- #return exe_sub_method(code,opts)
530
-
531
528
# Append a new section instead
532
529
appender = Msf ::Exe ::SegmentAppender . new ( {
533
530
:payload => code ,
@@ -549,9 +546,9 @@ def self.to_win64pe(framework, code, opts = {})
549
546
#
550
547
# @return [String] Windows Service PE file
551
548
def self . to_win32pe_service ( framework , code , opts = { } )
549
+ set_template_default ( opts , "template_x86_windows_svc.exe" )
552
550
if opts [ :sub_method ]
553
551
# Allow the user to specify their own service EXE template
554
- set_template_default ( opts , "template_x86_windows_svc.exe" )
555
552
opts [ :exe_type ] = :service_exe
556
553
return exe_sub_method ( code , opts )
557
554
else
@@ -610,7 +607,12 @@ def self.to_win32pe_service(framework, code, opts = {})
610
607
"\x79 \xFF \xD5 \x8B \x0E \x51 \x68 \xC6 \x96 \x87 \x52 \xFF \xD5 \x8B \x4E \x04 " +
611
608
"\x51 \x68 \xC6 \x96 \x87 \x52 \xFF \xD5 #{ code_service_stopped } "
612
609
613
- to_winpe_only ( framework , code_service + code , opts )
610
+ # Append a new section to the template
611
+ Msf ::Exe ::SegmentAppender . new ( {
612
+ :payload => code_service + code ,
613
+ :template => opts [ :template ] ,
614
+ :arch => :x86
615
+ } ) . generate_pe
614
616
end
615
617
end
616
618
0 commit comments