Files
metasploit-gs/lib/msf/core/rpc/base.rb
T
HD Moore 71c5175a85 This patch introduces a really basic RPC service. It is still a long way from its final version
git-svn-id: file:///home/svn/framework3/trunk@5991 4d416f70-5f16-0410-b530-b9f4589650da
2008-12-02 22:09:34 +00:00

34 lines
510 B
Ruby

module Msf
module RPC
class Base
def initialize(framework,tokens,users)
@framework = framework
@tokens = tokens
@users = users
end
def authenticate(token)
stale = []
@tokens.each_key do |t|
user,ctime,mtime = @tokens[t]
if(mtime + 300 < Time.now.to_i)
stale << t
end
end
stale.each { |t| @tokens.delete(t) }
if(not @tokens[token])
raise ::XMLRPC::FaultException.new(401, "authentication error")
end
@tokens[token][2] = Time.now.to_i
end
end
end
end