hackedteam/rcs-db

View on GitHub

Showing 612 of 612 total issues

Method auth_user has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def auth_user(username, pass, version, peer)
    user = User.where(name: username).first

    # user not found
    if user.nil?
Severity: Minor
Found in lib/rcs-db/auth.rb - About 1 hr to fix

    Method retrieve_factory has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def retrieve_factory(ident, show, jsonfile)
        raise("you must specify a factory") if ident.nil?
    
        resp = @http.request_get('/factory', {'Cookie' => @cookie})
        resp.kind_of? Net::HTTPSuccess or raise(resp.body)
    Severity: Minor
    Found in scripts/rcs-core.rb - About 1 hr to fix

      Method add_config has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def add_config
          require_auth_level :tech
          require_auth_level :tech_config
      
          mongoid_query do
      Severity: Minor
      Found in lib/rcs-db/rest/agent.rb - About 1 hr to fix

        Method index_diff has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def index_diff(mongoid_document_class)
            collection = mongoid_document_class.collection
        
            if !collection_exists?(collection)
              diff = {missing_collection: true}
        Severity: Minor
        Found in lib/rcs-db/db_layer.rb - About 1 hr to fix

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

            def process
              agent = get_agent
              target = agent.get_parent
          
              full_path = self[:data][:path]
          Severity: Major
          Found in lib/rcs-worker/evidence/fileopen.rb and 1 other location - About 1 hr to fix
          lib/rcs-worker/evidence/filecap.rb on lines 18..34

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

          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 3 locations. Consider refactoring.
          Open

            def ips
              require_auth_level :view, :tech
          
              mongoid_query do
          
          
          Severity: Major
          Found in lib/rcs-db/rest/evidence.rb and 2 other locations - About 1 hr to fix
          lib/rcs-db/rest/evidence.rb on lines 480..497
          lib/rcs-db/rest/evidence.rb on lines 583..600

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

          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

                      unless a['mms'].nil?
                        a['mms'] = a['mms'].first
                        a['mms']['enabled'] = a['mms']['enabled'] == 'true' ? true : false
                        a['mms']['filter'] = a['mms']['filter'].first
                        a['mms']['filter']['history'] = a['mms']['filter']['history'] == 'true' ? true : false
          Severity: Major
          Found in scripts/xml_to_json.rb and 1 other location - About 1 hr to fix
          scripts/xml_to_json.rb on lines 283..288

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

          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 3 locations. Consider refactoring.
          Open

            def commands
              require_auth_level :view, :tech_exec
          
              mongoid_query do
          
          
          Severity: Major
          Found in lib/rcs-db/rest/evidence.rb and 2 other locations - About 1 hr to fix
          lib/rcs-db/rest/evidence.rb on lines 480..497
          lib/rcs-db/rest/evidence.rb on lines 605..622

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

          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 3 locations. Consider refactoring.
          Open

            def info
              require_auth_level :view, :tech
          
              mongoid_query do
          
          
          Severity: Major
          Found in lib/rcs-db/rest/evidence.rb and 2 other locations - About 1 hr to fix
          lib/rcs-db/rest/evidence.rb on lines 583..600
          lib/rcs-db/rest/evidence.rb on lines 605..622

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

          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

                      unless a['sms'].nil?
                        a['sms'] = a['sms'].first
                        a['sms']['enabled'] = a['sms']['enabled'] == 'true' ? true : false
                        a['sms']['filter'] = a['sms']['filter'].first
                        a['sms']['filter']['history'] = a['sms']['filter']['history'] == 'true' ? true : false
          Severity: Major
          Found in scripts/xml_to_json.rb and 1 other location - About 1 hr to fix
          scripts/xml_to_json.rb on lines 289..294

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

          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

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

            def process
              agent = get_agent
              target = agent.get_parent
          
              full_path = self[:data][:path]
          Severity: Major
          Found in lib/rcs-worker/evidence/filecap.rb and 1 other location - About 1 hr to fix
          lib/rcs-worker/evidence/fileopen.rb on lines 11..27

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

          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 process has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.process(entry)
              ev = Evidence.target(entry['target_id']).find(entry['evidence_id'])
          
              start = Time.now
          
          
          Severity: Minor
          Found in lib/rcs-ocr/processor.rb - About 1 hr to fix

            Method extract_chat has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.extract_chat(ev)
                data = []
            
                # "peer" attribute was present before 9.0.0
                # than has been replaced by "from" and "rcpt"
            Severity: Minor
            Found in lib/rcs-aggregator/peer.rb - About 1 hr to fix

              Method REST_task has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def REST_task(http, cookie, type, filename, params={})
                
                task_params = {'type' => type, 'file_name' => filename}
                task_params.merge! params
                
              Severity: Minor
              Found in scripts/rest_test.rb - About 1 hr to fix

                Method prepare_request has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def prepare_request(method, uri, query, content, http, peer)
                    controller, uri_params = parse_uri(uri)
                
                    params = Hash.new
                    params.merge! parse_query_parameters(query)
                Severity: Minor
                Found in lib/rcs-db/parser.rb - About 1 hr to fix

                  Method run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def run(options)
                  
                      # config file parsing
                      return 1 unless RCS::DB::Config.instance.load_from_file
                  
                  
                  Severity: Minor
                  Found in lib/rcs-worker/backlog.rb - About 1 hr to fix

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

                    class TransQueue < NotificationQueue
                      include Mongoid::Document
                    
                      field :target_id, type: String
                      field :evidence_id, type: String
                    Severity: Major
                    Found in lib/rcs-db/db_objects/queue.rb and 1 other location - About 1 hr to fix
                    lib/rcs-db/db_objects/queue.rb on lines 121..135

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

                    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

                    class OCRQueue < NotificationQueue
                      include Mongoid::Document
                    
                      field :target_id, type: String
                      field :evidence_id, type: String
                    Severity: Major
                    Found in lib/rcs-db/db_objects/queue.rb and 1 other location - About 1 hr to fix
                    lib/rcs-db/db_objects/queue.rb on lines 140..154

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

                    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 run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def run
                          # we are standalone (no rails or rack)
                          ENV['MONGOID_ENV'] = 'yes'
                    
                          # set the parameters for the mongoid.yaml
                    Severity: Minor
                    Found in scripts/mongoid_test.rb - About 1 hr to fix

                      Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def initialize
                          # default values.
                          # you have at least:
                          #   - one user to login to the system
                          #   - one collector to receive data
                      Severity: Minor
                      Found in scripts/rcs-db-license-gen.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language