hackedteam/rcs-db

View on GitHub

Showing 453 of 612 total issues

File evidence.rb has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative '../db_layer'
require_relative '../position/resolver'
require_relative '../connector_manager'
require_relative '../evidence_dispatcher'

Severity: Minor
Found in lib/rcs-db/rest/evidence.rb - About 5 hrs to fix

    Method load_license has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

      def load_license(periodic = false)
    
        # load the license file
        lic_file = File.join $execution_directory, RCS::DB::Config::CONF_DIR, LICENSE_FILE
    
    
    Severity: Minor
    Found in lib/rcs-db/license.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

    File tasks.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'archive/tar/minitar'
    require 'uuidtools'
    require 'fileutils'
    require 'rcs-common/trace'
    require 'rcs-common/temporary'
    Severity: Minor
    Found in lib/rcs-db/tasks.rb - About 4 hrs to fix

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

        def generate_certificates(options)
          trace :info, "Generating ssl certificates..."
      
          # ensure dir is present
          FileUtils.mkdir_p File.join($execution_directory, CERT_DIR)
      Severity: Minor
      Found in lib/rcs-db/config.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 melt has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

        def melt(params)
          trace :debug, "Build: melt #{params}"
      
          @appname = params['appname'] || 'exploit'
      
      
      Severity: Minor
      Found in lib/rcs-db/build/exploit.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 parse_agents has 106 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def parse_agents(items)
            modules = []
      
            return modules if items.nil?
      
      
      Severity: Major
      Found in scripts/xml_to_json.rb - About 4 hrs to fix

        Class AgentController has 33 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class AgentController < RESTController
          include RCS::Crypt
        
          def index
            require_auth_level :tech, :view
        Severity: Minor
        Found in lib/rcs-db/rest/agent.rb - About 4 hrs to fix

          Class Entity has 33 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Entity
            extend RCS::Tracer
            include RCS::Tracer
            include Mongoid::Document
            include Mongoid::Timestamps
          Severity: Minor
          Found in lib/rcs-db/db_objects/entity.rb - About 4 hrs to fix

            Class RESTController has 32 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class RESTController
              include RCS::Tracer
              include RCS::Common::Rest
            
              # the parameters passed on the REST request
            Severity: Minor
            Found in lib/rcs-db/rest.rb - About 4 hrs to fix

              Method status has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                def status
                  require_auth_level :server, :tech
                  
                  demo = (@params['demo'] == 'true') ? true : false
                  level = @params['level'].to_sym
              Severity: Minor
              Found in lib/rcs-db/rest/agent.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 blacklisted_software? has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                def blacklisted_software?(params = {})
                  upgrade_method = :elite
              
                  raise BlacklistError.new("Cannot determine blacklist") if self._kind != 'agent'
              
              
              Severity: Minor
              Found in lib/rcs-db/db_objects/item.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 call_processor.rb has 326 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'ffi'
              require 'mongoid'
              require 'stringio'
              require 'digest/md5'
              
              
              Severity: Minor
              Found in lib/rcs-worker/call_processor.rb - About 3 hrs to fix

                Method parse_events has 95 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def parse_events(items)
                      events = []
                
                      return events if items.nil?
                
                
                Severity: Major
                Found in scripts/xml_to_json.rb - About 3 hrs to fix

                  Method melt has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def melt(params)
                      trace :debug, "Build: melting: #{params}"
                  
                      executable = path('default')
                      @appname = params['appname'] || 'install'
                  Severity: Minor
                  Found in lib/rcs-db/build/osx.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 evidence.rb has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'mongoid'
                  require 'rcs-common/trace'
                  require 'rcs-common/keywords'
                  
                  require_relative '../shard'
                  Severity: Minor
                  Found in lib/rcs-db/db_objects/evidence.rb - About 3 hrs to fix

                    Method patch has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def patch(params)
                        trace :debug, "Build: patching: #{params}"
                    
                        # add the file to be patched to the params
                        # these params will be passed to the super
                    Severity: Minor
                    Found in lib/rcs-db/build/symbian.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

                    Class Item has 29 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Item
                      extend RCS::Tracer
                      include RCS::Tracer
                      include RCS::Crypt
                      include Mongoid::Document
                    Severity: Minor
                    Found in lib/rcs-db/db_objects/item.rb - About 3 hrs to fix

                      Class DB has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class DB
                        include Singleton
                        include RCS::Tracer
                      
                        def initialize
                      Severity: Minor
                      Found in lib/rcs-db/db_layer.rb - About 3 hrs to fix

                        Method periodic_check has 86 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def periodic_check
                            begin
                        
                              # periodically check for license file
                              load_license(true)
                        Severity: Major
                        Found in lib/rcs-db/license.rb - About 3 hrs to fix

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

                            def self.offload_move_evidence(params)
                              old_target = ::Item.find(params[:old_target_id])
                              target = ::Item.find(params[:target_id])
                              agent = ::Item.find(params[:agent_id])
                          
                          
                          Severity: Minor
                          Found in lib/rcs-db/db_objects/evidence.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

                          Severity
                          Category
                          Status
                          Source
                          Language