Skip to content

Instantly share code, notes, and snippets.

@berdario
Created April 21, 2015 11:49
Show Gist options
  • Save berdario/cc65c04a4a1890df0882 to your computer and use it in GitHub Desktop.
Save berdario/cc65c04a4a1890df0882 to your computer and use it in GitHub Desktop.
from operator import or_
from functools import reduce
import inquirer
types = {'web': {'directory brute force', 'httrack', 'drupal scans', 'web app'},
'ssl': {'ssl audit', 'web app', 'drupal scans'},
'infra': {'nmap common', 'nmap all tcp', 'udp', 'windows audit'}}
def assessments(answers):
choices = answers['types']
return sorted(reduce(or_, (types[c] for c in choices)))
questions = [inquirer.Checkbox('types',
message='Choose assessment type(s)',
choices=sorted(types),
validate=lambda _, choice: bool(choice)),
inquirer.Checkbox('assessments',
message='Choose assessment(s)',
choices=assessments)
]
choices = inquirer.prompt(questions)
if 'web app' in choices['assessments']:
extra_questions = [inquirer.Confirm('parallel', message='Should the web app test be run in parallel?', default=True),
inquirer.Confirm('http-only', message='Should the tests skip TLS endpoints?')]
choices.update(inquirer.prompt(extra_questions))
print(choices)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment