{"id":2371,"date":"2024-04-16T16:41:52","date_gmt":"2024-04-16T15:41:52","guid":{"rendered":"https:\/\/dradis.com\/blog\/?p=2371"},"modified":"2026-04-24T02:20:14","modified_gmt":"2026-04-24T01:20:14","slug":"top-10-tables-a-custom-dradis-script","status":"publish","type":"post","link":"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/","title":{"rendered":"Top 10 tables &#8211; a custom Dradis script"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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 &#8220;<a href=\"https:\/\/github.com\/securityroots\/dradispro-scripting\/blob\/main\/top10.rb\">Top 10<\/a>&#8221; script! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 &#8220;<a href=\"https:\/\/github.com\/securityroots\/dradispro-scripting\/blob\/main\/top10.rb\">Top 10<\/a>&#8221; script that would do the following: <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create an array of all of the operating systems, ports\/protocols, and services in the project<\/li>\n\n\n\n<li>Deduplicate the arrays and count the number of instances<\/li>\n\n\n\n<li>Narrow down the array to the top 10 based on the number of instances<\/li>\n\n\n\n<li>Update a Content Block in the project with a textile table based on each array<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The script assumes that you have a Content Block with the Type field set to &#8220;Top10&#8221; with the following fields: <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PortScanning<\/li>\n\n\n\n<li>OSEnumeration<\/li>\n\n\n\n<li>ServiceEnumeration<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-12.45.55-PM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1102\" height=\"769\" src=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-12.45.55-PM.png\" alt=\"\" class=\"wp-image-2372\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Head to our scripting repo and check out the &#8220;<a href=\"https:\/\/github.com\/securityroots\/dradispro-scripting\/blob\/main\/top10.rb\">Top 10<\/a>&#8221; script. To use it: <br><br>1. SCP the top10.rb file to your instance (e.g. to the \/tmp folder)<br><br>2. In the browser, find the project ID of the project that you need to update. For example, if your project lives at <code>\/pro\/projects\/123<\/code> in the browser, the ID is 123.<br><br>3. Run the following in the command line as &#8220;dradispro&#8221;: <br><code>$ cd \/opt\/dradispro\/dradispro\/current\/<\/code><br><code>$ RAILS_ENV=production bin\/rails runner \/tmp\/top10.rb &lt;project_id&gt;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You&#8217;ll need to sub in your project ID (Step #2 above) for &#8220;&lt;project_id&gt;&#8221; above! Example:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>$ RAILS_ENV=production bin\/rails runner \/tmp\/top10.rb 123<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When the script completes, you&#8217;ll see this output in the console:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Port Scanning table updated!<br>Service Enumeration table updated!<br>OS Enumeration table updated!<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-12.52.36-PM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"842\" height=\"90\" src=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-12.52.36-PM.png\" alt=\"\" class=\"wp-image-2373\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After running the script, you can refresh the Top 10 content block to see the updated tables: <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-1.01.41-PM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1086\" height=\"677\" src=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-1.01.41-PM.png\" alt=\"\" class=\"wp-image-2374\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-1.02.03-PM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1088\" height=\"712\" src=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-1.02.03-PM.png\" alt=\"\" class=\"wp-image-2375\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Chris reported that with their largest Nessus file (125MB), the script was able to perform the calculations successfully in less than 30 seconds. We&#8217;re optimistic about a similar script&#8217;s performance with your projects. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This script will need to be adjusted to meet your individual team&#8217;s specific requirements and preferences. But, we think it&#8217;s a promising option for teams who prefer not to use VBA or want to create similar tables in their Word reports. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you need any help customizing this script to meet your specific use case, please <a href=\"https:\/\/dradis.com\/contact.html\">reach out<\/a> to our <a href=\"https:\/\/dradis.com\/support\/#team-rachael\">support team<\/a>. Or, if you have ideas for improvements, please <a href=\"https:\/\/github.com\/securityroots\/dradispro-scripting\/fork\">fork the repo<\/a> and post in our <a href=\"https:\/\/discuss.dradisframework.org\/\">users forum<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;Top 10&#8221; script! Credit for this script idea goes to Chris from I.S. Partners. He reached out via the support inbox [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[9],"tags":[],"class_list":["post-2371","post","type-post","status-publish","format-standard","hentry","category-features"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Top 10 tables - a custom Dradis script - Dradis Framework Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Top 10 tables - a custom Dradis script - Dradis Framework Blog\" \/>\n<meta property=\"og:description\" content=\"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 &#8220;Top 10&#8221; script! Credit for this script idea goes to Chris from I.S. Partners. He reached out via the support inbox [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/\" \/>\n<meta property=\"og:site_name\" content=\"Dradis Framework Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-16T15:41:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-24T01:20:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-12.45.55-PM.png\" \/>\n<meta name=\"author\" content=\"Rachael Carder\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dradisfw\" \/>\n<meta name=\"twitter:site\" content=\"@dradisfw\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rachael Carder\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/\",\"url\":\"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/\",\"name\":\"Top 10 tables - a custom Dradis script - Dradis Framework Blog\",\"isPartOf\":{\"@id\":\"https:\/\/dradis.com\/blog\/#website\"},\"datePublished\":\"2024-04-16T15:41:52+00:00\",\"dateModified\":\"2026-04-24T01:20:14+00:00\",\"author\":{\"@id\":\"https:\/\/dradis.com\/blog\/#\/schema\/person\/978f2d4e6ffa56f0569a62775a8320bb\"},\"breadcrumb\":{\"@id\":\"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dradis.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Top 10 tables &#8211; a custom Dradis script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dradis.com\/blog\/#website\",\"url\":\"https:\/\/dradis.com\/blog\/\",\"name\":\"Dradis Framework Blog\",\"description\":\"Information management for security teams\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dradis.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/dradis.com\/blog\/#\/schema\/person\/978f2d4e6ffa56f0569a62775a8320bb\",\"name\":\"Rachael Carder\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dradis.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/783abea5f7f5f6fd0bb909ea02a257df74c2d4480e94338f6e88ff6300de356c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/783abea5f7f5f6fd0bb909ea02a257df74c2d4480e94338f6e88ff6300de356c?s=96&d=mm&r=g\",\"caption\":\"Rachael Carder\"},\"url\":\"https:\/\/dradis.com\/blog\/author\/rachkor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Top 10 tables - a custom Dradis script - Dradis Framework Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/","og_locale":"en_US","og_type":"article","og_title":"Top 10 tables - a custom Dradis script - Dradis Framework Blog","og_description":"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 &#8220;Top 10&#8221; script! Credit for this script idea goes to Chris from I.S. Partners. He reached out via the support inbox [&hellip;]","og_url":"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/","og_site_name":"Dradis Framework Blog","article_published_time":"2024-04-16T15:41:52+00:00","article_modified_time":"2026-04-24T01:20:14+00:00","og_image":[{"url":"https:\/\/dradis.com\/blog\/wp-content\/uploads\/2024\/04\/Screen-Shot-2024-04-11-at-12.45.55-PM.png"}],"author":"Rachael Carder","twitter_card":"summary_large_image","twitter_creator":"@dradisfw","twitter_site":"@dradisfw","twitter_misc":{"Written by":"Rachael Carder","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/","url":"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/","name":"Top 10 tables - a custom Dradis script - Dradis Framework Blog","isPartOf":{"@id":"https:\/\/dradis.com\/blog\/#website"},"datePublished":"2024-04-16T15:41:52+00:00","dateModified":"2026-04-24T01:20:14+00:00","author":{"@id":"https:\/\/dradis.com\/blog\/#\/schema\/person\/978f2d4e6ffa56f0569a62775a8320bb"},"breadcrumb":{"@id":"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dradis.com\/blog\/2024\/04\/top-10-tables-a-custom-dradis-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dradis.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Top 10 tables &#8211; a custom Dradis script"}]},{"@type":"WebSite","@id":"https:\/\/dradis.com\/blog\/#website","url":"https:\/\/dradis.com\/blog\/","name":"Dradis Framework Blog","description":"Information management for security teams","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dradis.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/dradis.com\/blog\/#\/schema\/person\/978f2d4e6ffa56f0569a62775a8320bb","name":"Rachael Carder","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dradis.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/783abea5f7f5f6fd0bb909ea02a257df74c2d4480e94338f6e88ff6300de356c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/783abea5f7f5f6fd0bb909ea02a257df74c2d4480e94338f6e88ff6300de356c?s=96&d=mm&r=g","caption":"Rachael Carder"},"url":"https:\/\/dradis.com\/blog\/author\/rachkor\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3ijVs-Cf","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/posts\/2371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/comments?post=2371"}],"version-history":[{"count":3,"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/posts\/2371\/revisions"}],"predecessor-version":[{"id":2380,"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/posts\/2371\/revisions\/2380"}],"wp:attachment":[{"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/media?parent=2371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/categories?post=2371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dradis.com\/blog\/wp-json\/wp\/v2\/tags?post=2371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}