Update your IssueLibrary entries

The update_issuelib_entries.rb shows you different ways to update your IssueLibrary entries with a quick script rather than one at a time.

It updates all of the IssueLibrary entries on your instance. If a plugin_id field exists, it replaces it with a nessus_id field. And, the script adds a new Status field to every entry.

To add a new field, we harnass a loop like the following:

Dradis::Pro::Issuelib::Entry.find do |libentry|
  libentry.content << "\r\n\r\n#[Status]#\r\nOpen | Closed\r\n"
  puts "Adding fields to IssueLibrary entry #{libentry.id}"
  libentry.save
end
    

This adds the following content to each entry in the IssueLibrary:

#[Status]#
Open | Closed

To find and replace an existing field in the entries, we instead use an if loop:

Dradis::Pro::Issuelib::Entry.find do |libentry|
  if libentry.content.include? "#[plugin_id]#"
    libentry.content.sub!('#[plugin_id]#', '#[nessus_id]#')
    libentry.save
    puts "Replacing fields in IssueLibrary entry #{libentry.id}"
  end
end
    

The loop above would change any plugin_id fields to nessus_id fields.

Great job, you reached the end of the guide! Have you read all of them?