#
# ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
# payload crafting functionality.
#
# Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# ronin-exploits is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ronin-exploits is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with ronin-exploits. If not, see .
#
module Ronin
module Exploits
module Metadata
#
# Adds a {CookieParam::ClassMethods#cookie_param cookie_param} metadata
# attribute to an exploit class.
#
module CookieParam
#
# Adds {ClassMethods} to the exploit class.
#
# @param [Class] exploit
# The exploit class including {CookieParam}.
#
# @api private
#
def self.included(exploit)
exploit.extend ClassMethods
end
module ClassMethods
#
# Get or sets the target Cookie param of the exploit.
#
# @param [String, nil] new_cookie_param
# The optional new Cookie param value to set.
#
# @return [String, nil]
# The set Cookie param value.
#
# @api public
#
def cookie_param(new_cookie_param=nil)
if new_cookie_param
@cookie_param = new_cookie_param
else
@cookie_param ||= if superclass.kind_of?(ClassMethods)
superclass.cookie_param
end
end
end
end
#
# The target Cookie param of the exploit.
#
# @return [String, nil]
# The Cookie param name to exploit.
#
# @api public
#
# @see ClassMethods#cookie_param
#
def cookie_param
self.class.cookie_param
end
end
end
end
end