Files
metasploit-gs/lib/msf/core/rpc/base.rb
T
HD Moore 9d765d4d25 Change protected for private, add debug flag to MessagePack (with debug.methods call)
git-svn-id: file:///home/svn/framework3/trunk@12624 4d416f70-5f16-0410-b530-b9f4589650da
2011-05-15 23:51:53 +00:00

39 lines
611 B
Ruby

module Msf
module RPC
class Base
def initialize(framework,tokens,users)
@framework = framework
@tokens = tokens
@users = users
end
private
def authenticate(token)
stale = []
# Force the encoding to ASCII-8BIT
token = token.unpack("C*").pack("C*")
@tokens.each_key do |t|
user,ctime,mtime,perm = @tokens[t]
if ! perm and 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