hackedteam/rcs-common

View on GitHub

Showing 60 of 90 total issues

Method decode_content has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

  def decode_content(common_info, chunks)
    stream = StringIO.new chunks.join

    until stream.eof?
      info =  Hash[common_info]
Severity: Minor
Found in lib/rcs-common/evidence/calendar.rb - About 5 hrs 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

Class Client has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Client
      include RCS::Tracer
      include TmpDir
      extend Resolver

Severity: Minor
Found in lib/rcs-common/updater/client.rb - About 4 hrs to fix

    Method resolve_addresses has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

            def resolve_addresses(_raise = false)
              return if @addresses_resolved
    
              %i[remote_ip local_ip].each do |name|
                next unless @attributes[name]
    Severity: Minor
    Found in lib/rcs-common/winfirewall.rb - About 4 hrs 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 process_http_request has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

          def process_http_request
            EM.defer do
              begin
                trace(:info, "[#{@http[:host]}] REQ #{@http_protocol} #{@http_request_method} #{@http_content.size} bytes from #{remote_addr}")
    
    
    Severity: Minor
    Found in lib/rcs-common/updater/server.rb - About 3 hrs 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 decode_content has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def decode_content(common_info, chunks)
          stream = StringIO.new chunks.join
    
          # ABLogStruct
          magic_ver = read_uint32 stream
    Severity: Minor
    Found in lib/rcs-common/evidence/addressbook.rb - About 3 hrs 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 serializer.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'stringio'
    require_relative 'trace'
    require_relative 'evidence/common'
    
    require 'rcs-common/trace'
    Severity: Minor
    Found in lib/rcs-common/serializer.rb - About 3 hrs to fix

      Method unserialize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def unserialize(stream)
      
            header_begin = stream.pos
      
            # discard header
      Severity: Minor
      Found in lib/rcs-common/serializer.rb - About 3 hrs 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 decode_content has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def decode_content(common_info, chunks)
          stream = StringIO.new chunks.join
      
          until stream.eof?
            tm = stream.read 36
      Severity: Minor
      Found in lib/rcs-common/evidence/chat.rb - About 3 hrs 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 client.rb has 282 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'yajl/json_gem'
      require 'net/http'
      require 'uri'
      require 'timeout'
      require 'digest/md5'
      Severity: Minor
      Found in lib/rcs-common/updater/client.rb - About 2 hrs to fix

        Method decode_content has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          def decode_content(common_info, chunks)
            stream = StringIO.new chunks.join
        
            until stream.eof?
              info = Hash[common_info]
        Severity: Minor
        Found in lib/rcs-common/evidence/password.rb - About 2 hrs 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 20 (exceeds 5 allowed). Consider refactoring.
        Open

                def read(bytes_to_read = nil)
                  data = ''
        
                  return data if @file_position >= @attributes[:length]
                  return data if bytes_to_read and bytes_to_read <= 0
        Severity: Minor
        Found in lib/rcs-common/gridfs.rb - About 2 hrs 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 decode_content has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def decode_content(common_info, chunks)
            info = Hash[common_info]
            info[:data] ||= Hash.new
            info[:data][:type] = :mail
        
        
        Severity: Minor
        Found in lib/rcs-common/evidence/mail.rb - About 2 hrs 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 decode_content has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def decode_content(common_info, chunks)
            stream = StringIO.new chunks.join
        
            until stream.eof?
              info = Hash[common_info]
        Severity: Minor
        Found in lib/rcs-common/evidence/application.rb - About 2 hrs 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 decode_content has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def decode_content(common_info, chunks)
            stream = StringIO.new chunks.join
        
            until stream.eof?
              info = Hash[common_info]
        Severity: Minor
        Found in lib/rcs-common/evidence/url.rb - About 2 hrs 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 resolve_dns has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def resolve_dns(dns, use_cache: false)
              if use_cache and resolved_dns_cache[dns]
                return resolved_dns_cache[dns]
              end
        
        
        Severity: Minor
        Found in lib/rcs-common/resolver.rb - About 2 hrs 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 decode_content has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def decode_content(common_info, chunks)
            
            stream = StringIO.new chunks.join
            stream.read 2 # first 2 bytes of null termination (Naga weirdness ...)
        
        
        Severity: Minor
        Found in lib/rcs-common/evidence/keylog.rb - About 2 hrs 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 decode_content has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def decode_content(common_info, chunks)
            stream = StringIO.new chunks.join
        
            until stream.eof?
              info = Hash[common_info]
        Severity: Minor
        Found in lib/rcs-common/evidence/clibpoard.rb - About 2 hrs 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 params has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

              def params
                return @@params if defined?(@@params)
                @@params = SafeOpenStruct.new
                i = 0
        
        
        Severity: Minor
        Found in lib/rcs-common/updater/dsl.rb - About 2 hrs 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 unserialize has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def unserialize(stream)
        
              header_begin = stream.pos
        
              # discard header
        Severity: Minor
        Found in lib/rcs-common/serializer.rb - About 1 hr to fix

          Method unserialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def unserialize(stream)
                header_begin = stream.pos
          
                tot_size = stream.read(4).unpack('L').shift
                version = stream.read(4).unpack('L').shift
          Severity: Minor
          Found in lib/rcs-common/serializer.rb - About 1 hr 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