Sha256: dc27ba69a1de788c08cd9f4cc9ad9e0c2a94c33404de09753286e471e903b509

Contents?: true

Size: 570 Bytes

Versions: 66

Compression:

Stored size: 570 Bytes

Contents

class RenameAndPruneNessusVulns < ActiveRecord::Migration

	class Vuln < ActiveRecord::Base
	end

	# No table changes, just vuln renaming to drop the NSS id
	# from those vulns that have it and a descriptive name.
	def self.up
		Vuln.all.each do |v|
			if v.name =~ /^NSS-0?\s*$/
				v.delete
				next
			end
			next unless(v.name =~ /^NSS-[0-9]+\s(.+)/)
			new_name = $1
			next if(new_name.nil? || new_name.strip.empty?)
			v.name = new_name
			v.save!
		end
	end

	def self.down
		say "Cannot un-rename and un-prune NSS vulns for migration 20110517160800."
	end

end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
metasploit_data_models-1.2.0 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-1.1.0 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-1.0.1 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-1.0.0 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.24.3 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.24.2 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.24.1.pre.rspec.pre.3.pre.1 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.24.1 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0b db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0a db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.24.0 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.23.3.pre.autoload db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.23.2 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.23.2-java db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.23.1 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.23.1-java db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.23.0 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.23.0-java db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.22.8 db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb
metasploit_data_models-0.22.8-java db/migrate/20110517160800_rename_and_prune_nessus_vulns.rb