def home(): """Home.""" context = { 'mimes': settings.UPLD_MIME, 'version': settings.VERSION, 'year': utils.year(), } return render_template('index.html', **context)
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)
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)
def _year(): return {'year': utils.year()}
def scans(): """Recent Scans view in nodejsscan.""" context = get_scans() context['version'] = settings.VERSION context['year'] = utils.year() return render_template('scans.html', **context)
def _year(): return dict(year=str(utils.year()))