diff --git a/lib/ronin/exploits/params/base_url.rb b/lib/ronin/exploits/params/base_url.rb index 3a39f660..a6e9ffd6 100644 --- a/lib/ronin/exploits/params/base_url.rb +++ b/lib/ronin/exploits/params/base_url.rb @@ -46,6 +46,17 @@ def self.included(exploit) desc: 'The base URL of the target' end + # + # The `base_url` param. + # + # @return [URI::HTTP, URI::HTTPS] + # + # @since 1.2.0 + # + def base_url + params[:base_url] + end + # # The targeted host. # diff --git a/spec/params/base_url_spec.rb b/spec/params/base_url_spec.rb index 7cc00a2f..33863860 100644 --- a/spec/params/base_url_spec.rb +++ b/spec/params/base_url_spec.rb @@ -23,6 +23,13 @@ class TestExploit < Ronin::Exploits::Exploit let(:base_url) { URI('https://example.com:8080/') } subject { TestBaseURLParam::TestExploit.new(params: {base_url: base_url}) } + describe "#base_url" do + it "must return the 'base_url' param as a URI:HTTP object" do + expect(subject.base_url).to be_kind_of(URI::HTTP) + expect(subject.base_url).to eq(base_url) + end + end + describe "#host" do it "must return the host value of the base URL" do expect(subject.host).to eq(base_url.host)