rapid7/metasploit-framework

View on GitHub

Showing 15,831 of 21,886 total issues

Method cmd_jobs has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

          def cmd_jobs(*args)
            # Make the default behavior listing all jobs if there were no options
            # or the only option is the verbose flag
            args.unshift("-l") if args.empty? || args == ["-v"]

Severity: Minor
Found in lib/msf/ui/console/command_dispatcher/jobs.rb - About 7 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

Class ConsoleCommandDispatcher has 55 methods (exceeds 20 allowed). Consider refactoring.
Open

    class ConsoleCommandDispatcher
      include Msf::Ui::Console::CommandDispatcher

      def name
        PLUGIN_NAME
Severity: Major
Found in plugins/nessus.rb - About 7 hrs to fix

    File safari_jit.rb has 493 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class MetasploitModule < Msf::Exploit::Remote
      Rank = GoodRanking
    
      include Msf::Post::File
      include Msf::Exploit::Remote::HttpServer::HTML
    Severity: Minor
    Found in modules/exploits/apple_ios/browser/safari_jit.rb - About 7 hrs to fix

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

        def exploit
          # lots of this file's format is based on pkexec.rb
      
          # direct copy of code from exploit-db
          main = %q{
      Severity: Major
      Found in modules/exploits/unix/local/netbsd_mail_local.rb - About 7 hrs to fix

        Method cmd_reg has 195 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def cmd_reg(*args)
            # Extract the command, if any
            cmd = args.shift
        
            if (args.length == 0)
        Severity: Major
        Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb - About 7 hrs to fix

          Method init has 194 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

             @SuppressWarnings("unchecked")
             public void init()
               {
              try
                {
          Severity: Major
          Found in external/source/exploits/cve-2010-4452/AppletX.java - About 7 hrs to fix

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

              def exploit
                print_status('Trying to detect if target is running a supported version of piwik')
                res = send_request_cgi({
                  'method' => 'GET',
                  'uri' => normalized_index
            Severity: Major
            Found in modules/exploits/unix/webapp/piwik_superuser_plugin_upload.rb - About 7 hrs to fix

              Method exploit has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def exploit
                  print_status('Trying to detect if target is running a supported version of piwik')
                  res = send_request_cgi({
                    'method' => 'GET',
                    'uri' => normalized_index
              Severity: Minor
              Found in modules/exploits/unix/webapp/piwik_superuser_plugin_upload.rb - About 7 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 decrypt_trigger_decrypt has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def decrypt_trigger_decrypt(org_file, new_file, temp_file)
                  [org_file, new_file, temp_file].each do |f|
                    f.insert(0, @paths['ff'])
                  end
              
              
              Severity: Minor
              Found in modules/post/multi/gather/firefox_creds.rb - About 7 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 start_element has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def start_element(name, attrs)
                  @state[:current_tag][name] = true
                  case name
                  when "description", "information"
                    return unless in_tag("detaillist")
              Severity: Minor
              Found in lib/rex/parser/outpost24_document.rb - About 7 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 cmd_db_import has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd_db_import(*args)
                  return unless active?
                  openvas_cert = false
                  openvas_dfn = false
                ::ApplicationRecord.connection_pool.with_connection {
              Severity: Minor
              Found in lib/msf/ui/console/command_dispatcher/db.rb - About 7 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 opts_to_services has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                def opts_to_services(hosts,opts)
                ::ApplicationRecord.connection_pool.with_connection {
                  wspace = find_workspace(opts[:workspace])
                  services = []
                  if opts[:host] or opts[:address] or opts[:addresses]
              Severity: Minor
              Found in lib/msf/core/rpc/v10/rpc_db.rb - About 7 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 each_unfiltered_username_first has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
              Open

                  def each_unfiltered_username_first
                    if pass_file.present?
                      pass_fd = File.open(pass_file, 'r:binary')
                    end
              
              
              Severity: Minor
              Found in lib/metasploit/framework/credential_collection.rb - About 7 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 manage_engine_dc_pmp_sqli.rb has 489 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File filezilla_server.rb has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'rexml/document'
                
                class MetasploitModule < Msf::Post
                  include Msf::Post::File
                
                
                Severity: Minor
                Found in modules/post/windows/gather/credentials/filezilla_server.rb - About 7 hrs to fix

                  File shares.rb has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'pathname'
                  require 'rex/post/file'
                  require 'filesize'
                  
                  module Rex
                  Severity: Minor
                  Found in lib/rex/post/smb/ui/console/command_dispatcher/shares.rb - About 7 hrs to fix

                    Method parse_server has 192 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def parse_server(data)
                        creds = []
                        perms = []
                        groups = []
                        settings = {}
                    Severity: Major
                    Found in modules/post/windows/gather/credentials/filezilla_server.rb - About 7 hrs to fix

                      Method build_t3_request_object has 191 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def build_t3_request_object
                          # T3 request serialized data
                          # retrieved by watching network traffic
                          # This is a proprietary, undocumented protocol
                          # TODO: WHAT DOES THIS DO?  CAN WE RANDOMIZE ANY OF IT?
                      Severity: Major
                      Found in modules/exploits/multi/misc/weblogic_deserialize_marshalledobject.rb - About 7 hrs to fix

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

                          def exploit
                            # Hijacking Administrator session by exploiting objection injection vuln that end up with sqli
                            print_status("Hijacking administrator session")
                        
                            sql = "SELECT id FROM sessions LIMIT 1"
                        Severity: Major
                        Found in modules/exploits/linux/http/alienvault_exec.rb - About 7 hrs to fix

                          Method listeners_start has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def listeners_start(args)
                                  config = parse_start_args(args)
                                  if config[:show_help]
                                    help('start')
                                    return
                          Severity: Minor
                          Found in plugins/capture.rb - About 7 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