cms_scanner 0.0.35.1 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae82b795bcfbedd43f9dfd6b3cce5477854e80dc
4
- data.tar.gz: e76da82f4417c94491c25719ffce22b2cc259608
3
+ metadata.gz: 4bfb8bab5a963e2803fa4991564f4affe3e7415d
4
+ data.tar.gz: 50faf8b01e45138166d74d3b4d769dbf5bf828ea
5
5
  SHA512:
6
- metadata.gz: db37c59c93b0ffbf9d1ea2f833fbe194aa1f8442a1a028467f28b21aeae4e5e59596d4fa36e711f4f80ef845720e29f2c8992c087be7079200a4d4c9de6f5e2a
7
- data.tar.gz: 4a9b8a614e849658775bd76f9084b1f53779599c147874b6a4cb5d10fcc25833b5ec32ee8767882bce4c9fc0810514f58f97ae7dcd10812237c38059582ed51b
6
+ metadata.gz: a49537023c9c2ba55ab12641dc6fb9407e357e88ca358b1c9428d533bb984df8f1f6e07e7218c9195cd9459f20da24c4f4e268c63ae30bc75a083db5fae58309
7
+ data.tar.gz: 7ad19781bcda3f02d744eb0eceb0b3e43289cc3d323950df3b2060b051426053cf1ef3957c9ae5df417ce5f18006881e908b3cbcca6b9e63afc1981a07856d77
@@ -1,7 +1,7 @@
1
1
  module CMSScanner
2
2
  # Interesting Finding
3
3
  class InterestingFinding
4
- include NS::Finders::Finding
4
+ include Finders::Finding
5
5
 
6
6
  attr_reader :url
7
7
  attr_writer :to_s
@@ -1,7 +1,7 @@
1
1
  module CMSScanner
2
2
  # Version
3
3
  class Version
4
- include NS::Finders::Finding
4
+ include Finders::Finding
5
5
 
6
6
  attr_reader :number
7
7
 
data/lib/cms_scanner.rb CHANGED
@@ -3,6 +3,7 @@ require 'opt_parse_validator'
3
3
  require 'typhoeus'
4
4
  require 'nokogiri'
5
5
  require 'active_support/inflector'
6
+ require 'active_support/concern'
6
7
  require 'addressable/uri'
7
8
  require 'public_suffix'
8
9
  require 'ruby-progressbar'
@@ -26,6 +27,7 @@ require 'cms_scanner/version'
26
27
  require 'cms_scanner/controller'
27
28
  require 'cms_scanner/controllers'
28
29
  require 'cms_scanner/formatter'
30
+ require 'cms_scanner/references'
29
31
  require 'cms_scanner/finders'
30
32
  require 'cms_scanner/vulnerability'
31
33
 
@@ -14,7 +14,7 @@ module CMSScanner
14
14
  def register_options_files
15
15
  [Dir.home, Dir.pwd].each do |dir|
16
16
  option_parser.options_files.supported_extensions.each do |ext|
17
- @option_parser.options_files << File.join(dir, ".#{NS.app_name}", "cli_options.#{ext}")
17
+ @option_parser.options_files << Pathname.new(dir).join(".#{NS.app_name}", "cli_options.#{ext}").to_s
18
18
  end
19
19
  end
20
20
  end
@@ -1,6 +1,7 @@
1
1
  require 'cms_scanner/finders/finder'
2
2
  require 'cms_scanner/finders/finding'
3
3
  require 'cms_scanner/finders/findings'
4
+ require 'cms_scanner/finders/base_finders'
4
5
  require 'cms_scanner/finders/independent_finders'
5
6
  require 'cms_scanner/finders/independent_finder'
6
7
  require 'cms_scanner/finders/unique_finders'
@@ -0,0 +1,42 @@
1
+ module CMSScanner
2
+ module Finders
3
+ # Base class container for the Finders (i.e IndependentFinders etc)
4
+ class BaseFinders < Array
5
+ # @return [ Findings ]
6
+ def findings
7
+ @findings ||= NS::Finders::Findings.new
8
+ end
9
+
10
+ # Should be implemented in child classes
11
+ def run; end
12
+
13
+ protected
14
+
15
+ # @param [ Symbol ] mode :mixed, :passive or :aggressive
16
+ # @return [ Array<Symbol> ] The symbols to call for the mode
17
+ def symbols_from_mode(mode)
18
+ symbols = [:passive, :aggressive]
19
+
20
+ return symbols if mode.nil? || mode == :mixed
21
+ symbols.include?(mode) ? [*mode] : []
22
+ end
23
+
24
+ # @param [ CMSScanner::Finders::Finder ] finder
25
+ # @param [ Symbol ] symbol See return values of #symbols_from_mode
26
+ # @param [ Hash ] opts
27
+ def run_finder(finder, symbol, opts)
28
+ [*finder.send(symbol, opts.merge(found: findings))].compact.each do |found|
29
+ findings << found
30
+ end
31
+ end
32
+
33
+ # Allow child classes to filter the findings, such as return the best one
34
+ # or remove the low confidence ones.
35
+ #
36
+ # @return [ Findings ]
37
+ def filter_findings
38
+ findings
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,12 +1,11 @@
1
- require 'cms_scanner/references'
2
-
3
1
  module CMSScanner
4
2
  module Finders
5
3
  # Finding
6
4
  module Finding
7
5
  # Fix for "Double/Dynamic Inclusion Problem"
8
6
  def self.included(base)
9
- base.send(:include, References)
7
+ base.include References
8
+ super(base)
10
9
  end
11
10
 
12
11
  FINDING_OPTS = [:confidence, :confirmed_by, :references, :found_by, :interesting_entries]
@@ -2,11 +2,9 @@ module CMSScanner
2
2
  module Finders
3
3
  # Independent Finder
4
4
  module IndependentFinder
5
- def self.included(base)
6
- base.extend(ClassMethods)
7
- end
5
+ extend ActiveSupport::Concern
8
6
 
9
- # Hack to have the #find as a class method
7
+ # See ActiveSupport::Concern
10
8
  module ClassMethods
11
9
  def find(target, opts = {})
12
10
  new(target).find(opts)
@@ -1,15 +1,9 @@
1
1
  module CMSScanner
2
2
  module Finders
3
- # Independent Finders container
4
3
  # This class is designed to handle independent results
5
4
  # which are not related with each others
6
5
  # e.g: interesting files
7
- class IndependentFinders < Array
8
- # @return [ Findings ]
9
- def findings
10
- @findings ||= NS::Finders::Findings.new
11
- end
12
-
6
+ class IndependentFinders < BaseFinders
13
7
  # @param [ Hash ] opts
14
8
  # @option opts [ Symbol ] mode :mixed, :passive or :aggressive
15
9
  #
@@ -25,34 +19,6 @@ module CMSScanner
25
19
 
26
20
  filter_findings
27
21
  end
28
-
29
- protected
30
-
31
- # @param [ Symbol ] mode :mixed, :passive or :aggressive
32
- # @return [ Array<Symbol> ] The symbols to call for the mode
33
- def symbols_from_mode(mode)
34
- symbols = [:passive, :aggressive]
35
-
36
- return symbols if mode.nil? || mode == :mixed
37
- symbols.include?(mode) ? [*mode] : []
38
- end
39
-
40
- # @param [ CMSScanner::Finders::Finder ] finder
41
- # @param [ Symbol ] symbol See return values of #symbols_from_mode
42
- # @param [ Hash ] opts
43
- def run_finder(finder, symbol, opts)
44
- [*finder.send(symbol, opts.merge(found: findings))].compact.each do |found|
45
- findings << found
46
- end
47
- end
48
-
49
- # Allow child classes to filter the findings, such as return the best one
50
- # or remove the low confidence ones.
51
- #
52
- # @return [ Findings ]
53
- def filter_findings
54
- findings
55
- end
56
22
  end
57
23
  end
58
24
  end
@@ -1,10 +1,8 @@
1
1
  module CMSScanner
2
2
  module Finders
3
- # Same Type Finders container
4
- #
5
3
  # This class is designed to handle same type results, such as enumeration of plugins,
6
4
  # themes etc.
7
- class SameTypeFinders < IndependentFinders
5
+ class SameTypeFinders < BaseFinders
8
6
  # @param [ Hash ] opts
9
7
  # @option opts [ Symbol ] :mode :mixed, :passive or :aggressive
10
8
  # @option opts [ Boolean ] :sort Wether or not to sort the findings
@@ -1,11 +1,9 @@
1
1
  module CMSScanner
2
2
  module Finders
3
- # Unique Finders container
4
- #
5
3
  # This class is designed to return a unique result such as a version
6
4
  # Note: Finders contained can return multiple results but the #run will only
7
5
  # returned the best finding
8
- class UniqueFinders < IndependentFinders
6
+ class UniqueFinders < BaseFinders
9
7
  # @param [ Hash ] opts
10
8
  # @option opts [ Symbol ] :mode :mixed, :passive or :aggressive
11
9
  # @option opts [ Int ] :confidence_threshold If a finding's confidence reaches this value,
@@ -128,7 +128,10 @@ module CMSScanner
128
128
 
129
129
  # @return [ Array<String> ] The directories to look into for views
130
130
  def views_directories
131
- @views_directories ||= [APP_DIR, NS::APP_DIR].uniq.reduce([]) { |a, e| a << Pathname.new(e).join('views').to_s }
131
+ @views_directories ||= [
132
+ APP_DIR, NS::APP_DIR,
133
+ File.join(Dir.home, ".#{NS.app_name}"), File.join(Dir.pwd, ".#{NS.app_name}")
134
+ ].uniq.reduce([]) { |a, e| a << Pathname.new(e).join('views').to_s }
132
135
  end
133
136
  end
134
137
  end
@@ -1,16 +1,21 @@
1
1
  module CMSScanner
2
2
  # References related to the issue
3
3
  module References
4
- # @return [ Array<Symbol> ]
5
- def references_keys
6
- [:cve, :secunia, :osvdb, :exploitdb, :url, :metasploit, :packetstorm, :securityfocus]
4
+ extend ActiveSupport::Concern
5
+
6
+ # See ActiveSupport::Concern
7
+ module ClassMethods
8
+ # @return [ Array<Symbol> ]
9
+ def references_keys
10
+ @references_keys ||= [:cve, :secunia, :osvdb, :exploitdb, :url, :metasploit, :packetstorm, :securityfocus]
11
+ end
7
12
  end
8
13
 
9
14
  # @param [ Hash ] refs
10
15
  def references=(refs)
11
16
  @references = {}
12
17
 
13
- references_keys.each do |key|
18
+ self.class.references_keys.each do |key|
14
19
  @references[key] = [*refs[key]].map(&:to_s) if refs.key?(key)
15
20
  end
16
21
  end
@@ -28,7 +33,7 @@ module CMSScanner
28
33
 
29
34
  # @return [ Array<String> ] The CVEs
30
35
  def cves
31
- @cve ||= references[:cve] || []
36
+ references[:cve] || []
32
37
  end
33
38
 
34
39
  # @return [ Array<String> ]
@@ -43,7 +48,7 @@ module CMSScanner
43
48
 
44
49
  # @return [ Array<String> ] The Secunia IDs
45
50
  def secunia_ids
46
- @secunia_ids ||= references[:secunia] || []
51
+ references[:secunia] || []
47
52
  end
48
53
 
49
54
  # @return [ Array<String> ]
@@ -58,7 +63,7 @@ module CMSScanner
58
63
 
59
64
  # @return [ Array<String> ] The OSVDB IDs
60
65
  def osvdb_ids
61
- @osvdb_ids ||= references[:osvdb] || []
66
+ references[:osvdb] || []
62
67
  end
63
68
 
64
69
  # @return [ Array<String> ]
@@ -73,7 +78,7 @@ module CMSScanner
73
78
 
74
79
  # @return [ Array<String> ] The ExploitDB ID
75
80
  def exploitdb_ids
76
- @exploitdb_ids ||= references[:exploitdb] || []
81
+ references[:exploitdb] || []
77
82
  end
78
83
 
79
84
  # @return [ Array<String> ]
@@ -88,12 +93,12 @@ module CMSScanner
88
93
 
89
94
  # @return [ String<Array> ]
90
95
  def urls
91
- @urls ||= references[:url] || []
96
+ references[:url] || []
92
97
  end
93
98
 
94
99
  # @return [ Array<String> ] The metasploit modules
95
100
  def msf_modules
96
- @msf_modules ||= references[:metasploit] || []
101
+ references[:metasploit] || []
97
102
  end
98
103
 
99
104
  # @return [ Array<String> ]
@@ -123,7 +128,7 @@ module CMSScanner
123
128
 
124
129
  # @return [ Array<String> ] The Security Focus IDs
125
130
  def securityfocus_ids
126
- @securityfocus_ids ||= references[:securityfocus] || []
131
+ references[:securityfocus] || []
127
132
  end
128
133
 
129
134
  # @return [ Array<String> ]
@@ -1,4 +1,4 @@
1
1
  # Version
2
2
  module CMSScanner
3
- VERSION = '0.0.35.1'
3
+ VERSION = '0.0.36'
4
4
  end
@@ -1,5 +1,3 @@
1
- require 'cms_scanner/references'
2
-
3
1
  module CMSScanner
4
2
  # Generic Vulnerability
5
3
  class Vulnerability
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cms_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35.1
4
+ version: 0.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - WPScanTeam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-17 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opt_parse_validator
@@ -263,6 +263,7 @@ files:
263
263
  - lib/cms_scanner/errors/http.rb
264
264
  - lib/cms_scanner/exit_code.rb
265
265
  - lib/cms_scanner/finders.rb
266
+ - lib/cms_scanner/finders/base_finders.rb
266
267
  - lib/cms_scanner/finders/finder.rb
267
268
  - lib/cms_scanner/finders/finder/enumerator.rb
268
269
  - lib/cms_scanner/finders/finder/fingerprinter.rb