Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes a stack trace when deleting files #339

Merged
merged 3 commits into from

2 participants

@todb-r7
Owner

@trosen-r7 should totally look at this before merging. Also, this doesn't touch upstream Mdm of course.

todb added some commits
@todb todb RPC calls in the models should be wrapped
Sometimes we're not talking RPC, and the model shouldn't stack trace in
those cases.
4b943c8
@todb todb Delete files locally, not over RPC.
In the event we're just msfconsole.
ef762c5
@todb todb Lift a migration from Pro -- workspace_members
Should have landed here initially anyway.
7caf3a0
@todb-r7 todb-r7 merged commit bac6593 into from
@todb-r7
Owner

Note that this change on the data models is also reflected upstream, here:

rapid7/metasploit_data_models@52bcb5b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 16, 2012
  1. @todb

    RPC calls in the models should be wrapped

    todb authored
    Sometimes we're not talking RPC, and the model shouldn't stack trace in
    those cases.
  2. @todb

    Delete files locally, not over RPC.

    todb authored
    In the event we're just msfconsole.
  3. @todb

    Lift a migration from Pro -- workspace_members

    todb authored
    Should have landed here initially anyway.
This page is out of date. Refresh to see the latest.
View
9 data/sql/migrate/20120411173220_rename_workspace_members.rb
@@ -0,0 +1,9 @@
+class RenameWorkspaceMembers < ActiveRecord::Migration
+ def up
+ rename_table :project_members, :workspace_members
+ end
+
+ def down
+ rename_table :workspace_members, :project_members
+ end
+end
View
8 ...by/1.9.1/gems/metasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/loot.rb
@@ -13,8 +13,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.loot_delete_file(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.loot_delete_file(self[:id])
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
View
8 .../1.9.1/gems/metasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/report.rb
@@ -16,8 +16,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.report_delete_file(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.report_delete_file(self[:id])
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
View
8 ...ms/metasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/report_template.rb
@@ -9,8 +9,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.report_template_delete_file(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.report_template_delete_file(self[:id])
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
View
2  ...1.9.1/gems/metasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/session.rb
@@ -18,7 +18,7 @@ def self.included(base)
private
def stop
- c = Pro::Client.get
+ c = Pro::Client.get rescue nil
c.session_stop(self.local_id) rescue nil # ignore exceptions (XXX - ideally, stopped an already-stopped session wouldn't throw XMLRPCException)
end
}
View
8 ...by/1.9.1/gems/metasploit_data_models-0.0.2.43DEV/lib/metasploit_data_models/active_record_models/task.rb
@@ -15,8 +15,12 @@ def self.included(base)
private
def delete_file
- c = Pro::Client.get
- c.task_delete_log(self[:id])
+ c = Pro::Client.get rescue nil
+ if c
+ c.task_delete_log(self[:id]) if c
+ else
+ ::File.unlink(self.path) rescue nil
+ end
end
}
end
Something went wrong with that request. Please try again.