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.
When you're finished in the console, exit it with:
irb> exit
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! Note that this completely deletes the project from your instance.
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!
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!
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!
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!
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!
Access the IssueLibrary entries on your instance with Dradis::Pro::Plugins::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::Plugins::Issuelib::Entry.find(432)
Then, you can delete the IssueLibrary entry with:
irb> Dradis::Pro::Plugins::Issuelib::Entry.find(432).destroy
Make sure to sub in the correct Entry ID for 432
in the examples above!
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
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.
irb> user = User.find_by_email('jane@example.com')
irb> user.password = 'dradis'
irb> user.password_confirmation = 'dradis'
irb> user.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!
User accounts are locked when the number of incorrect password attempts exceeds the maximum login attempts. If an admin user has access to the app, they can also unlock the account.
irb> user = User.find_by_email('jane@example.com')
irb> user.locked?
irb> user.unlock!
irb> user.save
Make sure to sub in the actual email for the account you want to unlock!
irb> user = User.find_by_email('jane@example.com')
irb> user.first.update_attribute :email, 'janedoe@newdomain.com'
Make sure to sub in the original email and the new email address for the account.
Next help article: Upload tool output from the command line →
Your email is kept private. We don't do the spam thing.