Skip to content

Commit

Permalink
Merge branch 'rapid7:master' into ssh-login-scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitkumarankam committed Mar 6, 2023
2 parents 37ba8d1 + 77c99da commit cfed987
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions db/modules_metadata_base.json
Expand Up @@ -56421,7 +56421,7 @@
"targets": [
"Microsoft Windows"
],
"mod_time": "2018-10-11 17:38:47 +0000",
"mod_time": "2023-03-05 14:30:47 +0000",
"path": "/modules/evasion/windows/windows_defender_js_hta.rb",
"is_install_path": true,
"ref_name": "windows/windows_defender_js_hta",
Expand Down Expand Up @@ -79608,7 +79608,7 @@
"Linux SPARC64",
"Linux s390x"
],
"mod_time": "2021-02-17 12:33:59 +0000",
"mod_time": "2023-03-05 14:30:47 +0000",
"path": "/modules/exploits/linux/samba/is_known_pipename.rb",
"is_install_path": true,
"ref_name": "linux/samba/is_known_pipename",
Expand Down
Expand Up @@ -76,7 +76,7 @@ def process_file(base64_file, save_path)
begin
# If we are running the data service on the same box this will ensure we only write
# the file if it is somehow not there already.
unless File.exists?(save_path) && File.read(save_path, mode: 'rb') == decoded_file
unless File.exist?(save_path) && File.read(save_path, mode: 'rb') == decoded_file
File.write(save_path, decoded_file, mode: 'wb')
end
rescue => e
Expand Down
2 changes: 1 addition & 1 deletion lib/msf/core/auxiliary/manage_engine_xnode/config.rb
Expand Up @@ -12,7 +12,7 @@ module Msf::Auxiliary::ManageEngineXnode::Config
# @return [Hash, Integer] Hash containing the data repositories (tables) and their fields (columns) to dump if reading the config file succeeded, error code otherwise
def grab_config(config_file)
# get the specified data repositories (tables) and fields (columns) to dump from the config file
return CONFIG_FILE_DOES_NOT_EXIST unless File.exists? config_file
return CONFIG_FILE_DOES_NOT_EXIST unless File.exist?(config_file)

begin
config_contents = File.read(config_file)
Expand Down
2 changes: 1 addition & 1 deletion lib/msf/core/db_manager/loot.rb
Expand Up @@ -115,7 +115,7 @@ def update_loot(opts)

# If the user updates the path attribute (or filename) we need to update the file
# on disk to reflect that.
if opts[:path] && File.exists?(loot.path)
if opts[:path] && File.exist?(loot.path)
File.rename(loot.path, opts[:path])
end

Expand Down
2 changes: 1 addition & 1 deletion lib/msf/core/web_services/servlet/loot_servlet.rb
Expand Up @@ -67,7 +67,7 @@ def self.update_loot
# Give the file a unique name to prevent accidental overwrites. Only do this if there is actually a file
# on disk. If there is not a file on disk we assume that this DB record is for tracking a file outside
# of metasploit, so we don't want to assign them a unique file name and overwrite that.
if opts[:path] && File.exists?(db_record.path)
if opts[:path] && File.exist?(db_record.path)
filename = File.basename(opts[:path])
opts[:path] = File.join(Msf::Config.loot_directory, "#{SecureRandom.hex(10)}-#{filename}")
end
Expand Down
4 changes: 2 additions & 2 deletions lib/msf/ui/console/command_dispatcher/modules.rb
Expand Up @@ -1162,7 +1162,7 @@ def favorite_check_fav_modules(favs_file)
readable = false
contents = ''

if File.exists?(favs_file)
if File.exist?(favs_file)
exists = true
end

Expand Down Expand Up @@ -1419,7 +1419,7 @@ def show_evasion # :nodoc:
def show_favorites # :nodoc:
favs_file = Msf::Config.fav_modules_file

unless File.exists?(favs_file)
unless File.exist?(favs_file)
print_error("The favorite modules file does not exist")
return
end
Expand Down
4 changes: 2 additions & 2 deletions lib/msf/util/document_generator.rb
Expand Up @@ -33,9 +33,9 @@ def self.get_module_document(mod)
user_path = File.join(PullRequestFinder::USER_MANUAL_BASE_PATH, "#{mod.fullname}.md")
global_path = File.join(PullRequestFinder::MANUAL_BASE_PATH, "#{mod.fullname}.md")

if File.exists?(user_path)
if File.exist?(user_path)
kb_path = user_path
elsif File.exists?(global_path)
elsif File.exist?(global_path)
kb_path = global_path
end

Expand Down
4 changes: 2 additions & 2 deletions modules/evasion/windows/windows_defender_js_hta.rb
Expand Up @@ -42,15 +42,15 @@ def run
file_payload = Rex::Text.encode_base64(payload.encoded)
evasion_shellcode_path = File.join(Msf::Config.data_directory, 'exploits', 'evasion_shellcode.js')
jsnet_code = File.read(evasion_shellcode_path)
fail_with(Failure::NotFound, 'The JScript.NET file was not found.') unless File.exists?(evasion_shellcode_path)
fail_with(Failure::NotFound, 'The JScript.NET file was not found.') unless File.exist?(evasion_shellcode_path)
js_file = ERB.new(jsnet_code).result(binding())
jsnet_encoded = Rex::Text.encode_base64(js_file)
# This is used in the ERB template
fname = Rex::Text.rand_text_alpha(6)
arch = ["x86", "x64"].include?(payload.arch.first) ? payload.arch.first : "anycpu"
hta_path = File.join(Msf::Config.data_directory, 'exploits', 'hta_evasion.hta')
hta = File.read(hta_path)
fail_with(Failure::NotFound, 'The HTA file was not found.') unless File.exists?(hta_path)
fail_with(Failure::NotFound, 'The HTA file was not found.') unless File.exist?(hta_path)
hta_file = ERB.new(hta).result(binding())
file_create(hta_file)
end
Expand Down
2 changes: 1 addition & 1 deletion modules/exploits/linux/samba/is_known_pipename.rb
Expand Up @@ -353,7 +353,7 @@ def cycle_possible_payloads


wrapper_path = ::File.join(template_base, "samba-root-#{template_type}-#{t_plat}-#{t_arch}.so.gz")
next unless ::File.exists?(wrapper_path)
next unless ::File.exist?(wrapper_path)

data = ''
::File.open(wrapper_path, "rb") do |fd|
Expand Down
4 changes: 2 additions & 2 deletions tools/exploit/random_compile_c.rb
Expand Up @@ -23,7 +23,7 @@ def help
source_code_path = ARGV.shift
out_path = ARGV.shift

if source_code_path.nil? || source_code_path.empty? || !File.exists?(source_code_path)
if source_code_path.nil? || source_code_path.empty? || !File.exist?(source_code_path)
puts "Please set the source code path"
exit
elsif out_path.nil? || out_path.empty?
Expand All @@ -33,7 +33,7 @@ def help

source_code = File.read(source_code_path)
Metasploit::Framework::Compiler::Windows.compile_random_c_to_file(out_path, source_code, weight: weight.to_i)
if File.exists?(out_path)
if File.exist?(out_path)
puts "File saved as #{out_path}"
end
rescue SignalException => e
Expand Down
2 changes: 1 addition & 1 deletion tools/modules/cve_xref.rb
Expand Up @@ -207,7 +207,7 @@ def main
end
filter = val
when "-d"
unless File.exists?(val.to_s)
unless File.exist?(val.to_s)
raise RuntimeError, "#{val} not found"
end

Expand Down

0 comments on commit cfed987

Please sign in to comment.