rapid7/metasploit-framework

View on GitHub

Showing 15,888 of 21,960 total issues

Method a2s_info_decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def a2s_info_decode(response)
    # abort if it is impossibly short
    return nil if response.length < 19
    message_type, body = decode_message(response)
    # abort if it isn't a valid Steam response
Severity: Minor
Found in lib/rex/proto/steam/message.rb - About 25 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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def call(method_name, *data, timeout: @timeout)
    tx_header = ThriftHeader.new(method_name: method_name, message_type: ThriftMessageType::CALL)
    tx_data = data.map do |part|
      case part
      when BinData::Struct
Severity: Minor
Found in lib/rex/proto/thrift/client.rb - About 25 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 send_udp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def send_udp(packet, packet_data, nameservers)
        socket = UDPSocket.new
        socket.bind(@config[:source_address].to_s,@config[:source_port])

        ans = nil
Severity: Minor
Found in lib/net/dns/resolver.rb - About 25 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 wait_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def wait_for(*stypes)
    begin
      ::Timeout.timeout( Constants::IAX_DEFAULT_TIMEOUT ) do
        while (res = self.queue.pop )
          if stypes.include?(res[1])
Severity: Minor
Found in lib/rex/proto/iax2/call.rb - About 25 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 synced_update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def synced_update(&block)
    @lock.synchronize do
      ::FileUtils.mkdir_p(::File.dirname(path))
      ::File.open(path, ::File::RDWR|::File::CREAT) do |fd|
        fd.flock(::File::LOCK_EX)
Severity: Minor
Found in lib/rex/json_hash_file.rb - About 25 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 map_compile_arch_to_architecture has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def map_compile_arch_to_architecture(server_info)
          return '' if server_info.blank?

          arch_data = server_info.downcase.encode(::Encoding::BINARY)

Severity: Minor
Found in lib/rex/proto/mssql/client.rb - About 25 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 data_connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def data_connect(mode = nil, nsock = self.sock)
          if mode
            res = send_cmd([ 'TYPE', mode ], true, nsock)
            return nil if not res =~ /^200/
          end
Severity: Minor
Found in lib/rex/proto/ftp/client.rb - About 25 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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def start
      begin
        # create the servers main socket (ignore the context here because we don't want a remote bind)
        @server = Rex::Socket::TcpServer.create(
          'LocalHost' => @opts['ServerHost'],
Severity: Minor
Found in lib/rex/proto/proxy/socks4a.rb - About 25 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 request_userlogin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def request_userlogin(opts={})
    opts = self.config.merge(opts)
    opts['headers'] ||= {}
    opts['method'] = 'USERLOGIN'

Severity: Minor
Found in lib/rex/proto/nuuo/client.rb - About 25 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 send_read_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def send_read_request(&block)
    self.status = nil
    self.complete = false
    if block_given?
      start_server_socket {|msg| yield msg}
Severity: Minor
Found in lib/rex/proto/tftp/client.rb - About 25 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 string_to_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def string_to_key(password, salt, params: nil)
            raise Rex::Proto::Kerberos::Model::Error::KerberosError, 'Params not supported for DES' unless params == nil
            reverse_this_block = false
            tempstring = [0,0,0,0,0,0,0,0]

Severity: Minor
Found in lib/rex/proto/kerberos/crypto/des_cbc_md5.rb - About 25 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_header has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_header(key, name)
    unless opts['headers'] && opts['headers'].keys.map(&:downcase).include?(name.downcase)
      return opts[key] ? set_formatted_header(name, opts[key]) : ''
    end
    ''
Severity: Minor
Found in lib/rex/proto/nuuo/client_request.rb - About 25 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 get_headers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_headers(head)
    head.each_line.with_index do |l, i|
      if i == 0
        self.protocol,self.status_code,self.message = l.split(' ', 3)
        self.status_code = self.status_code.to_i if self.status_code
Severity: Minor
Found in lib/rex/proto/nuuo/response.rb - About 25 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 stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def stop
      if @running
        # signal we are no longer running
        @running = false
        # stop any clients we have (create a new client array as client.stop will delete from @clients)
Severity: Minor
Found in lib/rex/proto/proxy/socks5/server.rb - About 25 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 gss_wrap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def gss_wrap(plaintext, key, sequence_number, is_initiator, opts={})
            dce_style = opts.fetch(:dce_style) { false }
            pad_style = opts.fetch(:rc4_pad_style) { :single_byte }
            # Always 32-bit sequence number
            sequence_number &= 0xFFFFFFFF
Severity: Minor
Found in lib/rex/proto/kerberos/crypto/rc4_hmac.rb - About 25 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 read has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def read(str="")
    self[:payload].clear
    raise DRDA::Error, "Input isn't a String." if !str.kind_of? String
    raise DRDA::RespError, "Response is too short." if str.size < 10
    (self[:length],self[:magic],self[:format],
Severity: Minor
Found in lib/rex/proto/drda/packet.rb - About 25 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 present_cred has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def present_cred(cred, key: nil)
      output = []
      output << "Server: #{cred.server}"
      output << "Client: #{cred.client}"
      output << "Ticket etype: #{cred.keyblock.enctype} (#{Rex::Proto::Kerberos::Crypto::Encryption.const_name(cred.keyblock.enctype)})"
Severity: Minor
Found in lib/rex/proto/kerberos/credential_cache/krb5_ccache_presenter.rb - About 25 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 get_wsframe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_wsframe(_opts = {})
      frame = Frame.new
      frame.header.read(self)
      payload_data = ''
      while payload_data.length < frame.payload_len
Severity: Minor
Found in lib/rex/proto/http/web_socket.rb - About 25 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 send_write_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def send_write_request(&block)
    self.status = nil
    self.complete = false
    if block_given?
      start_server_socket {|msg| yield msg}
Severity: Minor
Found in lib/rex/proto/tftp/client.rb - About 25 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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def start
      begin
        # create the servers main socket (ignore the context here because we don't want a remote bind)
        @server = Rex::Socket::TcpServer.create(
          'LocalHost' => @opts['ServerHost'],
Severity: Minor
Found in lib/rex/proto/proxy/socks5/server.rb - About 25 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