示例#1
0
def captcha(id):
    html_template = 'captcha.html'
    captcha_dict_entry = id
    if captcha_dict_entry not in captcha_dict:
        return render_template('call_the_cops.html')
    question = captcha_dict[captcha_dict_entry]['question']
    answer = captcha_dict[captcha_dict_entry]['answer']
    place_holder = captcha_dict[captcha_dict_entry]['place_holder']
    form = EnterSecAnswer(request.form)
    image = captcha_dict[captcha_dict_entry]['image']
    word_hint = captcha_dict[captcha_dict_entry]['word_hint']
    print(image)
    feedback = None

    if request.method == 'POST' and form.validate():
        data_entered = form.answer.data
        if data_entered.lower() == answer.lower():
            next_id = captcha_dict[id]["next_id"]
            if next_id == page_names["key_extracted"]:
                return redirect(url_for('key_extracted'))
            else:
                return redirect(url_for("captcha", id=next_id))
        feedback = ':-( Wrong Answer. Are you really Human?'

    return render_template(html_template,
                           image=image,
                           word_hint=word_hint,
                           form=form,
                           question=question,
                           place_holder=place_holder,
                           feedback=feedback)
示例#2
0
def terminal2():
    html_template = 'terminal.html'
    form = EnterSecAnswer(request.form)
    question = "Inside folder attackerstuff. Ready for input"
    place_holder = ""
    image = None
    feedback = None
    if request.method == 'POST' and form.validate():
        answer = form.answer.data
        if answer in terminal2_commands:
            if terminal2_commands[answer]:
                feedback = terminal2_commands[answer]
            else:
                if answer == final_command:
                    return redirect(url_for("decrypted_file"))
                elif answer == "./getkey.bash":
                    return redirect(url_for("extract_key", times=0))
        else:
            feedback = terminal2_commands["__invalid__"]

    return render_template(html_template,
                           image=image,
                           form=form,
                           question=question,
                           place_holder=place_holder,
                           feedback=feedback)
示例#3
0
def security_questions(id):
    html_template = 'secquestion.html'
    form = EnterSecAnswer(request.form)
    title = sec_q_and_as[id]["title"]
    question = sec_q_and_as[id]["question"]
    place_holder = sec_q_and_as[id]["place_holder"]
    feedback = None
    if request.method == 'POST' and form.validate():
        answer = form.answer.data.lower()
        correct_answers = sec_q_and_as[id]["answer"]
        isstr = isinstance(sec_q_and_as[id]["answer"], str)
        if (isstr and answer == correct_answers)\
            or (not isstr and answer in correct_answers):
            next_id = sec_q_and_as[id]["next_id"]
            if next_id == page_names["terminal"]:
                return redirect(url_for('terminal'))
            elif next_id == captcha_ids[0]:
                return redirect(url_for("captcha", id=next_id))
            else:
                return redirect(url_for("security_questions", id=next_id))
        feedback = "Answer Invalid Try Again"

    return render_template(html_template,
                           title=title,
                           form=form,
                           question=question,
                           place_holder=place_holder,
                           feedback=feedback)
示例#4
0
def dynamic(question_arg):
    question = answer_dict[question_arg]['question']
    answer = answer_dict[question_arg]['answer']
    place_holder = answer_dict[question_arg]['place_holder']
    form = EnterSecAnswer(request.form)
    feedback = None

    if request.method == 'POST' and form.validate():
        data_entered = form.answer.data
        if data_entered.lower() == answer.lower():
            return render_template('dynamic_key.html', solution=answer_dict[question_arg]['solution'])
        feedback = ':-( wrong answer, try again'

    return render_template('secquestion.html', form=form, question=question,
                           place_holder=place_holder, feedback=feedback)
示例#5
0
def terminal():
    html_template = 'terminal.html'
    form = EnterSecAnswer(request.form)
    question = "Ready for input"
    place_holder = ""
    image = None
    feedback = None
    if request.method == 'POST' and form.validate():
        answer = form.answer.data
        if answer in terminal_commands:
            if terminal_commands[answer]:
                feedback = terminal_commands[answer]
            else:
                return redirect(url_for("terminal2"))
        else:
            feedback = terminal_commands["__invalid__"]
    return render_template(html_template,
                           image=image,
                           form=form,
                           question=question,
                           place_holder=place_holder,
                           feedback=feedback)