rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Function main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def main(argv=None):
    if not argv:
        argv = sys.argv
    if len(argv) == 1:
        usage()
Severity: Minor
Found in external/source/shellcode/windows/x86/src/hash.py - 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

                    for name in files:
                        build(name[:-4])
                for root, dirs, files in os.walk('./src/single/'):
Severity: Major
Found in external/source/shellcode/windows/x86/build.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    for (var x=0; x < procs.length; x++) {
                        if (nprocs[i] == procs[x]) {
                            found = true;
                            break;
                        }
    Severity: Major
    Found in external/source/DLLHijackAuditKit/analyze.js - About 45 mins to fix

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, remoteName, username='', password='', domain='', outputFile=None, execMethod='smbexec'):
      Severity: Minor
      Found in modules/auxiliary/scanner/smb/impacket/secretsdump.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            for name in files:
                                build(name[:-4])
                    else:
        Severity: Major
        Found in external/source/shellcode/windows/x86/build.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if name[-4:] == '.asm':
                                  build(name[:-4])
                      for root, dirs, files in os.walk('./src/stager/'):
          Severity: Major
          Found in external/source/shellcode/windows/x64/build.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                for name in files:
                                    build(name[:-4])
                            for root, dirs, files in os.walk('./src/migrate/'):
            Severity: Major
            Found in external/source/shellcode/windows/x86/build.py - About 45 mins to fix

              Function outputTGS has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def outputTGS(self, tgs, oldSessionKey, sessionKey, username, spn, fd=None):
              Severity: Minor
              Found in modules/auxiliary/gather/get_user_spns.py - About 45 mins to fix

                Function oracle has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def oracle(target, pms, cke_2nd_prefix, cipher_handshake=ch_def, messageflow=False, timeout=5):
                Severity: Minor
                Found in modules/auxiliary/scanner/ssl/bleichenbacher_oracle.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      for name in files:
                                          build(name[:-4])
                                  for root, dirs, files in os.walk('./src/kernel/'):
                  Severity: Major
                  Found in external/source/shellcode/windows/x86/build.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if (found) continue;
                    Severity: Major
                    Found in external/source/DLLHijackAuditKit/analyze.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          for name in files:
                                              build(name[:-4])
                                      for root, dirs, files in os.walk('./src/stager/'):
                      Severity: Major
                      Found in external/source/shellcode/windows/x86/build.py - About 45 mins to fix

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

                              def start
                                driver.print_status("Beholder is logging to #{config[:base]}")
                                bool_options = %i[screenshot webcam keystrokes automigrate]
                                bool_options.each do |o|
                                  config[o] = !(config[o].to_s =~ /^[yt1]/i).nil?
                        Severity: Minor
                        Found in plugins/beholder.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

                        Function run_until_success has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def run_until_success(argv, env):
                            cargv = (c_char_p * len(argv))(*argv)
                            cenvp = (c_char_p * len(env))(*env)
                        
                            r, w = os.pipe()
                        Severity: Minor
                        Found in data/exploits/CVE-2021-3156/userspec_generic.py - 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

                                                if not data:
                                                    break
                                                output_file.write(data)
                        Severity: Major
                        Found in data/exploits/vmware_view_planner_4_6_uploadlog_rce/log_upload_wsgi.py - About 45 mins to fix

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

                                def cmd_captureg(*args)
                                  # short circuit the whole deal if they need help
                                  return help if args.empty?
                                  return help if args.length == 1 && args.first =~ HELP_REGEX
                                  return help(args.last) if args.length == 2 && args.first =~ HELP_REGEX
                          Severity: Minor
                          Found in plugins/capture.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 tab_complete_aliases_and_commands has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def tab_complete_aliases_and_commands
                                  items = []
                                  # gather all the current commands the driver's dispatcher's have
                                  driver.dispatcher_stack.each do |dispatcher|
                                    next unless dispatcher.respond_to?(:commands)
                          Severity: Minor
                          Found in plugins/alias.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_openvas_task_delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def cmd_openvas_task_delete(*args)
                                  return unless openvas?
                          
                                  if args?(args, 2)
                          
                          
                          Severity: Minor
                          Found in plugins/openvas.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_nessus_db_scan_workspace has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def cmd_nessus_db_scan_workspace(*args)
                                  if args[0] == '-h'
                                    print_status('nessus_db_scan_workspace <policy ID> <scan name> <scan description> <workspace>')
                                    print_status('Creates a scan based on all the hosts listed in db_hosts for a given workspace.')
                                    print_status('Use nessus_policy_list to list all available policies with their corresponding policy IDs')
                          Severity: Minor
                          Found in plugins/nessus.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_aggregator_cable_add has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def cmd_aggregator_cable_add(*args)
                                  host, port, certificate = nil
                                  case args.length
                                  when 1
                                    host, port = args[0].split(':', 2)
                          Severity: Minor
                          Found in plugins/aggregator.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