def __init__(self): #get list of all the hosts self.host_manager = HostManager() self.localPlayer = xbmc.Player()
from flask import Flask, Response, request, jsonify from lxml.etree import XMLParser, fromstring as validate_xml, XMLSyntaxError from hostmanager import HostManager from functools import wraps from datetime import datetime, timedelta import jwt import os app = Flask(__name__) app.config.from_pyfile("config.cfg") # TODO: uncomment the following line when all the testing is done # app.config["DEBUG"] = False hostmgr = HostManager(app.config.get("DB_FILE")) # Because I had to spend hours looking for a way to introduce a # vulnerability somewhere xml_parser = XMLParser(no_network=False, load_dtd=True, huge_tree=True) # <------------------------------- Decorators -------------------------------> def user_agent_required(f): @wraps(f) def decorated_function(*args, **kwargs): if request.headers.get("User-Agent") != app.config.get("USER_AGENT"): return ( Response("<error>Unrecognized agent</error>", mimetype="application/xml"), 401,