Skip to content

Commit 9b219f4

Browse files
committed
Land rapid7#9029, Fix Linux post module file assumptions
2 parents deb2d76 + a676f60 commit 9b219f4

File tree

5 files changed

+5
-2
lines changed

5 files changed

+5
-2
lines changed

modules/post/linux/gather/mount_cifs_creds.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def run
3838
])
3939

4040
# parse each line from /etc/fstab
41+
fail_with(Failure::NotFound, '/etc/fstab not found on system') unless file_exist?('/etc/fstab')
4142
read_file("/etc/fstab").each_line do |fstab_line|
4243
fstab_line.strip!
4344
# where we'll store the current parsed credentials, if any

modules/post/multi/escalate/metasploit_pcaplog.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def normalize_minutes
6161

6262
def run
6363
print_status "Setting up the victim's /tmp dir"
64+
fail_with(Failure::NotFound, '/etc/passwd not found on system') unless file_exist?('/etc/passwd')
6465
initial_size = read_file("/etc/passwd").lines.count
6566
print_status "/etc/passwd is currently #{initial_size} lines long"
6667
i = 0

modules/post/multi/gather/enum_vbox.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def run
5555
end
5656
end
5757

58+
return nil unless res
5859
vprint_status(res)
5960
store_path = store_loot('virtualbox_vms', "text/plain", session, res, "virtualbox_vms.txt", "Virtualbox Virtual Machines")
6061
print_good("#{peer} - File successfully retrieved and saved on #{store_path}")

modules/post/multi/gather/lastpass_creds.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def user_profiles
194194
when /windows/
195195
user_profiles |= grab_user_profiles
196196
else
197-
print_error "OS not recognized: #{os}"
197+
print_error "OS not recognized: #{session.platform}"
198198
end
199199
user_profiles
200200
end

modules/post/multi/gather/remmina_creds.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def extract_all_creds
6767
user_dirs = enum_user_directories
6868
if user_dirs.empty?
6969
print_error('No user directories found')
70-
return
70+
return creds
7171
end
7272

7373
vprint_status("Searching for Remmina creds in #{user_dirs.size} user directories")

0 commit comments

Comments
 (0)