rapid7/metasploit-framework

View on GitHub

Method create_library has 3106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.create_library(constant_manager, library_path = 'kernel32')
    dll = Library.new(library_path, constant_manager)

    dll.add_function( 'GetConsoleWindow', 'LPVOID',[])

    Method create_library has 2604 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.create_library(constant_manager, library_path = 'user32')
        dll = Library.new(library_path, constant_manager)
    
        dll.add_function('ActivateKeyboardLayout', 'DWORD',[
          ["DWORD","hkl","in"],

      Method cmd_wmap_run has a Cognitive Complexity of 488 (exceeds 5 allowed). Consider refactoring.
      Open

          def cmd_wmap_run(*args)
            # Stop everything
            self.masstop = false
            self.killwhenstop  = true
      
      
      Severity: Minor
      Found in plugins/wmap.rb - About 1 wk 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 create_library has 1774 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.create_library(constant_manager, library_path = 'advapi32')
          dll = Library.new(library_path, constant_manager)
      
          dll.add_function('QueryServiceStatus', 'DWORD', [
              ['LPVOID', 'hService', 'in'],

        File def_kernel32.rb has 3118 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Rex
        module Post
        module Meterpreter
        module Extensions
        module Stdapi

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

            def run
              max_search = datastore['MAX_SEARCH']
          
              db, dbfile = create_sqlite_db
              print_status "Database created: #{dbfile}"
          Severity: Minor
          Found in modules/post/windows/gather/ad_to_sqlite.rb - About 1 wk 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 def_user32.rb has 2616 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Rex
          module Post
          module Meterpreter
          module Extensions
          module Stdapi

            File error.rb has 2530 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Msf::Post::Windows::Error
              SUCCESS = 0x0000
              INVALID_FUNCTION = 0x0001
              FILE_NOT_FOUND = 0x0002
              PATH_NOT_FOUND = 0x0003
            Severity: Major
            Found in lib/msf/core/post/windows/error.rb - About 1 wk to fix

              File g711.rb has 2166 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Rex
              module Proto
              module IAX2
              module Codecs
              class G711
              Severity: Major
              Found in lib/rex/proto/iax2/codecs/g711.rb - About 6 days to fix

                File dtc.rb has 2078 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Msf
                class Post
                module Hardware
                module Automotive
                
                
                Severity: Major
                Found in lib/msf/core/post/hardware/automotive/dtc.rb - About 5 days to fix

                  File core.rb has 1803 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'rex/ui/text/output/buffer/stdout'
                  
                  #
                  # Project
                  #
                  Severity: Major
                  Found in lib/msf/ui/console/command_dispatcher/core.rb - About 4 days to fix

                    File def_advapi32.rb has 1800 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module Rex
                    module Post
                    module Meterpreter
                    module Extensions
                    module Stdapi

                      File nessus.rb has 1788 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'nessus_rest'
                      require 'rex/parser/nessus_xml'
                      
                      module Msf
                      
                      
                      Severity: Major
                      Found in plugins/nessus.rb - About 4 days to fix

                        File wmap.rb has 1660 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'rabal/tree'
                        require 'msf/core/rpc/v10/client'
                        
                        module Msf
                        
                        
                        Severity: Major
                        Found in plugins/wmap.rb - About 4 days to fix

                          Method cmd_sessions has a Cognitive Complexity of 217 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def cmd_sessions(*args)
                              begin
                              method   = nil
                              quiet    = false
                              show_extended = false
                          Severity: Minor
                          Found in lib/msf/ui/console/command_dispatcher/core.rb - About 4 days 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 db.rb has 1577 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require 'rexml/document'
                          require 'rex/parser/nmap_xml'
                          require 'msf/core/db_export'
                          
                          module Msf
                          Severity: Major
                          Found in lib/msf/ui/console/command_dispatcher/db.rb - About 4 days to fix

                            File exe.rb has 1518 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            module Msf
                            module Util
                            #
                            # The class provides methods for creating and encoding executable file
                            # formats for various platforms. It is a replacement for the previous
                            Severity: Major
                            Found in lib/msf/util/exe.rb - About 4 days to fix

                              File client.rb has 1363 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              module Rex
                              module Proto
                              module SMB
                              class Client
                              
                              
                              Severity: Major
                              Found in lib/rex/proto/smb/client.rb - About 3 days to fix

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

                                  def run
                                    print_status("Running MS SQL Server Enumeration...")
                                
                                    if !mssql_login_datastore
                                      print_error("Login was unsuccessful. Check your credentials.")
                                Severity: Major
                                Found in modules/auxiliary/admin/mssql/mssql_enum.rb - About 3 days to fix

                                  Method run_host has 709 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/snmp_enum.rb - About 3 days to fix
                                    Severity
                                    Category
                                    Status