rapid7/metasploit-framework

View on GitHub

Showing 21,886 of 21,886 total issues

File vcenter_secrets_dump.rb has 798 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'metasploit/framework/credential_collection'

class MetasploitModule < Msf::Post
  include Msf::Post::Common
  include Msf::Post::File
Severity: Major
Found in modules/post/linux/gather/vcenter_secrets_dump.rb - About 1 day to fix

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

      def run
        fail_with(Failure::NoAccess, 'Session isnt running as root') unless is_root?
        case datastore['UseraddMethod']
        when 'CUSTOM'
          fail_with(Failure::NotFound, "Cannot find command on path given: #{datastore['UseraddBinary']}") unless check_command_exists?(datastore['UseraddBinary'])
    Severity: Minor
    Found in modules/post/linux/manage/adduser.rb - About 1 day 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 base.rb has 789 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Msf::Exploit::Remote::Kerberos::ServiceAuthenticator::Base
      extend Forwardable
      include Msf::Exploit::Remote::Kerberos::Client
      include Msf::Auxiliary::Report
      include Rex::Proto::Gss::Asn1
    Severity: Major
    Found in lib/msf/core/exploit/remote/kerberos/service_authenticator/base.rb - About 1 day to fix

      Method run_host has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
      Open

        def run_host(ip)
          begin
      
          res = send_request_raw({
            'uri'     => '/oradb/PUBLIC/GLOBAL_NAME',
      Severity: Minor
      Found in modules/auxiliary/scanner/oracle/xdb_sid_brute.rb - About 1 day 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 exploit.rb has 785 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Msf
      
      
      
      ###
      Severity: Major
      Found in lib/msf/core/exploit.rb - About 1 day to fix

        Method run_host has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
        Open

          def run_host(target_host)
            conn = true
            ecode = nil
            emesg = nil
        
        
        Severity: Minor
        Found in modules/auxiliary/scanner/http/svn_scanner.rb - About 1 day 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_sessions has 361 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def cmd_sessions(*args)
            begin
            method   = nil
            quiet    = false
            show_active = false
        Severity: Major
        Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 day to fix

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

            def run
              cracker = new_password_cracker(action.name)
          
              lookups = []
          
          
          Severity: Minor
          Found in modules/auxiliary/analyze/apply_pot.rb - About 1 day 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 89 (exceeds 5 allowed). Consider refactoring.
          Open

            def run_host(ip)
          
              path = datastore['PATH']
              check1 = [
                'iNotes/Forms5.nsf',
          Severity: Minor
          Found in modules/auxiliary/scanner/lotus/lotus_domino_version.rb - About 1 day 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_services has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
          Open

            def cmd_services(*args)
              return unless active?
              mode = :search
              onlyup = false
              output_file = nil
          Severity: Minor
          Found in lib/msf/ui/console/command_dispatcher/db.rb - About 1 day 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 browser_autopwn.rb has 756 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'rex/exploitation/js/detect'
          require 'rex/exploitation/jsobfu'
          
          class MetasploitModule < Msf::Auxiliary
            include Msf::Exploit::Remote::HttpServer::HTML
          Severity: Major
          Found in modules/auxiliary/server/browser_autopwn.rb - About 1 day to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            package msf.x;
            
            import java.io.BufferedReader;
            import java.io.BufferedWriter;
            import java.io.File;
            Severity: Major
            Found in external/source/exploits/CVE-2012-0507/msf/x/PayloadX.java and 1 other location - About 1 day to fix
            external/source/exploits/CVE-2012-1723/src/msf/x/PayloadX.java on lines 1..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 858.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            package msf.x;
            
            import java.io.BufferedReader;
            import java.io.BufferedWriter;
            import java.io.File;
            external/source/exploits/CVE-2012-0507/msf/x/PayloadX.java on lines 1..195

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 858.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            File file.rb has 755 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'rex/post/meterpreter/extensions/stdapi/command_ids'
            require 'rex/post/file_stat'
            
            module Msf::Post::File
              include Msf::Post::Common
            Severity: Major
            Found in lib/msf/core/post/file.rb - About 1 day to fix

              File snmp_enum.rb has 749 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MetasploitModule < Msf::Auxiliary
                include Msf::Exploit::Remote::SNMPClient
                include Msf::Auxiliary::Report
                include Msf::Auxiliary::Scanner
              
              
              Severity: Major
              Found in modules/auxiliary/scanner/snmp/snmp_enum.rb - About 1 day to fix

                Method cmd_reg has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
                Open

                  def cmd_reg(*args)
                    # Extract the command, if any
                    cmd = args.shift
                
                    if (args.length == 0)
                Severity: Minor
                Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb - About 1 day 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 mssql_enum.rb has 734 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class MetasploitModule < Msf::Auxiliary
                  include Msf::Exploit::Remote::MSSQL
                  include Msf::Auxiliary::Report
                  include Msf::OptionalSession::MSSQL
                
                
                Severity: Major
                Found in modules/auxiliary/admin/mssql/mssql_enum.rb - About 1 day to fix

                  Method sql_statement has 340 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def sql_statement()
                  
                      # DEFINED HEADER TEXT
                      headings = [
                        ["Server","Database", "Schema", "Table", "Column", "Data Type", "Sample Data","Row Count"]
                  Severity: Major
                  Found in modules/auxiliary/admin/mssql/mssql_findandsampledata.rb - About 1 day to fix

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

                      def run
                        return if not check_dependencies
                    
                        begin
                          # Get all values from v$parameter
                    Severity: Minor
                    Found in modules/auxiliary/admin/oracle/oraenum.rb - About 1 day 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_portfwd has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def cmd_portfwd(*args)
                        args.unshift('list') if args.empty?
                    
                        # For clarity's sake.
                        lport = nil
                    Severity: Minor
                    Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb - About 1 day 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