User's guide to the Dradis console

Before you begin: fire up the Dradis console

Before you can work in the rails console, you have to open up the rails console! All the other commands in this guide assume that you've already run the following commands.

Run the following in the console as dradispro:

$ cd /opt/dradispro/dradispro/current/
$ RAILS_ENV=production bundle exec rails console

That's it! Now you're in the Dradis console.

It's time to start accessing and manipulating your data.

This guide contains:

Exit the Dradis console

When you're finished in the console, exit it with:

irb> exit

Projects

Access the Project with the very fitting Project.

To access a specific Project, you'll need to get the ID of the project from the URL like: /pro/projects/123.

irb> Project.find(123)

Then, you can delete the project with:

irb> Project.find(123).destroy

Make sure to sub in the correct Project ID for 123 in the examples above!

Issues

Access the Issues in your projects with Issue.

To access a specific Issue, you'll need to get the ID of the Issue from the URL like: /pro/issues/321.

irb> Issue.find(321)

Then, you can delete the Issue with:

irb> Issue.find(321).destroy

Make sure to sub in the correct Issue ID for 321 in the examples above!

Nodes

Access the Nodes in your projects with Node.

To access a specific Node, you'll need to get the ID of the Node from the URL like: /pro/nodes/111/evidence/4321. The first number (ex. 111) is the Node ID that we need.

irb> Node.find(111)

Then, you can delete the Node with:

irb> Node.find(111).destroy

If you want to access all of the Evidence associated with a specific Node, you can use:

irb> Node.find(111).evidence

To manipulate one of those pieces of Evidence, check out Evidence below.


If you want to access all of the Notes associated with a specific Node, you can use:

irb> Node.find(111).notes

To manipulate one of those Notes, check out Notes below.

Make sure to sub in the correct Node ID for 111 in the examples above!

Evidence

Access the Evidence in your projects with Evidence.

To access a specific Issue, you'll need to get the ID of the Evidence from the URL like: /pro/nodes/111/evidence/4321. The first number (ex. 111) is the Node ID, the second number (ex. 4321) is the Evidence ID that we need.

irb> Evidence.find(4321)

Then, you can delete the piece of Evidence with:

irb> Issue.find(4321).destroy

Make sure to sub in the correct Evidence ID for 4321 in the examples above!

Notes

Access the Notes in your projects with Note.

To access a specific Note, you'll need to get the ID of the Note from the URL like: /pro/nodes/111/notes/222. The first number (ex. 111) is the Node ID, the second number (ex. 222) is the Note ID that we need.

irb> Note.find(222)

Then, you can delete the Note with:

irb> Note.find(222).destroy

Make sure to sub in the correct Note ID for 222 in the examples above!

Rules in the Rules Engine

Access the Rules on your instance with Dradis::Pro::Rules::Rule.

First, you'll need to get the Rule ID of the Rule from the URL like: /pro/admin/ruleengine/rules/2/edit

irb> Dradis::Pro::Rules::Rule.find(2)

Then, you can delete the Rule with:

irb> Dradis::Pro::Rules::Rule.find(2).destroy

Make sure to sub in the correct Rule ID for 2 in the examples above!

IssueLibrary entries

Access the IssueLibrary entries on your instance with Dradis::Pro::Issuelib::Entry.

First, you'll need to get the Entry ID from the IssueLibrary URL like: //pro/admin/issuelib/entries/432/edit

irb> Dradis::Pro::Issuelib::Entry.find(432)

Then, you can delete the IssueLibrary entry with:

irb> Dradis::Pro::Issuelib::Entry.find(432).destroy

Make sure to sub in the correct Entry ID for 432 in the examples above!

The Trash Feature

Access the Trash contents with PaperTrail::Version.

To clean out the Trash feature for a specific project, first find the correct Project ID from the URL like: /pro/projects/123. Then run:

irb > PaperTrail::Version.where(project_id: 123).count

Make sure to sub in the correct Project ID for 123 in the example above!

The command above is going to output the number of items in the trash that will be deleted with the next command. The next command cannot be undone.

irb > PaperTrail::Version.where(project_id: 123).destroy_all

To delete just a specific type of data that will be deleted, you can use item_type like:

irb > PaperTrail::Version.where(project_id: 123, item_type: "Issue").destroy_all

Users

Access users with User. For example, User.find(1) will return the User with ID = 1.

The most common use case for manipulating Users in the Dradis console is to change the email or password associated with the user.

To change the password for your user:

irb> a = User.find_by_email('jane@example.com')
irb> a.password = 'dradis'
irb> a.password_confirmation = 'dradis'
irb> a.save

Make sure to sub in the actual email for the account you want to change and change the password and password_confirmation to the correct value!

To change the email for your user:

irb> a = User.find_by_email('jane@example.com')
irb> a.first.update_attribute :email, 'janedoe@newdomain.com'

Make sure to sub in the original email and the new email address for the account.