Projects STRLCPY Hunt3r Commits 161246d3
🤬
  • ■ ■ ■ ■ ■
    backend/app/controllers/subdomains_controller.rb
    skipped 14 lines
    15 15   end
    16 16   
    17 17   limit = params[:limit] == '-1' ? @subdomains.count : params[:limit]
    18  - @subdomains = if @subdomains.is_a?(Array)
    19  - Kaminari.paginate_array(@subdomains).page(params[:page]).per(limit)
    20  - else
    21  - @subdomains.page(params[:page]).per(limit)
    22  - end
     18 + @subdomains = @subdomains.page(params[:page]).per(limit)
    23 19   
    24 20   render status: 200, template: 'subdomains/index'
    25 21   end
    skipped 27 lines
  • ■ ■ ■ ■ ■
    backend/app/models/subdomain.rb
    skipped 1 lines
    2 2   belongs_to :domain
    3 3   
    4 4   scope :filtered_by_subdomain, ->(subdomain) { where('url LIKE ?', "%#{subdomain}%") }
    5  - scope :filtered_by_technology, lambda { |technology|
    6  - subdomains = []
    7  - 
    8  - self.each do |subdomain|
    9  - technologies = subdomain.infos['technologies']
    10  - next if technologies.empty?
    11  - 
    12  - technologies.each do |tech|
    13  - next unless tech['name'] == technology
    14  - 
    15  - subdomains << subdomain
    16  - end
    17  - end
    18  - 
    19  - subdomains
    20  - }
     5 + scope :filtered_by_technology, ->(technology) { where('infos @> ?', "{\"technologies\": [{\"name\":\"#{technology}\"}]}") }
    21 6   scope :filtered_by_status_code, ->(status_code) { where('infos @> ?', "{\"status_code\": #{status_code}}") if status_code.to_i > 0 }
    22 7  end
    23 8   
Please wait...
Page is in error, reload to recover