Supress 'Permission denied' error in get_suid_files

master
Brendan Coles 2018-12-05 00:35:32 +00:00
parent c7acbc08ab
commit 6040f779c5
1 changed files with 2 additions and 1 deletions

View File

@ -132,7 +132,8 @@ module System
# @param findpath The path on the system to start searching # @param findpath The path on the system to start searching
# @return [Array] # @return [Array]
def get_suid_files(findpath = '/') def get_suid_files(findpath = '/')
cmd_exec("find #{findpath} -perm -4000 -print -xdev").to_s.split("\n") out = cmd_exec("find #{findpath} -perm -4000 -print -xdev").to_s.split("\n")
out.delete_if {|i| i.include? 'Permission denied'}
rescue rescue
raise "Could not retrieve all SUID files" raise "Could not retrieve all SUID files"
end end