Sha256: ea8c451cf150dcb4228b6e01d4548d1a76aec995e85e98323b47357e9b20ff0c
Contents?: true
Size: 660 Bytes
Versions: 66
Compression:
Stored size: 660 Bytes
Contents
class TrackSuccessfulExploits < ActiveRecord::Migration class ExploitedHost < ActiveRecord::Base end class Vuln < ActiveRecord::Base end def self.up add_column :vulns, :exploited_at, :timestamp # Migrate existing exploited_hosts entries ExploitedHost.all.select {|x| x.name}.each do |exploited_host| next unless(exploited_host.name =~ /^(exploit|auxiliary)\//) vulns = Vuln.where(name: exploited_host.name, host_id: exploited_host.host_id) next if vulns.empty? vulns.each do |vuln| vuln.exploited_at = exploited_host.updated_at vuln.save end end end def self.down remove_column :vulns, :exploited_at end end
Version data entries
66 entries across 66 versions & 1 rubygems