RPC calls in the models should be wrapped

Sometimes we're not talking RPC, and the model shouldn't stack trace in
those cases.
unstable
Tod Beardsley 2012-04-16 11:03:23 -05:00
parent 4bcbdc54c9
commit 4b943c8769
5 changed files with 9 additions and 9 deletions

View File

@ -13,8 +13,8 @@ module MetasploitDataModels::ActiveRecordModels::Loot
private
def delete_file
c = Pro::Client.get
c.loot_delete_file(self[:id])
c = Pro::Client.get rescue nil
c.loot_delete_file(self[:id]) if c
end
}
end

View File

@ -16,8 +16,8 @@ module MetasploitDataModels::ActiveRecordModels::Report
private
def delete_file
c = Pro::Client.get
c.report_delete_file(self[:id])
c = Pro::Client.get rescue nil
c.report_delete_file(self[:id]) if c
end
}
end

View File

@ -9,8 +9,8 @@ module MetasploitDataModels::ActiveRecordModels::ReportTemplate
private
def delete_file
c = Pro::Client.get
c.report_template_delete_file(self[:id])
c = Pro::Client.get rescue nil
c.report_template_delete_file(self[:id]) if c
end
}
end

View File

@ -18,7 +18,7 @@ module MetasploitDataModels::ActiveRecordModels::Session
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 File

@ -15,8 +15,8 @@ module MetasploitDataModels::ActiveRecordModels::Task
private
def delete_file
c = Pro::Client.get
c.task_delete_log(self[:id])
c = Pro::Client.get rescue nil
c.task_delete_log(self[:id]) if c
end
}
end