rapid7/metasploit-framework

View on GitHub

Showing 16,065 of 22,177 total issues

Method source_address= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def source_address=(addr)
        unless addr.respond_to? :to_s
          raise ResolverArgumentError, "Wrong address argument #{addr}"
        end

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

        def query(sqla, doprint=false, opts={})
          info = { :sql => sqla }
          opts[:timeout] ||= 15
          pkts = []
          idx  = 0
Severity: Minor
Found in lib/rex/proto/mssql/client.rb - About 35 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 make_weak_sessionkey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.make_weak_sessionkey(session_key,key_size,lanman_key = false)
    case key_size
    when 40
      if lanman_key
        return session_key[0,5] + "\xe5\x38\xb0"
Severity: Minor
Found in lib/rex/proto/ntlm/crypt.rb - About 35 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 on_client_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def on_client_data(cli)
          data = cli.read(65535)
          raise ::EOFError if !data
          raise ::EOFError if data.empty?

Severity: Minor
Found in lib/rex/proto/ldap/server.rb - About 35 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 matching_call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def matching_call(pkt)
    src_call = pkt[0,2].unpack('n')[0]
    dst_call = nil

    if (src_call & 0x8000 != 0)
Severity: Minor
Found in lib/rex/proto/iax2/client.rb - About 35 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 handle_type3_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def handle_type3_message(message, auth_info = {})
          arg = {
            domain: message.domain,
            user: message.user,
            host: message.workstation
Severity: Minor
Found in lib/rex/proto/ldap/auth.rb - About 35 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 mssql_parse_reply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def mssql_parse_reply(data, info)
    info[:errors] = []
    return if not data
    states = []
    until data.empty? || info[:errors].any?
Severity: Minor
Found in lib/rex/proto/mssql/client_mixin.rb - About 35 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 blockify_file_or_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def blockify_file_or_data
    if self.local_file =~ /^DATA:(.*)/m
      data = $1
    elsif ::File.file?(self.local_file) and ::File.readable?(self.local_file)
      data = ::File.open(self.local_file, "rb") {|f| f.read f.stat.size} rescue []
Severity: Minor
Found in lib/rex/proto/tftp/client.rb - About 35 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 param_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def param_string
    params=[]
    self.uri_parts['QueryString'].each_pair { |param, value|
      # inject a random number of params in between each param
      if self.junk_params
Severity: Minor
Found in lib/rex/proto/http/request.rb - About 35 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_recv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def _send_recv(req, t = -1, persist = false)
    @pipeline = persist
    subscriber.on_request(req)
    if req.respond_to?(:opts) && req.opts['ntlm_transform_request'] && self.ntlm_client
      req = req.opts['ntlm_transform_request'].call(self.ntlm_client, req)
Severity: Minor
Found in lib/rex/proto/http/client.rb - About 35 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 connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def connect(t = -1)
    # If we already have a connection and we aren't pipelining, close it.
    if (self.conn)
      if !pipelining?
        close
Severity: Minor
Found in lib/rex/proto/http/client.rb - About 35 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 parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def parse(buf)
    self.bufq << buf

    if self.state == ParseState::ProcessingHeader
      parse_header
Severity: Minor
Found in lib/rex/proto/nuuo/response.rb - About 35 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 decrypt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def decrypt(ciphertext, key, msg_type)
            raise Rex::Proto::Kerberos::Model::Error::KerberosError, 'Ciphertext too short' unless ciphertext && ciphertext.length > BLOCK_SIZE + HASH_LENGTH
            raise Rex::Proto::Kerberos::Model::Error::KerberosError, 'Ciphertext is not a multiple of block length' unless ciphertext.length % BLOCK_SIZE == 0


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

    def handle_authentication_creds(request)
      unless request.supported_methods.include? AUTH_CREDS
        raise "Invalid SOCKS5 request packet received (no supported authentication methods)."
      end
      response = AuthResponsePacket.new
Severity: Minor
Found in lib/rex/proto/proxy/socks5/server_client.rb - About 35 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 on_request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def on_request(cli, req)
    begin
      procedure.call(cli, req)
    rescue Errno::EPIPE, ::Errno::ECONNRESET, ::Errno::ENOTCONN, ::Errno::ECONNABORTED => e
      elog('Proc::on_request: Client closed connection prematurely', LogSource, error: e)
Severity: Minor
Found in lib/rex/proto/http/handler/proc.rb - About 35 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_os_to_platform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def map_compile_os_to_platform(compile_os)
          return '' if compile_os.blank?

          compile_os = compile_os.downcase.encode(::Encoding::BINARY)

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

  def self.generate_response(request, answer = nil, authority = nil, additional = nil)
    packet = self.encode_drb(request)
    packet.answer = answer if answer
    packet.authority = authority if authority
    packet.additional = additional if additional
Severity: Minor
Found in lib/rex/proto/dns/packet.rb - About 35 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 smb_recv_cache_find_match has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def smb_recv_cache_find_match(expected_type)

    clean = []
    found = nil

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

    def offset_for(field)
      return 0 unless instance_variable_get("@#{field}")

      offset = buffer.rel_offset
      %i[ owner_sid group_sid sacl dacl ].each do |cursor|
Severity: Minor
Found in lib/rex/proto/ms_dtyp.rb - About 35 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 smb_recv_parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def smb_recv_parse(expected_type, ignore_errors = false)

    pkt  = nil
    data = nil

Severity: Minor
Found in lib/rex/proto/smb/client.rb - About 35 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