data_manager = utils.data_manager.DataManager(db_wrapper, instance_id) db_wrapper, db_pool_manager = DbFactory.get_wrapper(args) version = MADVersion(args, data_manager) version.get_version() MappingManagerManager.register('MappingManager', MappingManager) mapping_manager_manager = MappingManagerManager() mapping_manager_manager.start() mapping_manager_stop_event = mapping_manager_manager.Event() mapping_manager: MappingManager = mapping_manager_manager.MappingManager( db_wrapper, args, data_manager, True) ws_server = WebsocketServer(args, None, db_wrapper, mapping_manager, None, data_manager, configmode=True) t_ws = Thread(name='scanner', target=ws_server.start_server) t_ws.daemon = False t_ws.start() jobstatus: dict = {} device_Updater = deviceUpdater(ws_server, args, jobstatus) logger.success( 'Starting MADmin on port {} - Open a browser, visit MADmin and go to "Settings"', int(args.madmin_port)) t_flask = Thread(name='madmin',
mitm_mapper: MitmMapper = mitm_mapper_manager.MitmMapper( mapping_manager, db_wrapper) from ocr.pogoWindows import PogoWindows pogoWindowManager = PogoWindows(args.temp_path, args.ocr_thread_count) mitm_receiver_process = MITMReceiver(args.mitmreceiver_ip, int(args.mitmreceiver_port), mitm_mapper, args, mapping_manager, db_wrapper) mitm_receiver_process.start() logger.info('Starting websocket server on port {}'.format( str(args.ws_port))) ws_server = WebsocketServer(args, mitm_mapper, db_wrapper, mapping_manager, pogoWindowManager) t_ws = Thread(name='scanner', target=ws_server.start_server) t_ws.daemon = False t_ws.start() # init jobprocessor device_Updater = deviceUpdater(ws_server, args, jobstatus) webhook_worker = None if args.webhook: from webhook.webhookworker import WebhookWorker rarity = Rarity(args, db_wrapper) rarity.start_dynamic_rarity() webhook_worker = WebhookWorker(args, db_wrapper,
if "ocr" in area.get("mode", ""): ocr_enabled = True if ocr_enabled: from ocr.copyMons import MonRaidImages MonRaidImages.runAll(args.pogoasset, db_wrapper=db_wrapper) mitm_receiver = MITMReceiver(args.mitmreceiver_ip, int(args.mitmreceiver_port), mitm_mapper, args, auths, db_wrapper) t_mitm = Thread(name='mitm_receiver', target=mitm_receiver.run_receiver) t_mitm.daemon = False t_mitm.start() log.info('Starting scanner....') ws_server = WebsocketServer(args, mitm_mapper, db_wrapper, routemanagers, device_mappings, auths) t_ws = Thread(name='scanner', target=ws_server.start_server) t_ws.daemon = True t_ws.start() log.info("Starting file watcher for mappings.json changes.") t_file_watcher = Thread(name='file_watcher', target=file_watcher, args=(db_wrapper, mitm_mapper, ws_server)) t_file_watcher.daemon = False t_file_watcher.start() if args.only_ocr: from ocr.copyMons import MonRaidImages MonRaidImages.runAll(args.pogoasset, db_wrapper=db_wrapper)
db_wrapper.create_status_database_if_not_exists() db_wrapper.create_usage_database_if_not_exists() db_wrapper.create_statistics_databases_if_not_exists() version = MADVersion(args, db_wrapper) version.get_version() data_manager = utils.data_manager.DataManager(logger, args) MappingManagerManager.register('MappingManager', MappingManager) mapping_manager_manager = MappingManagerManager() mapping_manager_manager.start() mapping_manager_stop_event = mapping_manager_manager.Event() mapping_manager: MappingManager = mapping_manager_manager.MappingManager( db_wrapper, args, data_manager, True) ws_server = WebsocketServer(args, None, db_wrapper, mapping_manager, None, True) t_ws = Thread(name='scanner', target=ws_server.start_server) t_ws.daemon = False t_ws.start() jobstatus: dict = {} device_Updater = deviceUpdater(ws_server, args, jobstatus) logger.success( 'Starting MADmin on port {} - Open a browser, visit MADmin and go to "Settings"', int(args.madmin_port)) t_flask = Thread(name='madmin', target=start_madmin, args=(args, db_wrapper, ws_server, mapping_manager, data_manager, device_Updater, jobstatus))
db_wrapper.create_status_database_if_not_exists() db_wrapper.create_usage_database_if_not_exists() version = MADVersion(args, db_wrapper) version.get_version() try: (device_mappings, routemanagers, auths) = load_mappings(db_wrapper) except KeyError as e: logger.error( "Could not parse mappings. Please check those. Reason: {}", str(e)) sys.exit(1) except RuntimeError as e: logger.error("There is something wrong with your mappings. Reason: {}", str(e)) sys.exit(1) ws_server = WebsocketServer(args, None, db_wrapper, routemanagers, device_mappings, auths, None, True) t_ws = Thread(name='scanner', target=ws_server.start_server) t_ws.daemon = False t_ws.start() logger.success( 'Starting MADmin on port {} - open browser and click "Mapping Editor"', int(args.madmin_port)) t_flask = Thread(name='madmin', target=start_madmin, args=(args, db_wrapper, ws_server)) t_flask.daemon = False t_flask.start()
pogoWindowManager = PogoWindows(args.temp_path, args.ocr_thread_count) if ocr_enabled: from ocr.copyMons import MonRaidImages MonRaidImages.runAll(args.pogoasset, db_wrapper=db_wrapper) mitm_receiver = MITMReceiver() t_mitm = Process(name='mitm_receiver', target=mitm_receiver.run_receiver, args=(mitm_receiver, args.mitmreceiver_ip, int(args.mitmreceiver_port), mitm_mapper, args, auths)) # t_mitm.daemon = True t_mitm.start() time.sleep(5) logger.info('Starting scanner') ws_server = WebsocketServer(args, mitm_mapper, db_wrapper, routemanagers, device_mappings, auths, pogoWindowManager) t_ws = Thread(name='scanner', target=ws_server.start_server) t_ws.daemon = False t_ws.start() webhook_worker = None if args.webhook: from webhook.webhookworker import WebhookWorker rarity = Rarity(args, db_wrapper) rarity.start_dynamic_rarity() webhook_worker = WebhookWorker( args, db_wrapper, routemanagers, rarity) t_whw = Thread(name="webhook_worker", target=webhook_worker.run_worker)
def start_scan(mitm_mapper, db_wrapper, routemanagers, device_mappings, auths): # wsRunning = WebsocketServerBase(args, args.ws_ip, int(args.ws_port), mitm_mapper, db_wrapper, routemanagers, # device_mappings, auths) wsRunning = WebsocketServer(args, mitm_mapper, db_wrapper, routemanagers, device_mappings, auths) wsRunning.start_server()