Skip to content

Commit 1be4812

Browse files
author
certcc-ghbot
committed
Merge remote-tracking branch 'upstream/master'
2 parents fe742a8 + 2305fc4 commit 1be4812

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
metasploit-framework (6.4.27)
4+
metasploit-framework (6.4.28)
55
aarch64
66
abbrev
77
actionpack (~> 7.0.0)

lib/metasploit/framework/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def self.get_hash
3232
end
3333
end
3434

35-
VERSION = "6.4.27"
35+
VERSION = "6.4.28"
3636
MAJOR, MINOR, PATCH = VERSION.split('.').map { |x| x.to_i }
3737
PRERELEASE = 'dev'
3838
HASH = get_hash

lib/msf/core/post/linux/compile.rb

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,20 @@ def initialize(info = {})
1111
super
1212
register_options( [
1313
OptEnum.new('COMPILE', [true, 'Compile on target', 'Auto', ['Auto', 'True', 'False']]),
14-
OptEnum.new('COMPILER', [true, 'Compiler to use on target', 'gcc', ['gcc', 'clang']]),
14+
OptEnum.new('COMPILER', [true, 'Compiler to use on target', 'Auto', ['Auto', 'gcc', 'clang']]),
1515
], self.class)
1616
end
1717

18+
def get_compiler
19+
if has_gcc?
20+
return 'gcc'
21+
elsif has_clang?
22+
return 'clang'
23+
else
24+
return nil
25+
end
26+
end
27+
1828
def live_compile?
1929
return false unless %w{ Auto True }.include?(datastore['COMPILE'])
2030

@@ -24,6 +34,8 @@ def live_compile?
2434
elsif datastore['COMPILER'] == 'clang' && has_clang?
2535
vprint_good 'clang is installed'
2636
return true
37+
elsif datastore['COMPILER'] == 'Auto' && get_compiler.present?
38+
return true
2739
end
2840

2941
unless datastore['COMPILE'] == 'Auto'
@@ -36,7 +48,13 @@ def live_compile?
3648
def upload_and_compile(path, data, compiler_args='')
3749
write_file "#{path}.c", strip_comments(data)
3850

39-
compiler_cmd = "#{datastore['COMPILER']} -o '#{path}' '#{path}.c'"
51+
compiler = datastore['COMPILER']
52+
if datastore['COMPILER'] == 'Auto'
53+
compiler = get_compiler
54+
fail_with(Module::Failure::BadConfig, "Unable to find a compiler on the remote target.") unless compiler.present?
55+
end
56+
57+
compiler_cmd = "#{compiler} -o '#{path}' '#{path}.c'"
4058
if session.type == 'shell'
4159
compiler_cmd = "PATH=\"$PATH:/usr/bin/\" #{compiler_cmd}"
4260
end

0 commit comments

Comments
 (0)