Monthly Archives: April 2024

Top 10 tables – a custom Dradis script

Imagine, you scan a few hundred hosts to create a summary report. You want to show data on ports and operating systems without giving the end user hundreds of pages of data. Enter the “Top 10” script!

Credit for this script idea goes to Chris from I.S. Partners. He reached out via the support inbox to see if we could create a “Top 10” script that would do the following:

  1. Create an array of all of the operating systems, ports/protocols, and services in the project
  2. Deduplicate the arrays and count the number of instances
  3. Narrow down the array to the top 10 based on the number of instances
  4. Update a Content Block in the project with a textile table based on each array

The script assumes that you have a Content Block with the Type field set to “Top10” with the following fields:

  • PortScanning
  • OSEnumeration
  • ServiceEnumeration

Head to our scripting repo and check out the “Top 10” script. To use it:

1. SCP the top10.rb file to your instance (e.g. to the /tmp folder)

2. In the browser, find the project ID of the project that you need to update. For example, if your project lives at /pro/projects/123 in the browser, the ID is 123.

3. Run the following in the command line as “dradispro”:
$ cd /opt/dradispro/dradispro/current/
$ RAILS_ENV=production bin/rails runner /tmp/top10.rb <project_id>

You’ll need to sub in your project ID (Step #2 above) for “<project_id>” above! Example:

$ RAILS_ENV=production bin/rails runner /tmp/top10.rb 123

When the script completes, you’ll see this output in the console:

Port Scanning table updated!
Service Enumeration table updated!
OS Enumeration table updated!

After running the script, you can refresh the Top 10 content block to see the updated tables:

Chris reported that with their largest Nessus file (125MB), the script was able to perform the calculations successfully in less than 30 seconds. We’re optimistic about a similar script’s performance with your projects.

This script will need to be adjusted to meet your individual team’s specific requirements and preferences. But, we think it’s a promising option for teams who prefer not to use VBA or want to create similar tables in their Word reports.

If you need any help customizing this script to meet your specific use case, please reach out to our support team. Or, if you have ideas for improvements, please fork the repo and post in our users forum.