Ejemplo n.º 1
0
def home():
    """Home."""
    context = {
        'mimes': settings.UPLD_MIME,
        'version': settings.VERSION,
        'year': utils.year(),
    }
    return render_template('index.html', **context)
Ejemplo n.º 2
0
def scan_result(sha2):
    """Get Scan result."""
    res = get_results(sha2)
    if not res:
        return jsonify({'status': 'failed', 'message': 'Scan hash not found'})
    triage = filters.get_triaged(res)
    filters.filter_files(res, 'nodejs')
    filters.filter_files(res, 'templates')
    new_dict = copy.deepcopy(res)
    filters.filter_rules(res, new_dict, 'nodejs')
    filters.filter_rules(res, new_dict, 'templates')
    new_dict['version'] = settings.VERSION
    new_dict['year'] = utils.year()
    sev, isus = filters.get_metrics(new_dict)
    new_dict['severity'] = sev
    new_dict['security_issues'] = isus
    new_dict['triaged'] = triage
    return render_template('scan_result.html', **new_dict)
Ejemplo n.º 3
0
def search_file(request):
    """Search in files."""
    context = {}
    query = request.form['q']
    scan_hash = request.form['scan_hash']
    if not utils.issha2(scan_hash):
        return jsonify({'status': 'failed', 'message': 'Scan hash not found'})
    res = get_results(scan_hash)
    if not res:
        return jsonify({'status': 'failed', 'message': 'Scan hash not found'})
    matches = nodejsscan.all_files(res['location'], True, query)
    context = {
        'matches': matches,
        'term': query,
        'scan_hash': scan_hash,
        'version': settings.VERSION,
        'year': utils.year(),
    }
    return render_template('search.html', **context)
Ejemplo n.º 4
0
def _year():
    return {'year': utils.year()}
Ejemplo n.º 5
0
def scans():
    """Recent Scans view in nodejsscan."""
    context = get_scans()
    context['version'] = settings.VERSION
    context['year'] = utils.year()
    return render_template('scans.html', **context)
Ejemplo n.º 6
0
def _year():
    return dict(year=str(utils.year()))