Skip to content

Commit

Permalink
add optimization flag, use basename method
Browse files Browse the repository at this point in the history
  • Loading branch information
space-r7 committed Nov 7, 2019
1 parent f6ef34b commit 1a88e76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/metasploit/framework/compiler/mingw.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def self.build_cmd(src, opts={})
path = File.join(Msf::Config.install_root, "#{src_file}.c")
File.write(path, src)

opt_level = [ 'Os', 'O1', 'O2', 'O3' ].include?(opts[:opt_lvl]) ? "-#{opts[:opt_lvl]} " : "-O2 "
opt_level = [ 'Os', 'O0', 'O1', 'O2', 'O3' ].include?(opts[:opt_lvl]) ? "-#{opts[:opt_lvl]} " : "-O2 "

case opts[:arch]
when 'x86'
Expand Down Expand Up @@ -71,7 +71,7 @@ def self.build_cmd(src, opts={})
end

def self.cleanup_files(opts={})
file_base = opts[:f_name].split('.').first
file_base = File.basename(opts[:f_name], '.exe')
src_file = "#{file_base}.c"
exe_file = "#{file_base}.exe"
file_path = Msf::Config.install_root
Expand Down
2 changes: 1 addition & 1 deletion lib/msf/core/payload/windows/encrypted_payload_opts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def initialize(info={})
register_advanced_options(
[
OptBool.new('StripSymbols', [ false, 'Payload will be compiled without symbols', true ]),
OptString.new('OptLevel', [ false, 'The optimization level to compile with, e.g. O1, O2, O3, Os', 'O2' ]),
OptString.new('OptLevel', [ false, 'The optimization level to compile with, e.g. O0, O1, O2, O3, Os', 'O2' ]),
OptPath.new('LinkerScript', [ false, 'Linker script that orders payload functions', "#{LINK_SCRIPT_PATH}/func_order.ld" ]),
OptBool.new('KeepSrc', [ false, 'Keep source code after compiling it', true ]),
OptBool.new('KeepExe', [ false, 'Keep executable after compiling the payload', true ]),
Expand Down

0 comments on commit 1a88e76

Please sign in to comment.