2014-12-10 15:54:57 +00:00
|
|
|
# -*- coding: binary -*-
|
|
|
|
|
2014-12-09 21:53:29 +00:00
|
|
|
module Rex
|
|
|
|
module Proto
|
|
|
|
module Kerberos
|
|
|
|
module Model
|
|
|
|
# This class provides a representation of a principal, an asset (e.g., a
|
|
|
|
# workstation user or a network server) on a network.
|
|
|
|
class Element
|
2014-12-11 18:19:26 +00:00
|
|
|
|
2014-12-22 17:57:35 +00:00
|
|
|
include Rex::Proto::Kerberos::Crypto
|
2014-12-09 21:53:29 +00:00
|
|
|
include Rex::Proto::Kerberos::Model
|
|
|
|
|
2014-12-11 18:19:26 +00:00
|
|
|
def self.attr_accessor(*vars)
|
|
|
|
@attributes ||= []
|
|
|
|
@attributes.concat vars
|
|
|
|
super(*vars)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.attributes
|
|
|
|
@attributes
|
|
|
|
end
|
|
|
|
|
2014-12-09 21:53:29 +00:00
|
|
|
def self.decode(input)
|
|
|
|
elem = self.new
|
|
|
|
elem.decode(input)
|
|
|
|
end
|
|
|
|
|
2014-12-11 18:19:26 +00:00
|
|
|
def initialize(options = {})
|
|
|
|
self.class.attributes.each do |attr|
|
|
|
|
if options.has_key?(attr)
|
|
|
|
m = (attr.to_s + '=').to_sym
|
|
|
|
self.send(m, options[attr])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-12-09 21:53:29 +00:00
|
|
|
|
2014-12-11 18:19:26 +00:00
|
|
|
def attributes
|
|
|
|
self.class.attributes
|
2014-12-09 21:53:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def decode(input)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def encode
|
|
|
|
''
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|