Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/rex/proto/kerberos/model/element.rb
Views: 11766
# -*- coding: binary -*-12module Rex3module Proto4module Kerberos5module Model6# This class provides a representation of a principal, an asset (e.g., a7# workstation user or a network server) on a network.8class Element910include Rex::Proto::Kerberos::Crypto11include Rex::Proto::Kerberos::Model1213def self.attr_accessor(*vars)14@attributes ||= []15@attributes.concat vars16super(*vars)17end1819# Retrieves the element class fields20#21# @return [Array]22def self.attributes23@attributes24end2526def self.decode(input)27elem = self.new28elem.decode(input)29end3031def initialize(options = {})32raise ArgumentError, "Invalid options, expected hash, got #{options.class}" unless options.is_a?(Hash)3334self.class.attributes.each do |attr|35if options.has_key?(attr)36m = (attr.to_s + '=').to_sym37self.send(m, options[attr])38end39end40end4142# Retrieves the element instance fields43#44# @return [Array]45def attributes46self.class.attributes47end4849# Decodes the Rex::Proto::Kerberos::Model::Element from the input. This50# method has been designed to be overridden by subclasses.51#52# @raise [NoMethodError]53def decode(input)54raise ::NoMethodError, 'Method designed to be overridden'55end5657# Encodes the Rex::Proto::Kerberos::Model::Element into an ASN.1 String. This58# method has been designed to be overridden by subclasses.59#60# @raise [NoMethodError]61def encode62raise ::NoMethodError, 'Method designed to be overridden'63end64end65end66end67end68end697071