hackedteam/rcs-common

View on GitHub

Showing 90 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        def decode_content(common_info, chunks)
          stream = StringIO.new chunks.join
      
          until stream.eof?
            info = Hash[common_info]
      Severity: Major
      Found in lib/rcs-common/evidence/application.rb and 1 other location - About 3 hrs to fix
      lib/rcs-common/evidence/clibpoard.rb on lines 29..54

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 116.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        def decode_content(common_info, chunks)
          stream = StringIO.new chunks.join
      
          until stream.eof?
            info = Hash[common_info]
      Severity: Major
      Found in lib/rcs-common/evidence/clibpoard.rb and 1 other location - About 3 hrs to fix
      lib/rcs-common/evidence/application.rb on lines 30..55

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 116.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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 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 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 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 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 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 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

        Severity
        Category
        Status
        Source
        Language