rapid7/metasploit-framework

View on GitHub

Showing 22,177 of 22,177 total issues

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

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

    def simple_name_lookup(upstream_resolver, packet, type, cls, &block)
      return nil unless cls == Dnsruby::Classes::IN

      # todo: make sure this will work if the packet has multiple questions, figure out how that's handled
      name = packet.question.first.qname.to_s
Severity: Minor
Found in lib/rex/proto/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 recv_frame has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def recv_frame
    remaining = @timeout
    header_raw, elapsed_time = Rex::Stopwatch.elapsed_time do
      num_bytes = Version091::Frames::AmqpVersion091FrameHeader.new.num_bytes
      @conn.get_once(num_bytes, remaining)
Severity: Minor
Found in lib/rex/proto/amqp/version_0_9_1/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 smb_send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def smb_send(data, evasion_level=0)
    # evasion_level is ignored, since real evasion happens
    # in the actual socket layer

    size = 0
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 trans_nonull has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def trans_nonull(pipe, param = '', body = '', setup_count = 0, setup_data = '', no_response = false, do_recv = true)

    pkt = CONST::SMB_TRANS_PKT.make_struct
    self.smb_defaults(pkt['Payload']['SMB'])

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 read_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.read_response(socket, timeout=self.options['read_timeout'])

    data = socket.get_once(-1, timeout)

    # We need at least 10 bytes to find the FragLen
Severity: Minor
Found in lib/rex/proto/dcerpc/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 startservice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def startservice(svc_handle, args=[])
    svc_status = nil

    if args.empty?
      stubdata = svc_handle + NDR.long(0) + NDR.long(0)
Severity: Minor
Found in lib/rex/proto/dcerpc/svcctl/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 tab_complete_generic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def tab_complete_generic(fmt, str, words)
      last_word = words[-1]
      fmt = fmt.select { |key, value| last_word == key || !words.include?(key) }

      val = fmt[last_word]
Severity: Minor
Found in lib/rex/ui/text/dispatcher_shell.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 tab_complete_directory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def tab_complete_directory(str, words)
      directory = str[-1] == File::SEPARATOR ? str : File.dirname(str)
      filename = str[-1] == File::SEPARATOR ? '' : File.basename(str)
      entries = Dir.entries(directory).select { |fp| fp.start_with?(filename) }
      dirs = entries - ['.', '..']
Severity: Minor
Found in lib/rex/ui/text/dispatcher_shell.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 collect_bulletin_title has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_bulletin_title
      return unless @state[:check_state]["ID"] == 500.to_s
      return unless in_tag("UpdateData")
      return unless @state[:update]
      return if @text.to_s.strip.empty?
Severity: Minor
Found in lib/rex/parser/mbsa_document.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 collect_reference has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_reference
      return unless in_tag("references")
      return unless in_tag("vulnerability")
      return unless @state[:vuln]
      @state[:ref][:value] = @text.to_s.strip
Severity: Minor
Found in lib/rex/parser/nexpose_raw_document.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 sec_to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.sec_to_s(seconds)
      return "0 secs" if seconds.to_i <= 0
      [[31536000, 'year'], [86400, 'day'], [3600, 'hour'], [60, 'min'], [1, 'sec']].map! { |count, name|
        if (c = seconds / count) > 0
          c = c.truncate
Severity: Minor
Found in lib/rex/ext_time.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 collect_page_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_page_response
      return unless in_tag("TechnicalDetails")
      return unless in_tag("ReportItem")
      return unless @text
      return if @text.to_s.empty?
Severity: Minor
Found in lib/rex/parser/acunetix_document.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