Skip to content

Commit

Permalink
Added CLI::RubyShell (issue #68).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Jan 5, 2024
1 parent ff499ab commit b49bdb4
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
53 changes: 53 additions & 0 deletions lib/ronin/vulns/cli/ruby_shell.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# frozen_string_literal: true
#
# ronin-vulns - A Ruby library for blind vulnerability testing.
#
# Copyright (c) 2022-2023 Hal Brodigan (postmodern.mod3 at gmail.com)
#
# ronin-vulns 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-vulns 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-vulns. If not, see <https://www.gnu.org/licenses/>.
#

require 'ronin/core/cli/ruby_shell'

module Ronin
module Vulns
class CLI
#
# The interactive Ruby shell for {Ronin::Vulns}.
#
# @since 0.2.0
#
class RubyShell < Core::CLI::RubyShell

#
# Initializes the `ronin-vulns` Ruby shell.
#
# @param [String] name
# The name of the IRB shell.
#
# @param [Object] context
# Custom context to launch IRB from within.
#
# @param [Hash{Symbol => Object}] kwargs
# Additional keyword arguments for
# `Ronin::Core::CLI::RubyShell#initialize`.
#
def initialize(name: 'ronin-vulns', context: Vulns, **kwargs)
super(name: name, context: context, **kwargs)
end

end
end
end
end
15 changes: 15 additions & 0 deletions spec/cli/ruby_shell_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'spec_helper'
require 'ronin/vulns/cli/ruby_shell'

describe Ronin::Vulns::CLI::RubyShell do
describe "#initialize" do
it "must default #name to 'ronin-vulns'" do
expect(subject.name).to eq('ronin-vulns')
end

it "must default context: to Ronin::Vulns" do
expect(subject.context).to be_a(Object)
expect(subject.context).to be_kind_of(Ronin::Vulns)
end
end
end

0 comments on commit b49bdb4

Please sign in to comment.