cmsscan 1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d3a9f304d468835a4cbb3596bdb4b74eb3b48601bec16a93dec4bdf876c89498
4
+ data.tar.gz: 6964ca5c7b1c5f954a0f01a3bd8535e0df405ac4c32aef2522b687738d6bbd6f
5
+ SHA512:
6
+ metadata.gz: e8273ca85b3d286803ec94e3e284091eccaecb529c8ac7800ce268663e24302b566b9c0ffb561a9b55a945e788931e10a551812f02f1d889bfb7eab6845d03a2
7
+ data.tar.gz: 0a2477a65bfb14e58ab61e4e12de2efb8451aa105b01c3a63a5194df2cd22da69480a8ed9f91dae791cde4474fcc3bcc5facaf8a1d0d11054691e2c440507780
data/app/app.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'controllers/example'
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CMSScan
4
+ module Controller
5
+ # Example Controller
6
+ class Example < CMSScanner::Controller::Core
7
+ # @return [ Array<OptParseValidator::Opt> ]
8
+ def cli_options
9
+ [
10
+ OptString.new(['--dummy VALUE', 'Dummy CLI Option'])
11
+ ]
12
+ end
13
+
14
+ def before_scan
15
+ # Anything to do before ?
16
+ end
17
+
18
+ def run
19
+ # Let's check and display whether or not the word 'scan' is present in the homepage of the target
20
+
21
+ is_present = target.homepage_res.body =~ /scan/ ? true : false
22
+
23
+ output('scan_word', is_present: is_present)
24
+ end
25
+
26
+ # Alternative way of doing it
27
+ def run2
28
+ @is_present = Browser.get(target.homepage_url).body =~ /scan/ ? true : false
29
+
30
+ output('scan_word')
31
+ end
32
+
33
+ def after_scan
34
+ # Anything after ?
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+
2
+ CMS Scanner Example <%= CMSScan::VERSION %>
3
+
@@ -0,0 +1,5 @@
1
+ <% if @is_present -%>
2
+ <%= warning_icon %> The word 'scan' is present in the homepage
3
+ <% else -%>
4
+ <%= notice_icon %> The word 'scan' was not detected in the homepage
5
+ <% end %>
@@ -0,0 +1,3 @@
1
+ "banner": {
2
+ "version": <%= CMSScan::VERSION.to_json %>
3
+ },
@@ -0,0 +1 @@
1
+ "scan_word_present": <%= @is_present.to_json %>,
data/bin/cmsscan ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'cmsscan'
5
+
6
+ CMSScan::Scan.new do |s|
7
+ s.controllers << CMSScan::Controller::Example.new
8
+
9
+ s.run
10
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CMSScan
4
+ # Needed to load at least the Core controller
5
+ # Otherwise, the following error will be raised:
6
+ # `initialize': uninitialized constant CMSScan::Controller::Core (NameError)
7
+ module Controller
8
+ include CMSScanner::Controller
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CMSScan
4
+ # Custom Target Class
5
+ class Target < CMSScanner::Target
6
+ # Put your own methods there
7
+
8
+ # Method which should be defined.
9
+ # Used to set a specific exit code if the scan found issues
10
+ # See the CMSScanner/lib/cms_scanner/exit_code.rb
11
+ def vulnerable?
12
+ false
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CMSScan
4
+ VERSION = '1.0'
5
+ end
data/lib/cmsscan.rb ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Gems
4
+ require 'cms_scanner'
5
+ require 'yajl/json_gem'
6
+ require 'addressable/uri'
7
+ require 'active_support/all'
8
+ # Standard Lib
9
+ require 'uri'
10
+ require 'time'
11
+ require 'readline'
12
+ require 'securerandom'
13
+ # Custom Libs
14
+ require 'cmsscan/target'
15
+ require 'cmsscan/version'
16
+ require 'cmsscan/controller'
17
+
18
+ Encoding.default_external = Encoding::UTF_8
19
+
20
+ # CMSScan
21
+ module CMSScan
22
+ include CMSScanner
23
+
24
+ APP_DIR = Pathname.new(__FILE__).dirname.join('..', 'app').expand_path
25
+ # Not needed in this example
26
+ # DB_DIR = File.join(Dir.home, '.cmsscan', 'db')
27
+
28
+ # Override, otherwise it would be returned as 'cms_scan'
29
+ # doesn't really matter in this example.
30
+ #
31
+ # @return [ String ]
32
+ def self.app_name
33
+ 'cmsscan'
34
+ end
35
+ end
36
+
37
+ require "#{CMSScan::APP_DIR}/app"
metadata ADDED
@@ -0,0 +1,223 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cmsscan
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - WPScanTeam
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cms_scanner
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: memory_profiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.10.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.10.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.3.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.3.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.17.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.17.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.11.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.11.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.21.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 0.21.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov-lcov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.8.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.8.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: stackprof
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.2.12
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.2.12
167
+ - !ruby/object:Gem::Dependency
168
+ name: webmock
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 3.13.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 3.13.0
181
+ description: CMSScanner Implementation Example
182
+ email:
183
+ - team@wpscan.org
184
+ executables:
185
+ - cmsscan
186
+ extensions: []
187
+ extra_rdoc_files: []
188
+ files:
189
+ - app/app.rb
190
+ - app/controllers/example.rb
191
+ - app/views/cli/core/banner.erb
192
+ - app/views/cli/example/scan_word.erb
193
+ - app/views/json/core/banner.erb
194
+ - app/views/json/example/scan_word.erb
195
+ - bin/cmsscan
196
+ - lib/cmsscan.rb
197
+ - lib/cmsscan/controller.rb
198
+ - lib/cmsscan/target.rb
199
+ - lib/cmsscan/version.rb
200
+ homepage: https://github.com/wpscanteam/CMSScanner
201
+ licenses:
202
+ - MIT
203
+ metadata: {}
204
+ post_install_message:
205
+ rdoc_options: []
206
+ require_paths:
207
+ - lib
208
+ required_ruby_version: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: '2.3'
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: '0'
218
+ requirements: []
219
+ rubygems_version: 3.3.22
220
+ signing_key:
221
+ specification_version: 4
222
+ summary: CMSScan Gem Example
223
+ test_files: []