forked from rastating/wordpress-exploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodules_spec.rb
More file actions
69 lines (59 loc) · 1.89 KB
/
modules_spec.rb
File metadata and controls
69 lines (59 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# frozen_string_literal: true
require_relative 'spec_helper'
require 'modules'
describe Wpxf do
describe '.build_module_list' do
it 'builds an array of hashes containing the modules for the specified namespace' do
result = Wpxf.build_module_list(Wpxf::Exploit, 'modules')
expect(result[0]).to include(:class, :name)
mod = result.find { |m| m[:name] == 'exploit/shell/admin_shell_upload' }
expect(mod).to_not be_nil
expect(mod[:class]).to be Wpxf::Exploit::AdminShellUpload
end
end
end
describe 'Wpxf::Auxiliary' do
describe '.module_list' do
it 'builds an array of hashes containing the auxiliary modules' do
list = Wpxf::Auxiliary.module_list
expect(list).to_not be_nil
expect(list[0]).to include(:class, :name)
end
end
it 'should contain no duplicate classes' do
classes = []
Dir.glob('modules/auxiliary/**/*.rb').each do |f|
code = File.read(f)
classes.push(code[/class\s+(.+)?\s/, 1])
end
duplicates = classes.detect { |e| classes.count(e) > 1 }
expect(duplicates).to be_nil
end
end
describe 'Wpxf::Exploit' do
it 'should contain no duplicate classes' do
classes = []
Dir.glob('modules/exploit/**/*.rb').each do |f|
code = File.read(f)
classes.push(code[/class\s+(.+?)\s/, 1])
end
duplicates = classes.detect { |e| classes.count(e) > 1 }
expect(duplicates).to be_nil
end
describe '.module_list' do
it 'builds an array of hashes containing the exploit modules' do
list = Wpxf::Exploit.module_list
expect(list).to_not be_nil
expect(list[0]).to include(:class, :name)
end
end
end
describe 'Wpxf::Payloads' do
describe '.payload_list' do
it 'builds an array of hashes containing the module payloads' do
list = Wpxf::Payloads.payload_list
expect(list).to_not be_nil
expect(list[0]).to include(:class, :name)
end
end
end