Skip to content

Commit

Permalink
Added missing Params::BaseURL#base_url method.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Aug 5, 2024
1 parent 3d83c0e commit ff6a493
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/ronin/exploits/params/base_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
7 changes: 7 additions & 0 deletions spec/params/base_url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ff6a493

Please sign in to comment.