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

Version Path
metasploit_data_models-3.0.10 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.9 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.8 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.7 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.6 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.5 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.17 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.4 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.2 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.1 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-3.0.0 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.16 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.15 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.14 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.13 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.12 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.11 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.10 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.9 db/migrate/20110513143900_track_successful_exploits.rb
metasploit_data_models-2.0.8 db/migrate/20110513143900_track_successful_exploits.rb