Skip to content

Commit

Permalink
Only include desired parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
x4v13r64 committed May 17, 2019
1 parent 0454814 commit ddf3485
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 28 deletions.
13 changes: 6 additions & 7 deletions ScoutSuite/__main__.py
Expand Up @@ -2,7 +2,6 @@
import copy
import os
import webbrowser
import inspect

from concurrent.futures import ThreadPoolExecutor

Expand Down Expand Up @@ -229,13 +228,13 @@ async def _run(provider,
else:
exceptions = {}

# Build dict with function arguments
frame = inspect.currentframe()
function_args, _, _, function_values = inspect.getargvalues(frame)
function_arguments_dict = dict([(i, function_values[i]) for i in function_args if function_values[i]])

run_parameters = {
'services': services,
'skipped_services': skipped_services,
'regions': regions,
}
# Finalize
cloud_provider.postprocessing(report.current_time, finding_rules, function_arguments_dict)
cloud_provider.postprocessing(report.current_time, finding_rules, run_parameters)

# Save config and create HTML report
html_report_path = report.save(
Expand Down
26 changes: 9 additions & 17 deletions ScoutSuite/output/data/html/partials/last_run_details.html
Expand Up @@ -11,23 +11,15 @@ <h5 class="modal-title">Execution Details</h5>
<div>
<p><strong>Provider:</strong> {{provider_name}}</p>
<p><strong>Time:</strong> {{format_date last_run.time}}</p>
<p><strong>Execution Parameters:</strong>
<table class="table">
<thead>
<tr>
<th scope="col">Parameter</th>
<th scope="col">Value</th>
</tr>
</thead>
<tbody>
{{#each last_run.arguments}}
<tr>
<td>{{@key}}</td>
<td>{{this}}</td>
</tr>
{{/each}}
</tbody>
</table>
{{#if last_run.run_parameters.services}}
<p><strong>Services:</strong> {{last_run.run_parameters.services}}</p>
{{/if}}
{{#if last_run.run_parameters.skipped_services}}
<p><strong>Skipped Services:</strong> {{last_run.run_parameters.skipped_services}}</p>
{{/if}}
{{#if last_run.run_parameters.regions}}
<p><strong>Regions:</strong> {{last_run.run_parameters.regions}}</p>
{{/if}}
<p><strong>Report generated with</strong> Scout Suite version <samp>{{last_run.version}}</samp></p>
<p><strong>Using ruleset</strong> <samp>{{last_run.ruleset_name}}</samp>:
<p class="ml-4 mr-4 text-justify"><em>{{last_run.ruleset_about}}</em></p>
Expand Down
8 changes: 4 additions & 4 deletions ScoutSuite/providers/base/provider.py
Expand Up @@ -62,12 +62,12 @@ def preprocessing(self, ip_ranges=None, ip_ranges_name_key=None):
# Preprocessing dictated by metadata
self._process_metadata_callbacks()

def postprocessing(self, current_time, ruleset, function_arguments):
def postprocessing(self, current_time, ruleset, run_parameters):
"""
Sets post-run information.
"""
self._update_metadata()
self._update_last_run(current_time, ruleset, function_arguments)
self._update_last_run(current_time, ruleset, run_parameters)

async def fetch(self, regions=None, skipped_regions=None, partition_name=None):
"""
Expand Down Expand Up @@ -115,11 +115,11 @@ def _build_services_list(supported_services, services, skipped_services):

return [s for s in supported_services if (services == [] or s in services) and s not in skipped_services]

def _update_last_run(self, current_time, ruleset, function_arguments):
def _update_last_run(self, current_time, ruleset, run_parameters):

last_run = {
'time': current_time.strftime("%Y-%m-%d %H:%M:%S%z"),
'arguments': function_arguments,
'run_parameters': run_parameters,
'version': scout_version,
'ruleset_name': ruleset.name,
'ruleset_about': ruleset.about,
Expand Down

0 comments on commit ddf3485

Please sign in to comment.