wpscanteam/CMSScanner

View on GitHub

Showing 20 of 20 total issues

Method attack has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        def attack(users, wordlist_path, opts = {})
          wordlist = File.open(wordlist_path)

          create_progress_bar(total: users.size * wordlist.count, show_progression: opts[:show_progression])

Severity: Minor
Found in lib/cms_scanner/finders/finder/breadth_first_dictionary_attack.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method uris_from_page has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def uris_from_page(page = nil, xpath = '//@href|//@src|//@data-src')
      page    = NS::Browser.get(url(page)) unless page.is_a?(Typhoeus::Response)
      found   = []

      page.html.xpath(xpath).each do |node|
Severity: Minor
Found in lib/cms_scanner/target.rb - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method enumerate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def enumerate(urls, opts = {})
          create_progress_bar(opts.merge(total: urls.size))

          urls.each do |url, id|
            request = browser.forge_request(url, head_or_get_request_params)
Severity: Minor
Found in lib/cms_scanner/finders/finder/enumerator.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method attack has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def attack(users, wordlist_path, opts = {})
          wordlist = File.open(wordlist_path)

          create_progress_bar(total: users.size * wordlist.count, show_progression: opts[:show_progression])

Severity: Minor
Found in lib/cms_scanner/finders/finder/breadth_first_dictionary_attack.rb - About 1 hr to fix

    Method view_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def view_path(tpl)
            if tpl[0, 1] == '@' # Global Template
              tpl = tpl.delete('@')
            else
              raise 'The controller_name can not be nil' unless controller_name
    Severity: Minor
    Found in lib/cms_scanner/formatter.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method << has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

              def <<(finding)
                return self unless finding
    
                each do |f|
                  next unless f == finding && f.found_by == finding.found_by
    Severity: Minor
    Found in lib/cms_scanner/finders/finder/smart_url_checker/findings.rb - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def run(opts = {})
            opts[:confidence_threshold] ||= 100
    
            symbols_from_mode(opts[:mode]).each do |symbol|
              each do |finder|
    Severity: Minor
    Found in lib/cms_scanner/finders/unique_finders.rb - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method xpath_pattern_from_page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def xpath_pattern_from_page(xpath, pattern, page = nil)
          page    = NS::Browser.get(url(page)) unless page.is_a?(Typhoeus::Response)
          matches = []
    
          page.html.xpath(xpath).each do |node|
    Severity: Minor
    Found in lib/cms_scanner/target.rb - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method aggressive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def aggressive(_opts = {})
              potential_urls << target.url('xmlrpc.php')
    
              potential_urls.uniq.each do |potential_url|
                next unless target.in_scope?(potential_url)
    Severity: Minor
    Found in app/finders/interesting_findings/xml_rpc.rb - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method include? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def include?(host)
            if PublicSuffix.valid?(host, ignore_private: true)
              domain = PublicSuffix.parse(host, ignore_private: true)
    
              domains.each { |d| return true if domain.match(d) }
    Severity: Minor
    Found in lib/cms_scanner/target/scope.rb - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method interesting_entries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def interesting_entries
            results = []
    
            entries.each do |entry|
              next unless entry =~ /\A(?:dis)?allow:\s*(.+)\z/i
    Severity: Minor
    Found in app/models/robots_txt.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method references= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def references=(refs)
          @references = {}
    
          self.class.references_keys.each do |key|
            next unless refs.key?(key)
    Severity: Minor
    Found in lib/cms_scanner/references.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method default_request_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def default_request_params
          params = default_connect_request_params.merge(
            headers: { 'User-Agent' => user_agent, 'Referer' => url }.merge(headers || {}),
            accept_encoding: 'gzip, deflate',
            method: :get
    Severity: Minor
    Found in lib/cms_scanner/browser.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method maybe_get_full_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def maybe_get_full_response(head_res, opts)
              return head_res unless opts[:check_full_response] == true ||
                                     Array(opts[:check_full_response]).include?(head_res.code)
    
              full_res = NS::Browser.get(head_res.effective_url, full_request_params)
    Severity: Minor
    Found in lib/cms_scanner/finders/finder/enumerator.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method match has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def match(pattern)
          pattern = PublicSuffix.parse(pattern) unless pattern.is_a?(PublicSuffix::Domain)
    
          return name == pattern.name unless pattern.trd
          return false unless tld == pattern.tld && sld == pattern.sld
    Severity: Minor
    Found in lib/cms_scanner/public_suffix/domain.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def run
          controllers.run
        rescue OptParseValidator::NoRequiredOption => e
          @run_error = e
    
    
    Severity: Minor
    Found in lib/cms_scanner/scan.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method << has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def <<(finding)
            return self unless finding
    
            each do |found|
              next unless found == finding
    Severity: Minor
    Found in lib/cms_scanner/finders/findings.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method exit_hook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def exit_hook
          # Avoid hooking the exit when rspec is running, otherwise it will always return 0
          # and Travis won't detect failed builds. Couldn't find a better way, even though
          # some people managed to https://github.com/rspec/rspec-core/pull/410
          return if defined?(RSpec)
    Severity: Minor
    Found in lib/cms_scanner/scan.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method maybe_output_banner_help_and_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def maybe_output_banner_help_and_version
            output('banner') if NS::ParsedCli.banner
            output('help', help: option_parser.simple_help, simple: true) if NS::ParsedCli.help
            output('help', help: option_parser.full_help, simple: false) if NS::ParsedCli.hh
            output('version') if NS::ParsedCli.version
    Severity: Minor
    Found in app/controllers/core.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method in_scope_uris has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def in_scope_uris(res, xpath = '//@href|//@src|//@data-src')
          found = []
    
          uris_from_page(res, xpath) do |uri, tag|
            next unless in_scope?(uri)
    Severity: Minor
    Found in lib/cms_scanner/target/scope.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language