Skip to content

Commit ef92953

Browse files
committed
Added specs for CLI::Text#exploit_type_name.
1 parent 9ea42ba commit ef92953

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

spec/cli/text_spec.rb

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
require 'spec_helper'
22
require 'ronin/exploits/cli/text'
3+
require 'ronin/exploits/cli/command'
34

45
require 'ronin/exploits/exploit'
5-
require 'ronin/exploits/cli/command'
6+
require 'ronin/exploits/auth_bypass'
7+
require 'ronin/exploits/path_traversal'
8+
require 'ronin/exploits/memory_corruption'
9+
require 'ronin/exploits/stack_overflow'
10+
require 'ronin/exploits/seh_overflow'
11+
require 'ronin/exploits/heap_overflow'
12+
require 'ronin/exploits/use_after_free'
13+
require 'ronin/exploits/web'
14+
require 'ronin/exploits/lfi'
15+
require 'ronin/exploits/rfi'
16+
require 'ronin/exploits/sqli'
17+
require 'ronin/exploits/xss'
18+
require 'ronin/exploits/open_redirect'
19+
require 'ronin/exploits/ssti'
620

721
describe Ronin::Exploits::CLI::Text do
822
module TestCLIText
@@ -28,6 +42,35 @@ class TestCommand < Ronin::Exploits::CLI::Command
2842
let(:test_command) { TestCLIText::TestCommand }
2943
subject { test_command.new }
3044

45+
describe "#exploit_type_name" do
46+
{
47+
Ronin::Exploits::Exploit => 'Custom',
48+
Ronin::Exploits::AuthBypass => 'Auth Bypass',
49+
Ronin::Exploits::PathTraversal => 'Path Traversal',
50+
Ronin::Exploits::MemoryCorruption => 'Memory Corruption',
51+
Ronin::Exploits::StackOverflow => 'Stack Overflow',
52+
Ronin::Exploits::SEHOverflow => 'SEH Overflow',
53+
Ronin::Exploits::HeapOverflow => 'Heap Overflow',
54+
Ronin::Exploits::UseAfterFree => 'Use After Free',
55+
Ronin::Exploits::Web => 'Custom',
56+
Ronin::Exploits::LFI => 'Local File Inclusion (LFI)',
57+
Ronin::Exploits::RFI => 'Remote File Inclusion (RFI)',
58+
Ronin::Exploits::SQLI => 'SQL injection (SQLI)',
59+
Ronin::Exploits::XSS => 'Cross-Site Scripting (XSS)',
60+
Ronin::Exploits::OpenRedirect => 'Open Redirect',
61+
Ronin::Exploits::SSTI => 'Server-Side Template Injection (SSTI)'
62+
}.each do |exploit_class,type|
63+
context "when the class inherits from #{exploit_class}" do
64+
let(:klass) { Class.new(exploit_class) }
65+
let(:type) { type }
66+
67+
it "must return '#{type}'" do
68+
expect(subject.exploit_type_name(klass)).to eq(type)
69+
end
70+
end
71+
end
72+
end
73+
3174
describe "#example_exploit_command" do
3275
context "when given a exploit class with no params" do
3376
module TestCLIText

0 commit comments

Comments
 (0)