예제 #1
0
def madmin_start(args, db_wrapper: DbWrapper, ws_server,
                 mapping_manager: MappingManager, data_manager, deviceUpdater,
                 jobstatus):
    # load routes
    if args.madmin_base_path:
        app.wsgi_app = ReverseProxied(app.wsgi_app,
                                      script_name=args.madmin_base_path)

    statistics(db_wrapper, args, app, mapping_manager, data_manager)
    control(db_wrapper, args, mapping_manager, ws_server, logger, app,
            deviceUpdater)
    map(db_wrapper, args, mapping_manager, app, data_manager)
    APIEntry(logger, app, data_manager, mapping_manager, ws_server,
             args.config_mode)
    config(db_wrapper, args, logger, app, mapping_manager, data_manager)
    path(db_wrapper, args, app, mapping_manager, jobstatus, data_manager)
    apk_manager(db_wrapper, args, app, mapping_manager, jobstatus)

    app.logger.removeHandler(default_handler)
    logging.basicConfig(handlers=[InterceptHandler()], level=0)
    app.run(host=args.madmin_ip, port=int(args.madmin_port), threaded=True)
예제 #2
0
from mapadroid.ocr.pogoWindows import PogoWindows
from mapadroid.utils.CustomTypes import MessageTyping
from mapadroid.utils.MappingManager import MappingManager
from mapadroid.utils.authHelper import check_auth
from mapadroid.data_manager import DataManager
from mapadroid.utils.logging import InterceptHandler, get_logger, LoggerEnums, get_origin_logger
import logging
from mapadroid.websocket.AbstractCommunicator import AbstractCommunicator
from mapadroid.websocket.WebsocketConnectedClientEntry import WebsocketConnectedClientEntry
from mapadroid.websocket.communicator import Communicator
from mapadroid.worker.AbstractWorker import AbstractWorker
from mapadroid.worker.WorkerFactory import WorkerFactory

logging.getLogger('websockets.server').setLevel(logging.DEBUG)
logging.getLogger('websockets.protocol').setLevel(logging.DEBUG)
logging.getLogger('websockets.server').addHandler(InterceptHandler(log_section=LoggerEnums.websocket))
logging.getLogger('websockets.protocol').addHandler(InterceptHandler(log_section=LoggerEnums.websocket))


logger = get_logger(LoggerEnums.websocket)


class WebsocketServer(object):
    def __init__(self, args, mitm_mapper: MitmMapper, db_wrapper: DbWrapper, mapping_manager: MappingManager,
                 pogo_window_manager: PogoWindows, data_manager: DataManager, event, enable_configmode: bool = False):
        self.__args = args
        self.__db_wrapper: DbWrapper = db_wrapper
        self.__mapping_manager: MappingManager = mapping_manager
        self.__pogo_window_manager: PogoWindows = pogo_window_manager
        self.__data_manager: DataManager = data_manager
        self.__mitm_mapper: MitmMapper = mitm_mapper
예제 #3
0
from mapadroid.utils.CustomTypes import MessageTyping
from mapadroid.utils.MappingManager import MappingManager
from mapadroid.utils.authHelper import check_auth
from mapadroid.data_manager import DataManager
from mapadroid.utils.logging import InterceptHandler, get_logger, LoggerEnums, get_origin_logger
import logging
from mapadroid.websocket.AbstractCommunicator import AbstractCommunicator
from mapadroid.websocket.WebsocketConnectedClientEntry import WebsocketConnectedClientEntry
from mapadroid.websocket.communicator import Communicator
from mapadroid.worker.AbstractWorker import AbstractWorker
from mapadroid.worker.WorkerFactory import WorkerFactory

logging.getLogger('websockets.server').setLevel(logging.DEBUG)
logging.getLogger('websockets.protocol').setLevel(logging.DEBUG)
logging.getLogger('websockets.server').addHandler(
    InterceptHandler(log_section=LoggerEnums.websocket))
logging.getLogger('websockets.protocol').addHandler(
    InterceptHandler(log_section=LoggerEnums.websocket))

logger = get_logger(LoggerEnums.websocket)


class WebsocketServer(object):
    def __init__(self,
                 args,
                 mitm_mapper: MitmMapper,
                 db_wrapper: DbWrapper,
                 mapping_manager: MappingManager,
                 pogo_window_manager: PogoWindows,
                 data_manager: DataManager,
                 event,
예제 #4
0
from mapadroid.utils.CustomTypes import MessageTyping
from mapadroid.utils.MappingManager import MappingManager
from mapadroid.utils.authHelper import check_auth
from mapadroid.utils.data_manager import DataManager
from mapadroid.utils.logging import logger, InterceptHandler
import logging

from mapadroid.websocket.AbstractCommunicator import AbstractCommunicator
from mapadroid.websocket.WebsocketConnectedClientEntry import WebsocketConnectedClientEntry
from mapadroid.websocket.communicator import Communicator
from mapadroid.worker.AbstractWorker import AbstractWorker
from mapadroid.worker.WorkerFactory import WorkerFactory

logging.getLogger('websockets.server').setLevel(logging.DEBUG)
logging.getLogger('websockets.protocol').setLevel(logging.DEBUG)
logging.getLogger('websockets.server').addHandler(InterceptHandler())
logging.getLogger('websockets.protocol').addHandler(InterceptHandler())


class WebsocketServer(object):
    def __init__(self,
                 args,
                 mitm_mapper: MitmMapper,
                 db_wrapper: DbWrapper,
                 mapping_manager: MappingManager,
                 pogo_window_manager: PogoWindows,
                 data_manager: DataManager,
                 enable_configmode: bool = False):
        self.__args = args
        self.__db_wrapper: DbWrapper = db_wrapper
        self.__mapping_manager: MappingManager = mapping_manager
예제 #5
0
파일: madmin.py 프로젝트: Elfnoir/MAD
from mapadroid.utils.logging import InterceptHandler, get_logger, LoggerEnums
from mapadroid.websocket.WebsocketServer import WebsocketServer

logger = get_logger(LoggerEnums.madmin)
app = Flask(__name__,
            static_folder=os.path.join(mapadroid.MAD_ROOT,
                                       'static/madmin/static'),
            template_folder=os.path.join(mapadroid.MAD_ROOT,
                                         'static/madmin/templates'))
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1)
app.config['UPLOAD_FOLDER'] = 'temp'
app.config['MAX_CONTENT_LENGTH'] = 200 * 1024 * 1024
app.secret_key = "8bc96865945be733f3973ba21d3c5949"
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
log = logging.getLogger('werkzeug')
handler = InterceptHandler(log_section=LoggerEnums.madmin)
log.addHandler(handler)


@app.after_request
def after_request(response):
    response.headers.add('Access-Control-Allow-Origin', '*')
    response.headers.add('Access-Control-Allow-Headers',
                         'Content-Type,Authorization')
    response.headers.add('Access-Control-Allow-Methods',
                         'GET,PUT,POST,DELETE,OPTIONS')
    return response


@app.errorhandler(500)
def internal_error(self, exception):