• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wpscanteam / CMSScanner / 10771931262

09 Sep 2024 11:06AM UTC coverage: 99.925%. Remained the same
10771931262

push

github

web-flow
Merge pull request #261 from wpscanteam/dependabot/bundler/webmock-tw-3.23.1

Update webmock requirement from ~> 3.19.1 to ~> 3.23.1

315 of 346 branches covered (91.04%)

1333 of 1334 relevant lines covered (99.93%)

120.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/app/controllers/core/cli_options.rb
1
# frozen_string_literal: true
2

3
module CMSScanner
4✔
4
  module Controller
4✔
5
    # CLI Options for the Core Controller
6
    class Core < Base
4✔
7
      def cli_options
4✔
8
        formats = NS::Formatter.availables
304✔
9

10
        [
11
          OptURL.new(['-u', '--url URL', 'The URL to scan'],
304✔
12
                     required_unless: %i[help hh version],
13
                     default_protocol: 'http'),
14
          OptBoolean.new(['--force', 'Do not check if target returns a 403'])
15
        ] + mixed_cli_options + [
16
          OptFilePath.new(['-o', '--output FILE', 'Output to FILE'], writable: true, exists: false),
17
          OptChoice.new(['-f', '--format FORMAT',
18
                         'Output results in the format supplied'], choices: formats),
19
          OptChoice.new(['--detection-mode MODE'],
20
                        choices: %w[mixed passive aggressive],
21
                        normalize: :to_sym,
22
                        default: :mixed),
23
          OptArray.new(['--scope DOMAINS',
24
                        'Comma separated (sub-)domains to consider in scope. ',
25
                        'Wildcard(s) allowed in the trd of valid domains, e.g: *.target.tld'], advanced: true)
26
        ] + cli_browser_options
27
      end
28

29
      def mixed_cli_options
4✔
30
        [
31
          OptBoolean.new(['-h', '--help', 'Display the simple help and exit']),
304✔
32
          OptBoolean.new(['--hh', 'Display the full help and exit']),
33
          OptBoolean.new(['--version', 'Display the version and exit']),
34
          OptBoolean.new(['--ignore-main-redirect', 'Ignore the main redirect (if any) and scan the target url'],
35
                         advanced: true),
36
          OptBoolean.new(['-v', '--verbose', 'Verbose mode']),
37
          OptBoolean.new(['--[no-]banner', 'Whether or not to display the banner'], default: true),
38
          OptPositiveInteger.new(['--max-scan-duration SECONDS',
39
                                  'Abort the scan if it exceeds the time provided in seconds'],
40
                                 advanced: true)
41
        ]
42
      end
43

44
      # @return [ Array<OptParseValidator::OptBase> ]
45
      def cli_browser_options
4✔
46
        cli_browser_headers_options + [
304✔
47
          OptBoolean.new(['--random-user-agent', '--rua',
48
                          'Use a random user-agent for each scan']),
49
          OptFilePath.new(['--user-agents-list FILE-PATH',
50
                           'List of agents to use with --random-user-agent'],
51
                          exists: true,
52
                          advanced: true,
53
                          default: APP_DIR.join('user_agents.txt')),
54
          OptCredentials.new(['--http-auth login:password']),
55
          OptPositiveInteger.new(['-t', '--max-threads VALUE', 'The max threads to use'],
56
                                 default: 5),
57
          OptPositiveInteger.new(['--throttle MilliSeconds', 'Milliseconds to wait before doing another web request. ' \
58
                                                             'If used, the max threads will be set to 1.']),
59
          OptPositiveInteger.new(['--request-timeout SECONDS', 'The request timeout in seconds'],
60
                                 default: 60),
61
          OptPositiveInteger.new(['--connect-timeout SECONDS', 'The connection timeout in seconds'],
62
                                 default: 30),
63
          OptBoolean.new(['--disable-tls-checks',
64
                          'Disables SSL/TLS certificate verification, and downgrade to TLS1.0+ ' \
65
                          '(requires cURL 7.66 for the latter)'])
66
        ] + cli_browser_proxy_options + cli_browser_cookies_options + cli_browser_cache_options
67
      end
68

69
      # @return [ Array<OptParseValidator::OptBase> ]
70
      def cli_browser_headers_options
4✔
71
        [
72
          OptString.new(['--user-agent VALUE', '--ua']),
304✔
73
          OptHeaders.new(['--headers HEADERS', 'Additional headers to append in requests'], advanced: true),
74
          OptString.new(['--vhost VALUE', 'The virtual host (Host header) to use in requests'], advanced: true)
75
        ]
76
      end
77

78
      # @return [ Array<OptParseValidator::OptBase> ]
79
      def cli_browser_proxy_options
4✔
80
        [
81
          OptProxy.new(['--proxy protocol://IP:port',
304✔
82
                        'Supported protocols depend on the cURL installed']),
83
          OptCredentials.new(['--proxy-auth login:password'])
84
        ]
85
      end
86

87
      # @return [ Array<OptParseValidator::OptBase> ]
88
      def cli_browser_cookies_options
4✔
89
        [
90
          OptString.new(['--cookie-string COOKIE',
304✔
91
                         'Cookie string to use in requests, ' \
92
                         'format: cookie1=value1[; cookie2=value2]']),
93
          OptFilePath.new(['--cookie-jar FILE-PATH', 'File to read and write cookies'],
94
                          writable: true,
95
                          readable: true,
96
                          create: true,
97
                          default: File.join(tmp_directory, 'cookie_jar.txt'))
98
        ]
99
      end
100

101
      # @return [ Array<OptParseValidator::OptBase> ]
102
      def cli_browser_cache_options
4✔
103
        [
104
          OptInteger.new(['--cache-ttl TIME_TO_LIVE', 'The cache time to live in seconds'],
304✔
105
                         default: 600, advanced: true),
106
          OptBoolean.new(['--clear-cache', 'Clear the cache before the scan'], advanced: true),
107
          OptDirectoryPath.new(['--cache-dir PATH'],
108
                               readable: true,
109
                               writable: true,
110
                               create: true,
111
                               default: File.join(tmp_directory, 'cache'),
112
                               advanced: true)
113
        ]
114
      end
115
    end
116
  end
117
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc