EasyRecon/Hunt3r

View on GitHub
backend/app/models/subdomain.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Subdomain < ApplicationRecord
  belongs_to :domain

  scope :filtered_by_subdomain, ->(subdomain) { where('url LIKE ?', "%#{subdomain}%") }
  scope :filtered_by_technology, ->(technology) { where('infos @> ?', "{\"technologies\": [{\"name\":\"#{technology.gsub('"', '')}\"}]}") }
  scope :filtered_by_status_code, ->(status_code) { where('infos @> ?', "{\"status_code\": #{status_code}}") if status_code.to_i > 0 }
end