rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

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

  def cmd_record_mic(*args)
    path = Rex::Text.rand_text_alpha(8) + ".wav"
    play = true
    duration = 1

Severity: Minor
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/webcam.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_getsystem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def cmd_getsystem( *args )

    technique = ELEVATE_TECHNIQUE_ANY

    desc = ""
Severity: Minor
Found in lib/rex/post/meterpreter/ui/console/command_dispatcher/priv/elevate.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 expand_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def File.expand_path(path)
    case client.platform
      when 'osx', 'freebsd', 'bsd', 'linux', 'android', 'apple_ios'
        # For unix-based systems, do some of the work here
        # First check for ~
Severity: Minor
Found in lib/rex/post/meterpreter/extensions/stdapi/fs/file.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

            if buffer_size != 4
              raise "Please pass 4 for 'out' PULONG_PTR, since they require a buffer of size 4"
            end
Severity: Major
Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/library.rb - About 45 mins to fix

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

      def File.search( root=nil, glob="*.*", recurse=true, timeout=-1, modified_start_date=nil, modified_end_date=nil)
    Severity: Minor
    Found in lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb - About 45 mins to fix

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

        def Dir.download(dst, src, opts = {}, force = true, glob = nil, &stat)
      Severity: Minor
      Found in lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb - About 45 mins to fix

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

          def add_function(lib_name, function_name, return_type, params, remote_name=nil, calling_conv='stdcall')
        Severity: Minor
        Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb - About 45 mins to fix

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

            def play_file(path)
              raise "Could not read file: #{path}" unless ::File.readable?(path) && ::File.file?(path)
          
              channel = Channel.create(client, 'audio_output', Rex::Post::Meterpreter::Channels::Pools::StreamPool, CHANNEL_FLAG_SYNCHRONOUS)
          
          
          Severity: Minor
          Found in lib/rex/post/meterpreter/extensions/stdapi/audio_output/audio_output.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 check_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def check_params(params)
              params.each do |param|
                raise ArgumentError, "each param must be described by a three-tuple [type,name,direction]" unless param.length == 3
                type = param[0]
                direction = param[2]
          Severity: Minor
          Found in lib/rex/post/meterpreter/extensions/stdapi/railgun/library_function.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 set_value_direct has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def Registry.set_value_direct(root_key, base_key, name, type, data, perm = KEY_WRITE)
          Severity: Minor
          Found in lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb - About 45 mins to fix

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

              def Channel.create(client, type = nil, klass = nil,
                  flags = CHANNEL_FLAG_SYNCHRONOUS, addends = nil, **klass_kwargs)
            Severity: Minor
            Found in lib/rex/post/meterpreter/channel.rb - About 45 mins to fix

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

                  def initialize(host, port, socket, conn_timeout, read_timeout, write_timeout)
              Severity: Minor
              Found in lib/rbmysql/protocol.rb - About 45 mins to fix

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

                    def self.value2net(v)
                      case v
                      when nil
                        type = Field::TYPE_NULL
                        val = ""
                Severity: Minor
                Found in lib/rbmysql/protocol.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def initialize(client, cid, type, flags, packet, **_)
                Severity: Minor
                Found in lib/rex/post/meterpreter/channels/socket_abstraction.rb - About 45 mins to fix

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

                    def parse(buffer)
                      super do
                        @field_type = buffer.read_byte
                        break if @field_type == 0
                        @field_values = []
                  Severity: Minor
                  Found in lib/postgres/postgres-pr/message.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 log_packet_to_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def log_packet_to_file(packet, packet_type)
                      pathname = ::Pathname.new(self.tlv_log_file_path.split('file:').last)
                  
                      begin
                        if self.tlv_log_file.nil? || self.tlv_log_file.path != pathname.to_s
                  Severity: Minor
                  Found in lib/rex/post/meterpreter/packet_dispatcher.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def initialize(client, cid, type, flags, packet, **_)
                  Severity: Minor
                  Found in lib/rex/post/meterpreter/channels/pools/file.rb - About 45 mins to fix

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

                      def initialize(client, cid, type, flags, packet, **_)
                    Severity: Minor
                    Found in lib/rex/post/meterpreter/channels/pools/stream_pool.rb - About 45 mins to fix

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

                        def query(sql)
                          write_message(Query.new(sql))
                      
                          result = Result.new
                          errors = []
                      Severity: Minor
                      Found in lib/postgres/postgres-pr/connection.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def initialize(client, cid, type, flags, packet, **_)
                      Severity: Minor
                      Found in lib/rex/post/meterpreter/channels/pool.rb - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language