Expand the core API to add threads, module paths, set/unsetd, and save

git-svn-id: file:///home/svn/framework3/trunk@12760 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2011-05-28 17:00:21 +00:00
parent c1996206f2
commit 556cd5affe
1 changed files with 58 additions and 0 deletions

View File

@ -13,6 +13,64 @@ class RPC_Core < RPC_Base
def rpc_stop
self.service.stop
end
def rpc_setg(var, val)
framework.datastore[var] = val
{ "result" => "success" }
end
def rpc_unsetg(var)
framework.datastore.delete(var)
{ "result" => "success" }
end
def rpc_save
framework.save_config
{ "result" => "success" }
end
def rpc_reload_modules
framework.modules.reload_modules
rpc_module_stats()
end
def rpc_add_module_path(path)
framework.modules.add_module_path(path, false)
rpc_module_stats()
end
def rpc_module_stats
{
'exploits' => framework.stats.num_exploits,
'auxiliary' => framework.stats.num_auxiliary,
'post' => framework.stats.num_post,
'encoders' => framework.stats.num_encoders,
'nops' => framework.stats.num_nops,
'payloads' => framework.stats.num_payloads
}
end
def rpc_thread_list
res = {}
framework.threads.each_index do |i|
t = framework.threads[i]
next if not t
res[i] = {
:status => (t.status || "dead"),
:critical => t[:tm_crit] ? true : false,
:name => t[:tm_name].to_s,
:started => t[:tm_time].to_s
}
end
res
end
def rpc_thread_kill(tid)
framework.threads.kill(tid.to_i) rescue nil
{ "result" => "success" }
end
end
end
end