rapid7/metasploit-framework

View on GitHub

Showing 13,811 of 19,502 total issues

Method download has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
Open

  def Dir.download(dst, src, opts = {}, force = true, glob = nil, &stat)
    src.force_encoding('UTF-8')
    dst.force_encoding('UTF-8')
    tries_cnt = 0

Severity: Minor
Found in lib/rex/post/meterpreter/extensions/stdapi/fs/dir.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 readable_text.rb has 690 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Msf
module Serializer

# This class formats information in a plain-text format that
# is meant to be displayed on a console or some other non-GUI
Severity: Major
Found in lib/msf/base/serializer/readable_text.rb - About 1 day to fix

    Method build_payload_obj has 312 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def build_payload_obj(payload_data)
        payload_obj = 'aced' # STREAM_MAGIC
        payload_obj << '0005' # STREAM_VERSION
        payload_obj << '7372' # TC_OBJECT, TC_CLASSDESC
        payload_obj << '002e' # Class name length: 46
    Severity: Major
    Found in modules/exploits/multi/misc/weblogic_deserialize_badattrval.rb - About 1 day to fix

      Method super_redacted_deobfuscation has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
      Open

        def super_redacted_deobfuscation(ciphertext)
          input = ciphertext
          input = input.gsub("Z", "000")
      
          base = '0'.upto('9').to_a + 'a'.upto('z').to_a + 'A'.upto('G').to_a
      Severity: Minor
      Found in modules/auxiliary/admin/http/webnms_cred_disclosure.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 check_results has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_results(passwords, results, hash_type, hashes, method)
            passwords.each do |password_line|
              password_line.chomp!
              next if password_line.blank?
              fields = password_line.split(":")
      Severity: Minor
      Found in modules/auxiliary/analyze/crack_windows.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_reg has a Cognitive Complexity of 78 (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 rbmysql.rb has 682 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class RbMysql
      
        require "rbmysql/constants"
        require "rbmysql/error"
        require "rbmysql/charset"
      Severity: Major
      Found in lib/rbmysql.rb - About 1 day to fix

        File msftidy.rb has 680 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'fileutils'
        require 'find'
        require 'time'
        require 'rubocop'
        require 'open3'
        Severity: Major
        Found in tools/dev/msftidy.rb - About 1 day to fix

          Method run_host has 307 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def run_host(ip)
              begin
          
              res = send_request_raw({
                'uri'     => '/oradb/PUBLIC/GLOBAL_NAME',
          Severity: Major
          Found in modules/auxiliary/scanner/oracle/xdb_sid_brute.rb - About 1 day to fix

            Class Core has 81 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Core
            
              include Msf::Ui::Console::CommandDispatcher
              include Msf::Ui::Console::CommandDispatcher::Common
              include Msf::Ui::Console::ModuleOptionTabCompletion
            Severity: Major
            Found in lib/msf/ui/console/command_dispatcher/core.rb - About 1 day to fix

              File teamcity_agent_xmlrpc_exec.rb has 673 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class MetasploitModule < Msf::Exploit::Remote
                Rank = ExcellentRanking
              
                include Msf::Exploit::Remote::HttpClient
                include Msf::Exploit::CmdStager
              Severity: Major
              Found in modules/exploits/multi/misc/teamcity_agent_xmlrpc_exec.rb - About 1 day to fix

                File windows_error.rb has 673 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Msf
                
                class WindowsError
                
                  #
                Severity: Major
                Found in lib/msf/windows_error.rb - About 1 day to fix

                  Method on_request_uri has 303 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def on_request_uri(cli, request)
                      if request.uri =~ %r{/screenshot$}
                        data = ''
                        if supports_espia?(session)
                          data = session.espia.espia_image_get_dev_screen
                  Severity: Major
                  Found in modules/post/multi/manage/screenshare.rb - About 1 day to fix

                    File file.rb has 660 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

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

                        def exploit
                          # Display start time
                          time1 = Time.new
                          print_status("-------------------------------------------------")
                          print_status("Start time : #{time1.inspect}")
                      Severity: Minor
                      Found in modules/exploits/windows/mssql/mssql_linkcrawler.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 extract_lnk_info has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def extract_lnk_info(path)
                        @client.fs.dir.foreach(path) do |file_name|
                          if file_name =~ /\.lnk$/   # We have a .lnk file
                            record = nil
                            offset = 0 # ToDo: Look at moving this to smaller scope
                      Severity: Minor
                      Found in scripts/meterpreter/dumplinks.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 check_lines has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def check_lines
                          url_ok     = true
                          no_stdio   = true
                          in_comment = false
                          in_literal = false
                      Severity: Minor
                      Found in tools/dev/msftidy.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 openssl_heartbleed.rb has 649 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        File glassfish_deployer.rb has 647 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'nokogiri'
                        require 'metasploit/framework/login_scanner/glassfish'
                        require 'metasploit/framework/credential_collection'
                        
                        class MetasploitModule < Msf::Exploit::Remote
                        Severity: Major
                        Found in modules/exploits/multi/http/glassfish_deployer.rb - About 1 day to fix

                          Class Core has 77 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Console::CommandDispatcher::Core
                          
                            include Console::CommandDispatcher
                          
                            #
                          Severity: Major
                          Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language