lib/ronin/exploits/web.rb in ronin-exploits-0.3.1 vs lib/ronin/exploits/web.rb in ronin-exploits-1.0.0.beta1
- old
+ new
@@ -1,109 +1,38 @@
#
-# Ronin Exploits - A Ruby library for Ronin that provides exploitation and
+# ronin-exploits - A Ruby library for ronin-rb that provides exploitation and
# payload crafting functionality.
#
-# Copyright (c) 2007-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
+# Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com)
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# 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.
#
-# This program is distributed in the hope that it will be useful,
+# 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 General Public License for more details.
+# GNU Lesser General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# You should have received a copy of the GNU Lesser General Public License
+# along with ronin-exploits. If not, see <https://www.gnu.org/licenses/>.
#
-require 'ronin/exploits/remote'
-require 'ronin/network/helpers/http'
-require 'ronin/extensions/uri/http'
+require 'ronin/exploits/exploit'
+require 'ronin/exploits/mixins/http'
-require 'uri'
+require 'uri/query_params'
module Ronin
module Exploits
- class Web < Remote
+ #
+ # An {Exploit} class that represents exploits that run against Web
+ # services.
+ #
+ class Web < Exploit
- include Network::Helpers::HTTP
-
- #
- # Creates a new Ronin::Exploits::Web object using the given
- # _block_.
- #
- # ronin_web_exploit do
- # ...
- # end
- #
- contextify :ronin_web_exploit
-
- # The targeted URL path
- property :url_path, String
-
- # The targeted URL query string
- property :url_query, String
-
- # The targeted HTTP host
- parameter :host, :description => 'The targeted HTTP host'
-
- # The targeted HTTP port
- parameter :port, :description => 'The targeted HTTP port'
-
- # The HTTP Request method to use
- parameter :http_method,
- :default => :get,
- :description => 'HTTP Request method to use'
-
- # The optional URL path prefix
- parameter :url_prefix, :description => 'Optional URL path prefix'
-
- #
- # Builds the targeted URL path based on the +url_prefix+ parameter,
- # as well as the +url_path+ and +url_query+ properties.
- #
- # @return [String]
- # The targeted URL path.
- #
- def targeted_url_path
- url = self.url_path.to_s
- url << "?#{self.url_query}" if self.url_query
-
- if @url_prefix
- url = @url_prefix.to_s + url
- end
-
- return url
- end
-
- #
- # Builds the targeted URL based on the +http_host+, +http_port+
- # and +url_prefix+ parameters as well as the +url_path+ and
- # +url_query+ properties.
- #
- # @return [URI::Generic]
- # The built URI object.
- #
- def targeted_url
- require_params :host
-
- url = ::URI::HTTP.build(
- :host => @host,
- :port => @port,
- :path => self.url_path,
- :query => self.url_query
- )
-
- if @url_prefix
- url.path = @url_prefix.to_s + url.path
- end
-
- return url
- end
+ include Mixins::HTTP
end
end
end