Пример #1
0
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)
Пример #2
0
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
Пример #3
0
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))
Пример #4
0
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')
Пример #5
0
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')
Пример #6
0
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')
Пример #7
0
def logout():
    worker = get_worker()
    user_id = session.get('user_session_id')
    worker.logout_user(user_id)
    session.clear()
    return redirect(url_for('index'))
Пример #8
0
def view_obs(insn_bytestring, arch_string):
    worker = get_worker()
    obs_str = worker.view_obs(insn_bytestring, arch_string)
    return '<br/>'.join(obs_str)
Пример #9
0
def rule_info(insn_bytestring, arch_string):
    worker = get_worker()
    return worker._get_rule_info(insn_bytestring, arch_string)
Пример #10
0
def index():
    worker = get_worker()
    rules = worker._get_rules()
    return render_template('taintinduce/index.html', rules=rules)