hackedteam/rcs-collector

View on GitHub

Showing 119 of 209 total issues

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

  def push
    # only the DB is authorized to send PUSH commands
    unless from_db?(@request[:headers])
      trace :warn, "HACK ALERT: #{@request[:peer]} is trying to send PUSH [#{@request[:uri]}] commands!!!"
      return method_not_allowed
Severity: Minor
Found in lib/rcs-collector/http_controller.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 protocol_execute_commands has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def protocol_execute_commands(commands)

        trace :debug, "[#{@element['name']}] Received command is: #{commands.inspect}"

        # fallback to array if it's a single command
Severity: Minor
Found in lib/rcs-controller/protocol_parser.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 timeout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def timeout(delta = 7200)
    trace :debug, "Session Manager timing out entries..." if @sessions.length > 0
    # save the size of the hash before deletion
    size = @sessions.length
    # search for timed out sessions
Severity: Minor
Found in lib/rcs-collector/sessions.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 new_upgrade? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def new_upgrade?(bid)
    # cannot reach the db, return false
    return false unless @available

    # remove any pending entry in the cache
Severity: Minor
Found in lib/rcs-collector/db.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 compact has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def compact(instance)
    # sanity check
    path = REPO_DIR + '/' + instance
    return unless File.exist?(path)

Severity: Minor
Found in lib/rcs-collector/evidence_manager.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 purge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def purge(instance, options = {force: false, timeout: false})

    # forced deletion
    if options[:force]
      FileUtils.rm_rf(REPO_DIR + '/' + instance)
Severity: Minor
Found in lib/rcs-collector/evidence_manager.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 new_conf? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def new_conf?(bid)
    # check if we have the config in the cache
    # probably and old one not yet sent
    return true if DBCache.new_conf? bid
    # cannot reach the db, return false
Severity: Minor
Found in lib/rcs-collector/db.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

Avoid too many return statements within this method.
Open

    return stream_file(File.realdirpath(file_path), proc {delete_after_serve(File.realdirpath(file_path), os) if delete})
Severity: Major
Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return enc_msg, 'application/octet-stream', cookie
    Severity: Major
    Found in lib/rcs-collector/sync_protocol.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return response, 'application/octet-stream', cookie
      Severity: Major
      Found in lib/rcs-collector/sync_protocol.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return 'symbian', '.sisx' if user_agent['Symbian']
        Severity: Major
        Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                    return {status: DB::CLOSED_AGENT, id: aid, good: good}
          Severity: Major
          Found in lib/rcs-collector/db_rest.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return
            Severity: Major
            Found in lib/rcs-collector/sync_protocol.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return not_found if os == 'cydia' and not File.file?(file_path)
              Severity: Major
              Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return decoy_page unless File.file?(file_path)
                Severity: Major
                Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return {status: DB::QUEUED_AGENT, id: aid, good: good}
                  Severity: Major
                  Found in lib/rcs-collector/db_rest.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          return
                    Severity: Major
                    Found in lib/rcs-collector/sync_protocol.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                          return 'windows', '.exe' if user_agent['Windows']
                      Severity: Major
                      Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                              return 'android', "." + version + '.apk'
                        Severity: Major
                        Found in lib/rcs-collector/http_controller.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return "The anonymizers chain is not configured" if !first_anonymizer_address
                          Severity: Major
                          Found in lib/rcs-collector/firewall.rb - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language