Skip to content

Commit

Permalink
Revert "Land #15199, Improve the get_processes API"
Browse files Browse the repository at this point in the history
This reverts commit 0203989, reversing
changes made to 0ca3dbc.
  • Loading branch information
zeroSteiner committed May 24, 2021
1 parent 0203989 commit 97ca760
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/msf/core/post/common.rb
Expand Up @@ -2,8 +2,6 @@

module Msf::Post::Common

include Msf::Post::File

def initialize(info = {})
super(update_info(
info,
Expand Down
15 changes: 15 additions & 0 deletions lib/msf/core/post/linux/priv.rb
Expand Up @@ -41,6 +41,21 @@ def cp_cmd(origin_file, final_file)
cmd_exec("echo '#{file_origin}' > #{final_file}")
end

def pids()
dir_proc = "/proc/"
pids = []

directories_proc = dir(dir_proc)
directories_proc.each do |elem|
elem.gsub( / *\n+/, "")
if elem[-1] == '1' || elem[-1] == '2' || elem[-1] == '3' || elem[-1] == '4' || elem[-1] == '5' || elem[-1] == '6' || elem[-1] == '7' || elem[-1] == '8' || elem[-1] == '9' || elem[-1] == '0'
pids.insert(-1, elem)
end
end

return pids.sort_by(&:to_i)
end

def binary_of_pid(pid)
binary = read_file("/proc/#{pid}/cmdline")
if binary == "" #binary.empty?
Expand Down

0 comments on commit 97ca760

Please sign in to comment.