-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement views, routes and worker for
RoninVulns
(#64)
- Loading branch information
Showing
15 changed files
with
617 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
- scan | ||
- import | ||
- spider | ||
- vulns |
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,69 @@ | ||
# frozen_string_literal: true | ||
# | ||
# ronin-app - a local web app for Ronin. | ||
# | ||
# Copyright (C) 2023 Hal Brodigan ([email protected]) | ||
# | ||
# ronin-app is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ronin-app 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 Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with ronin-app. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
require 'ronin/app/types' | ||
|
||
module Ronin | ||
module App | ||
module Types | ||
# | ||
# Types for {Validations::VulnsParams}. | ||
# | ||
module Vulns | ||
module LFI | ||
# The type of OS | ||
OSType = Types::Symbol.enum( | ||
unix: 'unix', | ||
windows: 'windows' | ||
) | ||
|
||
# The lfi filter bypass technique type | ||
FilterBypassType = Types::Symbol.enum( | ||
null_byte: 'null_byte', | ||
double_escape: 'double_escape', | ||
base64: 'base64', | ||
rot13: 'rot13', | ||
zlib: 'zlib' | ||
) | ||
end | ||
|
||
module RFI | ||
# The rfi filter bypass technique type | ||
FilterBypassType = Types::Symbol.enum( | ||
null_byte: 'null_byte', | ||
double_encode: 'double_encode', | ||
suffix_escape: 'suffix_escape' | ||
) | ||
end | ||
|
||
module SSTI | ||
# The type of SSTI escape expression | ||
EscapeType = Types::Symbol.enum( | ||
double_curly_braces: 'double_curly_braces', | ||
dollar_curly_braces: 'dollar_curly_braces', | ||
dollar_double_curly_braces: 'dollar_double_curly_braces', | ||
pound_curly_braces: 'pound_curly_braces', | ||
angle_brackets_percent: 'angle_brackets_percent' | ||
) | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# frozen_string_literal: true | ||
# | ||
# ronin-app - a local web app for Ronin. | ||
# | ||
# Copyright (C) 2023 Hal Brodigan ([email protected]) | ||
# | ||
# ronin-app is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ronin-app 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 Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with ronin-app. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
require 'dry/validation' | ||
require 'ronin/app/types/vulns' | ||
|
||
module Ronin | ||
module App | ||
module Validations | ||
# | ||
# Validations for form params submitted to `POST /vulns`. | ||
# | ||
class VulnsParams < Dry::Validation::Contract | ||
|
||
params do | ||
required(:url).filled(:string) | ||
|
||
optional(:lfi).hash do | ||
optional(:os).maybe(Types::Vulns::LFI::OSType) | ||
optional(:depth).maybe(:integer) | ||
optional(:filter_bypass).maybe(Types::Vulns::LFI::FilterBypassType) | ||
end | ||
|
||
optional(:rfi).hash do | ||
optional(:filter_bypass).maybe(Types::Vulns::RFI::FilterBypassType) | ||
optional(:test_script_url).maybe(:string) | ||
end | ||
|
||
optional(:sqli).hash do | ||
optional(:escape_quote).maybe(:bool) | ||
optional(:escape_parens).maybe(:bool) | ||
optional(:terminate).maybe(:bool) | ||
end | ||
|
||
optional(:ssti).hash do | ||
optional(:escape).maybe(Types::Vulns::SSTI::EscapeType) | ||
end | ||
|
||
optional(:open_redirect).hash do | ||
optional(:test_url).maybe(:string) | ||
end | ||
end | ||
|
||
# | ||
# Initializes and calls the validation contract. | ||
# | ||
# @param [Hash{String => Object}] params | ||
# The HTTP params to validate. | ||
# | ||
# @return [Dry::Validation::Result] | ||
# The validation result. | ||
# | ||
def self.call(params) | ||
new.call(params) | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
require 'ronin/app/validations/vulns_params' | ||
|
||
describe Ronin::App::Validations::VulnsParams do | ||
describe "rules" do | ||
describe ":url" do | ||
it "must require a :url key" do | ||
result = subject.call({}) | ||
|
||
expect(result).to be_failure | ||
expect(result.errors[:url]).to eq(["is missing"]) | ||
end | ||
end | ||
end | ||
|
||
describe ".call" do | ||
subject { described_class } | ||
|
||
it "must initialize #{described_class} and call #call" do | ||
expect(subject.call({})).to be_kind_of(Dry::Validation::Result) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'spec_helper' | ||
require './workers/nmap' | ||
|
||
describe Workers::Nmap do | ||
describe "Params" do | ||
subject { described_class::Params } | ||
|
||
describe ":url" do | ||
it "must require :url key" do | ||
result = subject.call({}) | ||
|
||
expect(result).to be_failure | ||
expect(result.errors[:targets]).to eq(["is missing"]) | ||
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,16 @@ | ||
<% content_for :breadcrumbs do %> | ||
<nav class="breadcrumb" aria-label="breadcrumbs"> | ||
<ul> | ||
<li><a href="/">Home</a></li> | ||
<li><a href="/db">Database</a></li> | ||
</ul> | ||
</nav> | ||
<% end %> | ||
|
||
<h1>Vulnerabilities</h1> | ||
|
||
<% @vulns.each do |vuln| %> | ||
<p><a href="/db/vulns/<%=h vuln.id %>"><%=h vuln.url %></a></p> | ||
<% end %> | ||
|
||
<%= partial(:pagination, pagy: @pagy) %> |
Oops, something went wrong.