hackedteam/rcs-collector

View on GitHub

Showing 119 of 209 total issues

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
    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
      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 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 message, '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 'unknown', ''
            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
              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 'linux', '.bin' if user_agent['Linux'] or user_agent['X11']
                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 enc_msg, 'application/octet-stream', cookie
                    Severity: Major
                    Found in lib/rcs-collector/sync_protocol.rb - About 30 mins to fix

                      Method store_evidence_chunk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def store_evidence_chunk(session, id, base, chunk, size, content)
                          Dir::mkdir(REPO_CHUNK_DIR) if not File.directory?(REPO_CHUNK_DIR)
                          path =  REPO_CHUNK_DIR + '/' + session[:ident] + '_' + session[:instance]
                      
                          header_len = 12
                      Severity: Minor
                      Found in lib/rcs-collector/evidence_manager.rb - About 25 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 create_repository has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def create_repository(session)
                          # ensure the repository directory is present
                          Dir::mkdir(REPO_DIR) if not File.directory?(REPO_DIR)
                      
                          trace :info, "Creating repository for [#{session[:ident]}_#{session[:instance]}]"
                      Severity: Minor
                      Found in lib/rcs-collector/evidence_manager.rb - About 25 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 process_http_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def process_http_request
                      
                              operation = proc do
                                begin
                                  # perform the protocol (all the interesting stuff happens here)
                      Severity: Minor
                      Found in lib/rcs-controller/network_controller.rb - About 25 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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.get
                          # don't perform resolution if not wanted
                          return '' unless Config.instance.global['RESOLVE_IP']
                      
                          address = ''
                      Severity: Minor
                      Found in lib/rcs-collector/my_ip.rb - About 25 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 command_conf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def command_conf(peer, session, message)
                          trace :info, "[#{peer}][#{session[:cookie]}] Configuration request"
                      
                          # if the command contains a message
                          # it is a response to inform us of the stressfulness of the operation
                      Severity: Minor
                      Found in lib/rcs-collector/sync_commands.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.new_conf(bid)
                          return nil unless File.exist?(CACHE_FILE)
                      
                          begin
                            db = SQLite.open CACHE_FILE
                      Severity: Minor
                      Found in lib/rcs-collector/db_cache.rb - About 25 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 agent_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def agent_status(build_id, instance_id, platform, demo, level)
                          begin
                            request = {:ident => build_id, :instance => instance_id, :platform => platform, :demo => demo, :level => level}
                            ret = rest_call('GET', '/agent/status/?' + CGI.encode_query(request))
                      
                      
                      Severity: Minor
                      Found in lib/rcs-collector/db_rest.rb - About 25 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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def perform
                              # if the database connection has gone
                              # try to re-login to the database again
                              unless DB.instance.connected?
                                trace :debug, "heartbeat: try to reconnect to rcs-db"
                      Severity: Minor
                      Found in lib/rcs-carrier/heartbeat.rb - About 25 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 stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def self.stop
                          return unless @server_handle
                      
                          trace(:info, "Stopping http server...")
                          EM.stop_server(@server_handle) if @server_handle
                      Severity: Minor
                      Found in lib/rcs-collector/events.rb - About 25 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