Add the ability to enumerate compatible post modules for a given session id

git-svn-id: file:///home/svn/framework3/trunk@11832 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2011-02-26 03:50:12 +00:00
parent d19ab712c4
commit fa16dcb098
1 changed files with 24 additions and 0 deletions

View File

@ -155,8 +155,32 @@ class Session < Base
meterpreter_run_single(token, sid, "run #{data}")
end
def compatible_modules(token, sid)
authenticate(token)
ret = []
mtype = "post"
names = @framework.post.keys.map{ |x| "post/#{x}" }
names.each do |mname|
m = _find_module(mtype, mname)
next if not m.session_compatible?(sid)
ret << m.fullname
end
ret
end
protected
def _find_module(mtype,mname)
mod = @framework.modules.create(mname)
if(not mod)
raise ::XMLRPC::FaultException.new(404, "unknown module")
end
mod
end
def _valid_session(token,sid,type)
authenticate(token)
s = @framework.sessions[sid.to_i]