Skip to content

Commit 5e39f89

Browse files
committed
Fix exception on msf 'db_export' cmd (see rapid7#7008)
Users reported (in GitHub issue rapid7#7008) hitting an exception when attempting to export the contents of the msf database (i.e. workspaces, hosts, events, etc.) via the 'db_export' command. After some digging, it appears there were a few ActiveRecord changes with the new Rails upgrade that require a couple mods to the way we are querying.
1 parent 55457ef commit 5e39f89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/msf/core/db_export.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ def extract_host_entries
125125
@owned_hosts = []
126126
@hosts = myworkspace.hosts
127127
@hosts.each do |host|
128-
if host.notes.find :first, :conditions => { :ntype => 'pro.system.compromise' }
128+
if host.notes.where(:ntype => 'pro.system.compromise').first
129129
@owned_hosts << host
130130
end
131131
end
132132
end
133133

134134
# Extracts all events from a project, storing them in @events
135135
def extract_event_entries
136-
@events = myworkspace.events.find :all, :order => 'created_at ASC'
136+
@events = myworkspace.events.order('created_at ASC')
137137
end
138138

139139
# Extracts all services from a project, storing them in @services

0 commit comments

Comments
 (0)