Class: TrackSuccessfulExploits
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- TrackSuccessfulExploits
show all
- Defined in:
- db/migrate/20110513143900_track_successful_exploits.rb
Defined Under Namespace
Classes: ExploitedHost, Vuln
Class Method Summary
collapse
Class Method Details
.down ⇒ Object
27
28
29
|
# File 'db/migrate/20110513143900_track_successful_exploits.rb', line 27
def self.down
remove_column :vulns, :exploited_at
end
|
.up ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'db/migrate/20110513143900_track_successful_exploits.rb', line 10
def self.up
add_column :vulns, :exploited_at, :timestamp
ExploitedHost.find(:all).select {|x| x.name}.each do |exploited_host|
next unless(exploited_host.name =~ /^(exploit|auxiliary)\//)
vulns = Vuln.find_all_by_name_and_host_id(exploited_host.name, exploited_host.host_id)
next if vulns.empty?
vulns.each do |vuln|
vuln.exploited_at = exploited_host.updated_at
vuln.save
end
end
end
|