def view_jobs(): worker = get_worker() jobs = worker.view_jobs() obsjobs = worker.view_obs_jobs() return render_template('taintinduce/view_jobs.html', jobs=jobs, obsjobs=obsjobs)
def load_logged_in_user(): worker = get_worker() user_id = session.get('user_session_id') username = '******' if user_id is None: g.user = None else: g.user = username
def rule_dl(insn_bytestring, arch_string): worker = get_worker() rule_b64 = worker._get_rule_b64(insn_bytestring, arch_string) rule = base64.b64decode(rule_b64) rule_file = io.BytesIO(rule) return send_file(rule_file, mimetype='application/octet-stream', as_attachment=True, attachment_filename='{}_{}.rule'.format( arch_string, insn_bytestring))
def login(): worker = get_worker() if request.method == 'POST': username = request.form['username'] password = request.form['password'] error = None session_id = worker.login_user(username, password) if session_id: session.clear session['user_session_id'] = session_id return redirect(url_for('index')) flash(error) return render_template('auth/login.html')
def register(): worker = get_worker() if request.method == 'POST': username = request.form['username'] password = request.form['password'] error = None if not username: error = 'Username is required' elif not password: error = 'Password is required' uid = worker.create_user(username, password) if error is None and uid: return redirect(url_for('auth.login')) flash(error) return render_template('auth/register.html')
def submit_job(): if request.method == 'POST': insn_bytestring = request.form['bytestring'] arch_string = request.form['archstring'] state_string = request.form['state_string'] sid = session.get('user_session_id') error = None if not insn_bytestring or not arch_string: error = 'Please fill in both bytestring and archstring' if error is not None: flash(error) else: worker = get_worker() if state_string: worker.add_obs_job_check(sid, insn_bytestring, arch_string, state_string) else: worker.add_obs_job_check(sid, insn_bytestring, arch_string) return redirect(url_for('taintinduce.view_jobs')) return render_template('taintinduce/submit_job.html')
def logout(): worker = get_worker() user_id = session.get('user_session_id') worker.logout_user(user_id) session.clear() return redirect(url_for('index'))
def view_obs(insn_bytestring, arch_string): worker = get_worker() obs_str = worker.view_obs(insn_bytestring, arch_string) return '<br/>'.join(obs_str)
def rule_info(insn_bytestring, arch_string): worker = get_worker() return worker._get_rule_info(insn_bytestring, arch_string)
def index(): worker = get_worker() rules = worker._get_rules() return render_template('taintinduce/index.html', rules=rules)