2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2005-04-03 21:52:10 +00:00
|
|
|
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/post/process'
|
2005-04-03 21:52:10 +00:00
|
|
|
|
|
|
|
module Rex
|
|
|
|
module Post
|
|
|
|
module DispatchNinja
|
|
|
|
|
|
|
|
class Process < Rex::Post::Process
|
|
|
|
class <<self
|
|
|
|
attr_accessor :client
|
|
|
|
end
|
|
|
|
|
|
|
|
def Process.getresuid()
|
|
|
|
|
|
|
|
# gotta fix this, getresuid could fail
|
|
|
|
# I don't transfer the return value on the wire...
|
|
|
|
|
|
|
|
client.sendmodule('getresuid')
|
2005-04-03 23:22:38 +00:00
|
|
|
data = client.sockread(16)
|
2005-04-04 02:26:48 +00:00
|
|
|
# fsking getresuid/getresuid32
|
|
|
|
data[6, 2] = data[10, 2] = data[14, 2] = "\x00\x00"
|
2005-04-03 23:22:38 +00:00
|
|
|
data = data.unpack('lL3')
|
|
|
|
res = data[0]
|
2005-04-03 21:52:10 +00:00
|
|
|
|
|
|
|
client.checksig()
|
2005-04-03 23:22:38 +00:00
|
|
|
|
|
|
|
if res < 0
|
|
|
|
raise SystemCallError.new("getresuid()", -res)
|
|
|
|
end
|
|
|
|
|
|
|
|
return data[1, 3] # return the 3 uids
|
2005-04-03 21:52:10 +00:00
|
|
|
end
|
2005-04-03 23:13:16 +00:00
|
|
|
|
|
|
|
def Process.pid()
|
|
|
|
client.sendmodule('getpid')
|
|
|
|
data = client.sockread(4)
|
|
|
|
client.checksig
|
|
|
|
return data.unpack('V')[0]
|
|
|
|
end
|
|
|
|
|
|
|
|
def Process.ppid()
|
|
|
|
client.sendmodule('getppid')
|
|
|
|
data = client.sockread(4)
|
|
|
|
client.checksig
|
|
|
|
return data.unpack('V')[0]
|
|
|
|
end
|
2005-04-03 21:52:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end; end; end # DispatchNinja/Post/Rex
|
|
|
|
|