-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
daa2d73
commit b2ebdcd
Showing
6 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# frozen_string_literal: true | ||
# | ||
# ronin-exploits - A Ruby library for ronin-rb that provides exploitation and | ||
# payload crafting functionality. | ||
# | ||
# Copyright (c) 2007-2024 Hal Brodigan (postmodern.mod3 at gmail.com) | ||
# | ||
# 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. | ||
# | ||
# 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 Lesser General Public License for more details. | ||
# | ||
# 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/exploit' | ||
require 'ronin/exploits/mixins/has_payload' | ||
require 'ronin/payloads/command_payload' | ||
|
||
module Ronin | ||
module Exploits | ||
# | ||
# Represents a command injection exploit. | ||
# | ||
# ## Example | ||
# | ||
# require 'ronin/exploits/command_injection' | ||
# require 'ronin/exploits/mixins/http' | ||
# | ||
# module Ronin | ||
# module Exploits | ||
# class MyExploit < CommandInjection | ||
# | ||
# register 'my_exploit' | ||
# | ||
# include Mixins::HTTP | ||
# | ||
# def launch | ||
# http_post '/form.php', post_data: {var: "';#{payload}#"} | ||
# end | ||
# | ||
# end | ||
# end | ||
# end | ||
# | ||
# @api public | ||
# | ||
# @since 1.1.0 | ||
# | ||
class CommandInjection < Exploit | ||
|
||
include Mixins::HasPayload | ||
|
||
payload_class Payloads::CommandPayload | ||
|
||
# | ||
# Returns the type or kind of exploit. | ||
# | ||
# @return [Symbol] | ||
# | ||
# @note | ||
# This is used internally to map an exploit class to a printable type. | ||
# | ||
# @api private | ||
# | ||
def self.exploit_type | ||
:command_injection | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'spec_helper' | ||
require 'ronin/exploits/command_injection' | ||
|
||
describe Ronin::Exploits::CommandInjection do | ||
it "must inherit from Ronin::Exploits::Exploit" do | ||
expect(described_class).to be < Ronin::Exploits::Exploit | ||
end | ||
|
||
it "must include Ronin::Exploits::Mixins::HasPayload" do | ||
expect(described_class).to include(Ronin::Exploits::Mixins::HasPayload) | ||
end | ||
|
||
describe ".payload_class" do | ||
subject { described_class } | ||
|
||
it "must be Ronin::Payloads::CommandPayload" do | ||
expect(subject.payload_class).to be(Ronin::Payloads::CommandPayload) | ||
end | ||
end | ||
|
||
describe ".exploit_type" do | ||
subject { described_class } | ||
|
||
it { expect(subject.exploit_type).to eq(:command_injection) } | ||
end | ||
end |