Example #1
0
 def SavePartialPluginOutput(self, plugin, output, message, target_id=None):
     self.db.session.merge(
         models.PluginOutput(
             plugin_key=plugin["key"],
             plugin_code=plugin["code"],
             plugin_group=plugin["group"],
             plugin_type=plugin["type"],
             output=json.dumps(output),
             error=message,
             start_time=plugin["start"],
             end_time=plugin["end"],
             status=plugin["status"],
             target_id=target_id,
             # Save path only if path exists i.e if some files were to be stored
             # it will be there
             output_path=(plugin["output_path"] if os.path.exists(
                 self.plugin_handler.GetPluginOutputDir(plugin)) else None),
             owtf_rank=plugin['owtf_rank']))
     self.db.session.commit()
Example #2
0
 def SavePluginOutput(self, plugin, output, target_id=None):
     """Save into the database the command output of the plugin `plugin."""
     self.Core.DB.session.merge(
         models.PluginOutput(
             plugin_key=plugin["key"],
             plugin_code=plugin["code"],
             plugin_group=plugin["group"],
             plugin_type=plugin["type"],
             output=json.dumps(output),
             start_time=plugin["start"],
             end_time=plugin["end"],
             status=plugin["status"],
             target_id=target_id,
             # Save path only if path exists i.e if some files were to be stored
             # it will be there
             output_path=(plugin["output_path"] if os.path.exists(
                 self.Core.PluginHandler.GetPluginOutputDir(plugin)) else
                          None),
             owtf_rank=plugin['owtf_rank']))
     self.Core.DB.session.commit()