rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

      def cmd_besecure_report_list(*_args)
        tbl = Rex::Text::Table.new(
          'Columns' => ['ID', 'Name', 'Hosts']
        )

Severity: Minor
Found in plugins/besecure.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 rpc_db_nodes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def rpc_db_nodes(host, port, user, pass, name)
        rpc_reconnect_nodes

        if active_rpc_nodes == 0
          print_error('No active nodes at this time')
Severity: Minor
Found in plugins/wmap.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

Avoid deeply nested control flow statements.
Open

            elsif args[0] == '-a'
              if scan['status'] == 'canceled'
                tbl << [ scan['id'], scan['name'], scan['owner'], scan['starttime'], scan['status'], scan['folder_id'] ]
              end
            else
Severity: Major
Found in plugins/nessus.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            rescue ::Exception
                              print_status(" >> Exception during launch from #{xref[0]}: #{$ERROR_INFO}")
    Severity: Major
    Found in plugins/wmap.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if !modname.empty?
                            eprofile << modname
                          end
      Severity: Major
      Found in plugins/wmap.rb - About 45 mins to fix

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

              def cmd_lab_snapshot(*args)
                return lab_usage if args.count < 2
        
                snapshot = args[args.count - 1]
        
        
        Severity: Minor
        Found in plugins/lab.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 print_tree_recursive has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def print_tree_recursive(tree, max_level, indent, prefix, is_last, unicode)
        Severity: Minor
        Found in plugins/wmap.rb - About 45 mins to fix

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

                def cmd_lab_revert(*args)
                  return lab_usage if args.count < 2
          
                  snapshot = args[args.count - 1]
          
          
          Severity: Minor
          Found in plugins/lab.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 rpc_add_node has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def rpc_add_node(host, port, ssl, user, pass, bypass_exist)
          Severity: Minor
          Found in plugins/wmap.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                      if execmod
                                        rpc_round_exec(xref[0], xref[1], modopts, njobs)
                                      end
            Severity: Major
            Found in plugins/wmap.rb - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if scan['status'] == 'completed'
                              tbl << [ scan['id'], scan['name'], scan['owner'], scan['starttime'], scan['status'], scan['folder_id'] ]
                            end
              Severity: Major
              Found in plugins/nessus.rb - About 45 mins to fix

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

                def regdump(pathoflogs,filename)
                  host,port = @client.session_host, @client.session_port
                  #This variable will only contain garbage, it is to make sure that the channel is not closed while the reg is being dumped and compress
                  garbage = ''
                  hives = %w{HKCU HKLM HKCC HKCR HKU}
                Severity: Minor
                Found in scripts/meterpreter/winenum.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 cmd_on_trgt_exec has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def cmd_on_trgt_exec(session,cmdexe,opt,verbose)
                  r=''
                  session.response_timeout=120
                  if verbose == 1
                    begin
                Severity: Minor
                Found in scripts/meterpreter/uploadexec.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

                Avoid deeply nested control flow statements.
                Open

                elsif srv_create
                  priv_check
                  if srv_name and srv_command
                    begin
                      print_status("Creating Service #{srv_name}")
                Severity: Major
                Found in scripts/meterpreter/service_manager.rb - About 45 mins to fix

                  Method list_logs has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def list_logs(eventlog_name,filter,filter_string,logs,local_log,sup_print)
                  Severity: Minor
                  Found in scripts/meterpreter/event_manager.rb - About 45 mins to fix

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

                    def script_exec(session,scrptlst)
                      print_status("Running script List ...")
                      scrptlst.each_line do |scrpt|
                        next if scrpt.strip.length < 1
                        next if scrpt[0,1] == "#"
                    Severity: Minor
                    Found in scripts/meterpreter/multiscript.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 enum_users has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def enum_users(os)
                      users = []
                    
                      path4users = ""
                      sysdrv = @client.sys.config.getenv('SystemDrive')
                    Severity: Minor
                    Found in scripts/meterpreter/get_filezilla_creds.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

                    Avoid deeply nested control flow statements.
                    Open

                          dump_mem(p,name,toggle) if not query
                    Severity: Major
                    Found in scripts/meterpreter/process_memdump.rb - About 45 mins to fix

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

                      def wmicexec(session,wmiccmds= nil)
                        tmpout = ''
                        session.response_timeout=120
                        begin
                          tmp = session.sys.config.getenv('TEMP')
                      Severity: Minor
                      Found in scripts/meterpreter/wmic.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 run_host has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def run_host(ip)
                      
                          begin
                      
                            src = datastore['SRCADDR']
                      Severity: Minor
                      Found in modules/auxiliary/voip/sip_deregister.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

                      Severity
                      Category
                      Status
                      Source
                      Language