rapid7/metasploit-framework

View on GitHub
modules/auxiliary/scanner/http/iis_shortname_scanner.rb

Summary

Maintainability
D
1 day
Test Coverage

Method scan has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def scan
    while !@queue.empty?
      url = @queue.pop
      status = get_status(url , "1" , "*")
      # Check strings only upto 6 chars in length
Severity: Minor
Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb - About 4 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 scanner has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def scanner
    while !@queue_ext.empty?
      f = @queue_ext.pop
      url = f.split(':')[0]
      ext = f.split(':')[1]
Severity: Minor
Found in modules/auxiliary/scanner/http/iis_shortname_scanner.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 initialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name'        => 'Microsoft IIS shortname vulnerability scanner',
Severity: Minor
Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb - About 1 hr to fix

    Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def run
        unless is_vul
          print_status("Target is not vulnerable, or no shortname scannable files are present.")
          return
        end
    Severity: Minor
    Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb - About 1 hr to fix

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

        def run
          unless is_vul
            print_status("Target is not vulnerable, or no shortname scannable files are present.")
            return
          end
      Severity: Minor
      Found in modules/auxiliary/scanner/http/iis_shortname_scanner.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 scan has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def scan
          while !@queue.empty?
            url = @queue.pop
            status = get_status(url , "1" , "*")
            # Check strings only upto 6 chars in length
      Severity: Minor
      Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                  for c in @charset_names
                    @queue  <<(url +c)
                  end
        Severity: Major
        Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb - About 45 mins to fix

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

            def is_vul
              @path = datastore['PATH']
              for method in ['GET', 'OPTIONS']
                # Check for existing file
                res1 = send_request_cgi({
          Severity: Minor
          Found in modules/auxiliary/scanner/http/iis_shortname_scanner.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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              if @files.empty?
                print_status("No files were found")
              else
                print_good("Found #{@files.size} files")
                @files.each do |x|
          Severity: Minor
          Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb and 1 other location - About 25 mins to fix
          modules/auxiliary/scanner/http/iis_shortname_scanner.rb on lines 252..257

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 29.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            def reduce
              # Reduce the total charset for filenames by checking if a character exists in any of the files
              for c in @alpha.chars
                res = send_request_cgi({
                  'uri' => normalize_uri(@path,"*#{c}*~1*"),
          Severity: Minor
          Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb and 1 other location - About 25 mins to fix
          modules/auxiliary/scanner/http/iis_shortname_scanner.rb on lines 197..206

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 29.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            def ext
              # Reduce the total charset for extensions by checking if a character exists in any of the extensions
              for c in @alpha.chars
                res = send_request_cgi({
                  'uri' => normalize_uri(@path,"*~1.*#{c}*"),
          Severity: Minor
          Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb and 1 other location - About 25 mins to fix
          modules/auxiliary/scanner/http/iis_shortname_scanner.rb on lines 184..193

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 29.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              if @dirs.empty?
                print_status("No directories were found")
              else
                print_good("Found #{@dirs.size} directories")
                @dirs.each do |x|
          Severity: Minor
          Found in modules/auxiliary/scanner/http/iis_shortname_scanner.rb and 1 other location - About 25 mins to fix
          modules/auxiliary/scanner/http/iis_shortname_scanner.rb on lines 261..266

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 29.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status