From 68c56dafd6b65c42815122d6d20fbe607fea0683 Mon Sep 17 00:00:00 2001 From: Postmodern Date: Fri, 5 Jan 2024 03:52:23 -0800 Subject: [PATCH] Added the `ronin-vulns irb` command (closes #68). --- gemspec.yml | 1 + lib/ronin/vulns/cli/commands/irb.rb | 59 +++++++++++++++++++++++++++++ man/ronin-vulns-irb.1.md | 26 +++++++++++++ man/ronin-vulns.1.md | 3 ++ spec/cli/commands/irb_spec.rb | 7 ++++ 5 files changed, 96 insertions(+) create mode 100644 lib/ronin/vulns/cli/commands/irb.rb create mode 100644 man/ronin-vulns-irb.1.md create mode 100644 spec/cli/commands/irb_spec.rb diff --git a/gemspec.yml b/gemspec.yml index 8aa7084..372525c 100644 --- a/gemspec.yml +++ b/gemspec.yml @@ -28,6 +28,7 @@ generated_files: - data/completions/ronin-vulns - man/ronin-vulns.1 - man/ronin-vulns-completion.1 + - man/ronin-vulns-irb.1 - man/ronin-vulns-lfi.1 - man/ronin-vulns-rfi.1 - man/ronin-vulns-sqli.1 diff --git a/lib/ronin/vulns/cli/commands/irb.rb b/lib/ronin/vulns/cli/commands/irb.rb new file mode 100644 index 0000000..b251733 --- /dev/null +++ b/lib/ronin/vulns/cli/commands/irb.rb @@ -0,0 +1,59 @@ +# 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 . +# + +require 'ronin/vulns/cli/command' +require 'ronin/vulns/cli/ruby_shell' + +module Ronin + module Vulns + class CLI + module Commands + # + # Starts an interactive Ruby shell with `ronin-vulns` loaded. + # + # ## Usage + # + # ronin-vulns irb [options] + # + # ## Options + # + # -h, --help Print help information + # + # @since 0.2.0 + # + class Irb < Command + + description "Starts an interactive Ruby shell with ronin-vulns loaded" + + man_page 'ronin-vulns-irb.1' + + # + # Runs the `ronin-vulns irb` command. + # + def run + require 'ronin/vulns' + CLI::RubyShell.start + end + + end + end + end + end +end diff --git a/man/ronin-vulns-irb.1.md b/man/ronin-vulns-irb.1.md new file mode 100644 index 0000000..df60bdb --- /dev/null +++ b/man/ronin-vulns-irb.1.md @@ -0,0 +1,26 @@ +# ronin-vulns-irb 1 "2023-02-01" Ronin Vulns "User Manuals" + +## NAME + +ronin-vulns-irb - Starts an interactive Ruby shell with ronin-vulns loaded + +## SYNOPSIS + +`ronin-vulns irb` [*options*] + +## DESCRIPTION + +Starts an interactive Ruby shell with `ronin/vulns` loaded. + +## OPTIONS + +`-h`, `--help` +: Print help information + +## AUTHOR + +Postmodern + +## SEE ALSO + +[ronin-vulns-workers](ronin-vulns-workers.1.md) [ronin-vulns-worker](ronin-vulns-worker.1.md) [ronin-vulns-run](ronin-vulns-run.1.md) [ronin-vulns-test](ronin-vulns-test.1.md) diff --git a/man/ronin-vulns.1.md b/man/ronin-vulns.1.md index 7abc86c..a569ae7 100644 --- a/man/ronin-vulns.1.md +++ b/man/ronin-vulns.1.md @@ -36,6 +36,9 @@ Runs a `ronin-vulns` *COMMAND*. *help* : Lists available commands or shows help about a specific command. +*irb* +: Starts an interactive Ruby shell with ronin-vulns loaded. + *lfi* : Scans URL(s) for Local File Inclusion (LFI) vulnerabilities. diff --git a/spec/cli/commands/irb_spec.rb b/spec/cli/commands/irb_spec.rb new file mode 100644 index 0000000..b47a49b --- /dev/null +++ b/spec/cli/commands/irb_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' +require 'ronin/vulns/cli/commands/irb' +require_relative 'man_page_example' + +describe Ronin::Vulns::CLI::Commands::Irb do + include_examples "man_page" +end