def sgaudit(account, region): try: c = connect(account, region, 'ec2') report, empty_groups = get_reports(c) return render_template('sgaudit.html', report=report) except Exception, e: return render_template('unauthorized.html', account=account)
def sgaudit_account_monitor(account=None, region=None): if account == None or region == None: return jsonify(error='account and region required') monitor = dict() c = connect(account, region, 'ec2') report, empty_groups = get_reports(c) security_alert = False if report: security_alert = report return jsonify(audit={account: {region: security_alert}})
def sgaudit_monitor(): monitor = dict() for account in current_app.config['CONFIG']['accounts']: monitor[account] = dict() for region in current_app.config['CONFIG']['regions']: c = connect(account, region, 'ec2') report, empty_groups = get_reports(c) if report: monitor[account][region] = True else: monitor[account][region] = False return jsonify(sgaudit=monitor)
def sgaudit(account, region): c = connect(account, region, 'ec2') report, empty_groups = get_reports(c) return render_template('sgaudit.html', report=report)