rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method cmd_help has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def cmd_help(cmd=nil, *ignored)
      if cmd
        help_found = false
        cmd_found = false
        shell.dispatcher_stack.each do |dispatcher|
Severity: Minor
Found in lib/rex/ui/text/dispatcher_shell.rb - About 6 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 to_executable has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

  def self.to_executable(framework, arch, plat, code = '', opts = {})
    if elf? code or macho? code
      return code
    end

Severity: Minor
Found in lib/msf/util/exe.rb - About 6 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 response_hash_to_data_array has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

  def response_hash_to_data_array(id, hash, start_offset = 5)
    data = []
    return data unless hash
    bad_count = 0
    if hash.key? "Packets"
Severity: Minor
Found in lib/msf/core/post/hardware/automotive/uds.rb - About 6 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

File modbusclient.rb has 427 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MetasploitModule < Msf::Auxiliary
  include Msf::Exploit::Remote::Tcp

  def initialize(info = {})
    super(
Severity: Minor
Found in modules/auxiliary/scanner/scada/modbusclient.rb - About 6 hrs to fix

    Method asm_reflective_pe_loader has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def asm_reflective_pe_loader(opts)
    
          prologue = ''
          if opts[:is_dll] == true
            prologue = %(
    Severity: Major
    Found in lib/msf/core/payload/windows/reflective_pe_loader.rb - About 6 hrs to fix

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

        def process_propfind(cli, request)
          path = request.uri
          print_status("PROPFIND #{path}")
          body = ''
      
      
      Severity: Major
      Found in modules/exploits/windows/browser/webdav_dll_hijacker.rb and 2 other locations - About 6 hrs to fix
      modules/exploits/windows/browser/ubisoft_uplay_cmd_exec.rb on lines 191..307
      modules/exploits/windows/misc/vmhgfs_webdav_dll_sideload.rb on lines 133..249

      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 204.

      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 3 locations. Consider refactoring.
      Open

        def process_propfind(cli, request)
          path = request.uri
          print_status("PROPFIND #{path}")
          body = ''
      
      
      Severity: Major
      Found in modules/exploits/windows/misc/vmhgfs_webdav_dll_sideload.rb and 2 other locations - About 6 hrs to fix
      modules/exploits/windows/browser/ubisoft_uplay_cmd_exec.rb on lines 191..307
      modules/exploits/windows/browser/webdav_dll_hijacker.rb on lines 145..261

      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 204.

      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 3 locations. Consider refactoring.
      Open

        def process_propfind(cli, request)
          path = request.uri
          vprint_status("PROPFIND #{path}")
          body = ''
      
      
      Severity: Major
      Found in modules/exploits/windows/browser/ubisoft_uplay_cmd_exec.rb and 2 other locations - About 6 hrs to fix
      modules/exploits/windows/browser/webdav_dll_hijacker.rb on lines 145..261
      modules/exploits/windows/misc/vmhgfs_webdav_dll_sideload.rb on lines 133..249

      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 204.

      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

      Method cmd_services has 155 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def cmd_services(*args)
          return unless active?
          mode = :search
          onlyup = false
          output_file = nil
      Severity: Major
      Found in lib/msf/ui/console/command_dispatcher/db.rb - About 6 hrs to fix

        File report.rb has 425 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'metasploit/framework/require'
        
        module Msf
        
        ###
        Severity: Minor
        Found in lib/msf/core/auxiliary/report.rb - About 6 hrs to fix

          File reverse_http.rb has 425 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Msf
          
          ###
          #
          # Complex payload generation for Windows ARCH_X86 that speak HTTP(S)
          Severity: Minor
          Found in lib/msf/core/payload/windows/reverse_http.rb - About 6 hrs to fix

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

            module Payload::Linux::ReverseTcp_x64
            
              include Msf::Payload::TransportConfig
              include Msf::Payload::Linux
            
            
            Severity: Major
            Found in lib/msf/core/payload/linux/x64/reverse_tcp_x64.rb and 1 other location - About 6 hrs to fix
            lib/msf/core/payload/linux/x64/reverse_sctp_x64.rb on lines 12..179

            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 203.

            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

            module Payload::Linux::ReverseSctp_x64
            
              include Msf::Payload::TransportConfig
              include Msf::Payload::Linux
            
            
            Severity: Major
            Found in lib/msf/core/payload/linux/x64/reverse_sctp_x64.rb and 1 other location - About 6 hrs to fix
            lib/msf/core/payload/linux/x64/reverse_tcp_x64.rb on lines 12..177

            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 203.

            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

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

              def run
                def check_results(passwords, results, hash_type, method)
                  passwords.each do |password_line|
                    password_line.chomp!
                    next if password_line.blank?
            Severity: Major
            Found in modules/auxiliary/analyze/crack_databases.rb - About 6 hrs to fix

              File cve_2022_26923_certifried.rb has 422 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MetasploitModule < Msf::Auxiliary
                include Msf::Exploit::Remote::SMB::Client::Authenticated
                alias connect_smb_client connect
              
                include Msf::Exploit::Remote::Kerberos::Client
              Severity: Minor
              Found in modules/auxiliary/admin/dcerpc/cve_2022_26923_certifried.rb - About 6 hrs to fix

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

                  def run
                    # check for meterpreter and version of ie
                    if (session.type != 'meterpreter') && session.platform !~ (/win/)
                      print_error('This module only works with Windows Meterpreter sessions')
                      return 0
                Severity: Major
                Found in modules/post/windows/gather/enum_ie.rb - About 6 hrs to fix

                  Method asm_reverse_named_pipe has 153 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def asm_reverse_named_pipe(opts={})
                  
                      retry_count    = [opts[:retry_count].to_i, 1].max
                      reliable       = opts[:reliable]
                      # we have to double-escape because of metasm
                  Severity: Major
                  Found in lib/msf/core/payload/windows/reverse_named_pipe.rb - About 6 hrs to fix

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

                      def run
                        print_status('Starting SQL injection workflow...')
                    
                        res = send_request_cgi(
                          'method' => 'GET',
                    Severity: Minor
                    Found in modules/auxiliary/admin/http/fortra_filecatalyst_workflow_sqli.rb - About 6 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 run has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def run
                        init_fuzzdata()
                        init_vars()
                    
                        print_status("Grabbing webpage #{datastore['URL']} from #{datastore['RHOST']}")
                    Severity: Minor
                    Found in modules/auxiliary/fuzzers/http/http_form_field.rb - About 6 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 parse_listing has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def parse_listing(response, directory)
                        result = { 'name' => '', 'date' => '', 'size' => '', 'type' => '' }
                        i = 0
                    
                        begin
                    Severity: Minor
                    Found in modules/exploits/windows/nimsoft/nimcontroller_bof.rb - About 6 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

                    Severity
                    Category
                    Status
                    Source
                    Language