Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions set_evidence_output_to_code_blocks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# set_evidence_output_to_code_blocks.rb - Sets Evidence Output field to all be code blocks
#
# Copyright (C) 2022 Security Roots Ltd.
#
# This file is part of the Dradis Pro Scripting Examples (DPSE) collection.
# The collection can be found at
# https://github.com/securityroots/dradispro-scripting
#
# DPSE free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# DPSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with DPSE. If not, see <http://www.gnu.org/licenses/>.

if ARGV.size != 1
puts "Usage:\n\tRAILS_ENV=#{Rails.env} bundle exec rails runner #{$0} <project_id>"
exit 1
end

pid = ARGV[0]
project = Project.find(pid)

project.evidence.each do |output|

output.content.sub!("#[Output]#\n", "#[Output]#\r\nbc.. ")
output.save

end