rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

Method import_qualys_scan_xml has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  def import_qualys_scan_xml(args={}, &block)
    data = args[:data]
    wspace = Msf::Util::DBManager.process_opts_workspace(args, framework).name
    bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []

Severity: Minor
Found in lib/msf/core/db_manager/import/qualys/scan.rb - About 5 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 asm_reverse_winhttp has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  def asm_reverse_winhttp(opts={})

    retry_count       = [opts[:retry_count].to_i, 1].max
    verify_ssl        = nil
    encoded_cert_hash = nil
Severity: Minor
Found in lib/msf/core/payload/windows/reverse_win_http.rb - About 5 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 147 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize
    super(
      'Name'           => 'Veeder-Root Automatic Tank Gauge (ATG) Administrative Client',
      'Description'    => %q{
        This module acts as a simplistic administrative client for interfacing
Severity: Major
Found in modules/auxiliary/admin/atg/atg_client.rb - About 5 hrs to fix

    File aggregator.rb has 411 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Msf
      Aggregator_yaml = "#{Msf::Config.config_directory}/aggregator.yaml".freeze # location of the aggregator.yml containing saved aggregator creds
    
      # This plugin provides management and interaction with an external session aggregator.
      class Plugin::Aggregator < Msf::Plugin
    Severity: Minor
    Found in plugins/aggregator.rb - About 5 hrs to fix

      File http_server.rb has 411 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'rex/exploitation/obfuscatejs'
      require 'rex/exploitation/encryptjs'
      require 'rex/exploitation/heaplib'
      require 'rex/exploitation/js'
      
      
      Severity: Minor
      Found in lib/msf/core/exploit/remote/http_server.rb - About 5 hrs to fix

        File wp_crop_rce.rb has 410 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class MetasploitModule < Msf::Exploit::Remote
          Rank = ExcellentRanking
        
          include Msf::Exploit::FileDropper
          include Msf::Exploit::Remote::HTTP::Wordpress
        Severity: Minor
        Found in modules/exploits/multi/http/wp_crop_rce.rb - About 5 hrs to fix

          Method cmd_workspace has 146 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def cmd_workspace(*args)
              return unless active?
          
              state = :nil
          
          
          Severity: Major
          Found in lib/msf/ui/console/command_dispatcher/db.rb - About 5 hrs to fix

            Class MsftidyRunner has 43 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class MsftidyRunner
            
              # Status codes
              OK       = 0
              WARNING  = 1
            Severity: Minor
            Found in tools/dev/msftidy.rb - About 5 hrs to fix

              Method listeners_start has 145 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def listeners_start(args)
                      config = parse_start_args(args)
                      if config[:show_help]
                        help('start')
                        return
              Severity: Major
              Found in plugins/capture.rb - About 5 hrs to fix

                Method run_host has 145 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def run_host(ip)
                
                    begin
                      snmp = connect_snmp
                
                
                Severity: Major
                Found in modules/auxiliary/scanner/snmp/sbg6580_enum.rb - About 5 hrs to fix

                  Method run_host has 145 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def run_host(ip)
                      verbs = %w(
                        get
                        active
                        activate
                  Severity: Major
                  Found in modules/auxiliary/scanner/http/soap_xml.rb - About 5 hrs to fix

                    File dispatcher_shell.rb has 407 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'pp'
                    require 'rex/text/table'
                    require 'erb'
                    require 'readline'
                    
                    
                    Severity: Minor
                    Found in lib/rex/ui/text/dispatcher_shell.rb - About 5 hrs to fix

                      File lsa.rb has 407 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'rex/proto/ms_dtyp'
                      
                      module Msf
                        class Post
                          module Windows
                      Severity: Minor
                      Found in lib/msf/core/post/windows/lsa.rb - About 5 hrs to fix

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

                          def run
                            dork = datastore['ZOOMEYE_DORK']
                            resource = datastore['RESOURCE']
                            maxpage = datastore['MAXPAGE']
                            facets = datastore['FACETS']
                        Severity: Major
                        Found in modules/auxiliary/gather/zoomeye_search.rb - About 5 hrs to fix

                          Method run_host has 144 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def run_host(ip)
                              base_header = BaseHeader.new
                          
                              # Version number is always 0x10
                              base_header.version_number = 16
                          Severity: Major
                          Found in modules/auxiliary/scanner/msmq/cve_2023_21554_queuejumper.rb - About 5 hrs to fix

                            Method exploit has 144 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def exploit
                                # CVE-2024-0204 allows an unauthenticated attacker to create a new administrator account on the target system. So
                                # we generate the username/password pair we want to use.
                                # Note: We cannot delete the administrator account that we create.
                                admin_username = Rex::Text.rand_text_alpha_lower(8)

                              Method rpc_round_exec has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def rpc_round_exec(mod, mtype, opts, nmaxjobs)
                                      res = nil
                                      idx = 0
                              
                                      if active_rpc_nodes == 0
                              Severity: Minor
                              Found in plugins/wmap.rb - About 5 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_host has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def run_host(ip)
                                  conn = true
                                  ecode = nil
                                  emesg = nil
                              
                              
                              Severity: Minor
                              Found in modules/auxiliary/scanner/http/dir_webdav_unicode_bypass.rb - About 5 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_host has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def run_host(ip)
                                  print_status("#{ip}:#{rport} SSH - Testing Cleartext Keys")
                              
                                  if datastore["USER_FILE"].blank? && datastore["USERNAME"].blank?
                                    validation_reason = "At least one of USER_FILE or USERNAME must be given"
                              Severity: Minor
                              Found in modules/auxiliary/scanner/ssh/ssh_login_pubkey.rb - About 5 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 exploit has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def exploit
                                  #
                                  # 1. Leverage the auth bypass to generate a new administrator access token. Older version of TeamCity (circa 2018)
                                  #    do not have support for access token, so we fall back to creating a new administrator account. The benefit
                                  #    of using an access token is we can delete it when we are finished, unlike a user account.
                              Severity: Minor
                              Found in modules/exploits/multi/http/jetbrains_teamcity_rce_cve_2024_27198.rb - About 5 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